Issue 27: timeout adjustments and fixed a subtle bug in listnodes

This commit is contained in:
Adrian Cole 2010-06-16 00:40:48 -04:00
parent 3cd0c2223d
commit 4b91eb6046
2 changed files with 12 additions and 4 deletions

View File

@ -20,6 +20,7 @@ package org.jclouds.aws.ec2;
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_ENDPOINT; import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_ENDPOINT;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_PORT_OPEN;
import java.util.Properties; import java.util.Properties;
@ -38,6 +39,8 @@ public class EucalyptusPropertiesBuilder extends EC2PropertiesBuilder {
// properties.setProperty(PROPERTY_ELB_ENDPOINT, // properties.setProperty(PROPERTY_ELB_ENDPOINT,
// "https://elasticloadbalancing.us-east-1.amazonaws.com"); // "https://elasticloadbalancing.us-east-1.amazonaws.com");
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin"); properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin");
properties.setProperty(PROPERTY_TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + "");
return properties; return properties;
} }

View File

@ -29,6 +29,7 @@ import static org.jclouds.concurrent.ConcurrentUtils.awaitCompletion;
import java.net.URI; import java.net.URI;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
@ -262,10 +263,14 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
String[] parts = parseHandle(id); String[] parts = parseHandle(id);
String region = parts[0]; String region = parts[0];
String instanceId = parts[1]; String instanceId = parts[1];
try {
RunningInstance runningInstance = Iterables RunningInstance runningInstance = Iterables
.getOnlyElement(getAllRunningInstancesInRegion(client .getOnlyElement(getAllRunningInstancesInRegion(client
.getInstanceServices(), region, instanceId)); .getInstanceServices(), region, instanceId));
return runningInstanceToNodeMetadata.apply(runningInstance); return runningInstanceToNodeMetadata.apply(runningInstance);
} catch (NoSuchElementException e) {
return null;
}
} }
} }