mirror of https://github.com/apache/jclouds.git
Issue 230 fixed ibm timeouts
This commit is contained in:
parent
b2141b0d59
commit
cace0ce00e
|
@ -74,7 +74,7 @@ public class RetryablePredicate<T> implements Predicate<T> {
|
|||
}
|
||||
|
||||
long nextMaxInterval(long attempt, Date end) {
|
||||
long interval = (period * (long) Math.pow(attempt, 2l));
|
||||
long interval = (period * (long) Math.pow(attempt, 1.5));
|
||||
long max = end.getTime() - System.currentTimeMillis();
|
||||
return (interval > max) ? max : interval;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.jclouds.ibmdev;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_RUNNING;
|
||||
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT;
|
||||
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_LOCATION;
|
||||
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_PASSWORD;
|
||||
|
@ -46,6 +47,8 @@ public class IBMDeveloperCloudPropertiesBuilder extends PropertiesBuilder {
|
|||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT,
|
||||
"https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403");
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_LOCATION, "1");
|
||||
properties.setProperty(PROPERTY_TIMEOUT_NODE_RUNNING, (15 * 60 * 1000)
|
||||
+ "");
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
@ -58,15 +61,18 @@ public class IBMDeveloperCloudPropertiesBuilder extends PropertiesBuilder {
|
|||
withCredentials(id, secret);
|
||||
}
|
||||
|
||||
public IBMDeveloperCloudPropertiesBuilder withCredentials(String id, String secret) {
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_USER, checkNotNull(id, "user"));
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_PASSWORD, checkNotNull(secret, "password"));
|
||||
public IBMDeveloperCloudPropertiesBuilder withCredentials(String id,
|
||||
String secret) {
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_USER, checkNotNull(id,
|
||||
"user"));
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_PASSWORD, checkNotNull(
|
||||
secret, "password"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IBMDeveloperCloudPropertiesBuilder withEndpoint(URI endpoint) {
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT,
|
||||
checkNotNull(endpoint, "endpoint").toString());
|
||||
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, checkNotNull(
|
||||
endpoint, "endpoint").toString());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions {
|
|||
* @param configurationData
|
||||
* extra configuration to pass to the instance
|
||||
*/
|
||||
public CreateInstanceOptions configurationData(Map<String, String> configurationData) {
|
||||
public CreateInstanceOptions configurationData(
|
||||
Map<String, String> configurationData) {
|
||||
checkNotNull(configurationData, "configurationData");
|
||||
for (Entry<String, String> entry : configurationData.entrySet()) {
|
||||
formParameters.removeAll(entry.getKey());
|
||||
|
@ -100,7 +101,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions {
|
|||
/**
|
||||
* @see CreateInstanceOptions#configurationData(Map<String, String> )
|
||||
*/
|
||||
public static CreateInstanceOptions configurationData(Map<String, String> configurationData) {
|
||||
public static CreateInstanceOptions configurationData(
|
||||
Map<String, String> configurationData) {
|
||||
CreateInstanceOptions options = new CreateInstanceOptions();
|
||||
return options.configurationData(configurationData);
|
||||
}
|
||||
|
@ -108,7 +110,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions {
|
|||
/**
|
||||
* @see CreateInstanceOptions#mountVolume(String, String )
|
||||
*/
|
||||
public static CreateInstanceOptions mountVolume(String id, String mountPoint) {
|
||||
public static CreateInstanceOptions mountVolume(String id,
|
||||
String mountPoint) {
|
||||
CreateInstanceOptions options = new CreateInstanceOptions();
|
||||
return options.mountVolume(id, mountPoint);
|
||||
}
|
||||
|
@ -124,7 +127,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions {
|
|||
/**
|
||||
* @see CreateInstanceOptions#authorizePublicKey(String )
|
||||
*/
|
||||
public static CreateInstanceOptions authorizePublicKey(String publicKeyName) {
|
||||
public static CreateInstanceOptions authorizePublicKey(
|
||||
String publicKeyName) {
|
||||
CreateInstanceOptions options = new CreateInstanceOptions();
|
||||
return options.authorizePublicKey(publicKeyName);
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ public class IBMDeveloperCloudClientLiveTest {
|
|||
ImmutableMap.of("insight_admin_password", "myPassword1",
|
||||
"db2_admin_password", "myPassword2",
|
||||
"report_user_password", "myPassword3"))
|
||||
.authorizePublicKey(key.getName()).attachIp(ip.getId()));
|
||||
.authorizePublicKey(key.getName()));
|
||||
try {
|
||||
assertIpHostAndStatusNEW(instance);
|
||||
assertConsistent(instance, TAG);
|
||||
|
@ -342,12 +342,14 @@ public class IBMDeveloperCloudClientLiveTest {
|
|||
|
||||
long start = System.currentTimeMillis();
|
||||
assert new RetryablePredicate<Instance>(new InstanceActive(connection),
|
||||
600, 2, TimeUnit.SECONDS).apply(instance) : connection
|
||||
.getInstance(instance.getId());
|
||||
15 * 60 * 1000).apply(instance) : connection.getInstance(instance
|
||||
.getId());
|
||||
|
||||
System.out.println(((System.currentTimeMillis() - start) / 1000)
|
||||
+ " seconds");
|
||||
|
||||
instance = connection.getInstance(instance.getId());
|
||||
|
||||
try {
|
||||
assertIpHostAndStatusACTIVE(instance);
|
||||
assertConsistent(instance, TAG);
|
||||
|
|
Loading…
Reference in New Issue