mirror of https://github.com/apache/jclouds.git
Issue 1049:support aws-ec2 cluster compute instances in eu-west-1
This commit is contained in:
parent
53fe278f03
commit
0424274259
|
@ -69,7 +69,7 @@ public class AWSEC2ProviderMetadata extends BaseProviderMetadata {
|
||||||
properties.setProperty(PROPERTY_EC2_AMI_QUERY,
|
properties.setProperty(PROPERTY_EC2_AMI_QUERY,
|
||||||
"owner-id=137112412989,801119661308,063491364108,099720109477,411009282317;state=available;image-type=machine");
|
"owner-id=137112412989,801119661308,063491364108,099720109477,411009282317;state=available;image-type=machine");
|
||||||
// amis that work with the cluster instances
|
// amis that work with the cluster instances
|
||||||
properties.setProperty(PROPERTY_EC2_CC_REGIONS, Region.US_EAST_1);
|
properties.setProperty(PROPERTY_EC2_CC_REGIONS, Region.US_EAST_1 + "," + Region.EU_WEST_1);
|
||||||
properties
|
properties
|
||||||
.setProperty(
|
.setProperty(
|
||||||
PROPERTY_EC2_CC_AMI_QUERY,
|
PROPERTY_EC2_CC_AMI_QUERY,
|
||||||
|
|
|
@ -24,6 +24,7 @@ import static com.google.common.collect.Sets.newTreeSet;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -36,7 +37,6 @@ import org.jclouds.aws.ec2.domain.PlacementGroup.State;
|
||||||
import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable;
|
import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable;
|
||||||
import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted;
|
import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted;
|
||||||
import org.jclouds.compute.RunNodesException;
|
import org.jclouds.compute.RunNodesException;
|
||||||
import org.jclouds.compute.domain.HardwareBuilder;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
|
@ -63,6 +63,8 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "PlacementGroupClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "PlacementGroupClientLiveTest")
|
||||||
public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
|
ArrayList<String> supportedRegions = newArrayList(Region.US_EAST_1, Region.EU_WEST_1);
|
||||||
|
|
||||||
public PlacementGroupClientLiveTest() {
|
public PlacementGroupClientLiveTest() {
|
||||||
provider = "aws-ec2";
|
provider = "aws-ec2";
|
||||||
}
|
}
|
||||||
|
@ -86,7 +88,7 @@ public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveT
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribe() {
|
void testDescribe() {
|
||||||
for (String region : newArrayList(Region.US_EAST_1)) {
|
for (String region : supportedRegions) {
|
||||||
SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupServices()
|
SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupServices()
|
||||||
.describePlacementGroupsInRegion(region));
|
.describePlacementGroupsInRegion(region));
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
|
@ -101,10 +103,10 @@ public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveT
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String region : client.getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
|
for (String region : client.getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
|
||||||
if (!region.equals(Region.US_EAST_1))
|
if (!supportedRegions.contains(region))
|
||||||
try {
|
try {
|
||||||
client.getPlacementGroupServices().describePlacementGroupsInRegion(region);
|
client.getPlacementGroupServices().describePlacementGroupsInRegion(region);
|
||||||
assert false : "should be unsupported";
|
assert false : "should be unsupported for region: " + region;
|
||||||
} catch (UnsupportedOperationException e) {
|
} catch (UnsupportedOperationException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,15 +115,18 @@ public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveT
|
||||||
@Test
|
@Test
|
||||||
void testCreatePlacementGroup() {
|
void testCreatePlacementGroup() {
|
||||||
String groupName = PREFIX + "1";
|
String groupName = PREFIX + "1";
|
||||||
client.getPlacementGroupServices().deletePlacementGroupInRegion(null, groupName);
|
for (String region : supportedRegions) {
|
||||||
client.getPlacementGroupServices().createPlacementGroupInRegion(null, groupName);
|
|
||||||
|
|
||||||
verifyPlacementGroup(groupName);
|
client.getPlacementGroupServices().deletePlacementGroupInRegion(region, groupName);
|
||||||
|
client.getPlacementGroupServices().createPlacementGroupInRegion(region, groupName);
|
||||||
|
|
||||||
|
verifyPlacementGroup(region, groupName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyPlacementGroup(String groupName) {
|
private void verifyPlacementGroup(String region, String groupName) {
|
||||||
assert availableTester.apply(new PlacementGroup(Region.US_EAST_1, groupName, "cluster", State.PENDING)) : group;
|
assert availableTester.apply(new PlacementGroup(region, groupName, "cluster", State.PENDING)) : group;
|
||||||
Set<PlacementGroup> oneResult = client.getPlacementGroupServices().describePlacementGroupsInRegion(null,
|
Set<PlacementGroup> oneResult = client.getPlacementGroupServices().describePlacementGroupsInRegion(region,
|
||||||
groupName);
|
groupName);
|
||||||
assertNotNull(oneResult);
|
assertNotNull(oneResult);
|
||||||
assertEquals(oneResult.size(), 1);
|
assertEquals(oneResult.size(), 1);
|
||||||
|
@ -133,15 +138,15 @@ public class PlacementGroupClientLiveTest extends BaseComputeServiceContextLiveT
|
||||||
|
|
||||||
public void testStartCCInstance() throws Exception {
|
public void testStartCCInstance() throws Exception {
|
||||||
|
|
||||||
Template template = view.getComputeService().templateBuilder().fromHardware(EC2HardwareBuilder.cc2_8xlarge().build()).osFamily(OsFamily.AMZN_LINUX).build();
|
Template template = view.getComputeService().templateBuilder()
|
||||||
|
.fromHardware(EC2HardwareBuilder.cc2_8xlarge().build()).osFamily(OsFamily.AMZN_LINUX).build();
|
||||||
assert template != null : "The returned template was null, but it should have a value.";
|
assert template != null : "The returned template was null, but it should have a value.";
|
||||||
assertEquals(template.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
|
assertEquals(template.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
|
||||||
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
|
assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
|
||||||
assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");
|
assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");
|
||||||
|
|
||||||
template.getOptions().runScript(
|
template.getOptions().runScript(Statements.newStatementList(AdminAccess.standard(), InstallJDK.fromOpenJDK()));
|
||||||
Statements.newStatementList(AdminAccess.standard(), InstallJDK.fromOpenJDK()));
|
|
||||||
|
|
||||||
String group = PREFIX + "cccluster";
|
String group = PREFIX + "cccluster";
|
||||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
||||||
|
|
Loading…
Reference in New Issue