Issue 859:AWS EC2 Updates: New Medium Instance, 64-bit Ubiquity

This commit is contained in:
Adrian Cole 2012-03-08 10:52:56 -08:00
parent 68c94ff8ed
commit 38de846947
8 changed files with 52 additions and 42 deletions

View File

@ -203,18 +203,6 @@ public class EC2HardwareBuilder extends HardwareBuilder {
return EC2HardwareBuilder.class.cast(super.userMetadata(userMetadata)); return EC2HardwareBuilder.class.cast(super.userMetadata(userMetadata));
} }
/**
* @see InstanceType#M1_SMALL
*/
public static EC2HardwareBuilder m1_small32() {
return new EC2HardwareBuilder(InstanceType.M1_SMALL)
.ram(1740)
.processors(ImmutableList.of(new Processor(1.0, 1.0)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(150.0f,
"/dev/sda2", false, false))).is64Bit(false);
}
/** /**
* @see InstanceType#M1_SMALL * @see InstanceType#M1_SMALL
*/ */
@ -227,6 +215,19 @@ public class EC2HardwareBuilder extends HardwareBuilder {
"/dev/sda2", false, false))); "/dev/sda2", false, false)));
} }
/**
* @see InstanceType#M1_MEDIUM
*/
public static EC2HardwareBuilder m1_medium() {
return new EC2HardwareBuilder(InstanceType.M1_MEDIUM)
.ram(3750)
.processors(ImmutableList.of(new Processor(1.0, 2.0)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false)));
}
/** /**
* @see InstanceType#T1_MICRO * @see InstanceType#T1_MICRO
*/ */
@ -303,7 +304,7 @@ public class EC2HardwareBuilder extends HardwareBuilder {
.processors(ImmutableList.of(new Processor(2.0, 2.5))) .processors(ImmutableList.of(new Processor(2.0, 2.5)))
.volumes( .volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f, ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f,
"/dev/sda2", false, false))).is64Bit(false); "/dev/sda2", false, false)));
} }
/** /**

View File

@ -47,11 +47,22 @@ public class InstanceType {
* <li>1.7 GB memory</li> * <li>1.7 GB memory</li>
* <li>1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)</li> * <li>1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)</li>
* <li>160 GB instance storage (150 GB plus 10 GB root partition)</li> * <li>160 GB instance storage (150 GB plus 10 GB root partition)</li>
* <li>32-bit platform</li> * <li>32-bit or 64-bit platform</li>
* <li>I/O Performance: Moderate</li> * <li>I/O Performance: Moderate</li>
* </ul> * </ul>
*/ */
public static final String M1_SMALL = "m1.small"; public static final String M1_SMALL = "m1.small";
/**
* Medium Instance
* <ul>
* <li>3.75 GB memory</li>
* <li>2 EC2 Compute Unit (1 virtual core with 2 EC2 Compute Unit)</li>
* <li>410 GB instance storage</li>
* <li>32-bit or 64-bit platform</li>
* <li>I/O Performance: Moderate</li>
* </ul>
*/
public static final String M1_MEDIUM = "m1.medium";
/** /**
* Large Instance * Large Instance
* <ul> * <ul>

View File

@ -26,7 +26,7 @@ import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
@ -217,7 +217,7 @@ public class EC2TemplateBuilderTest {
.<Location> of(location)); .<Location> of(location));
Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large().build(), .<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large().build(),
m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(), m1_small().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
m2_4xlarge().build(), CC1_4XLARGE)); m2_4xlarge().build(), CC1_4XLARGE));
return new EC2TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider, return new EC2TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider,

View File

@ -18,7 +18,7 @@
*/ */
package org.jclouds.ec2.compute.functions; package org.jclouds.ec2.compute.functions;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -167,7 +167,7 @@ public class RunningInstanceToNodeMetadataTest {
@Test @Test
public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationFound() throws UnknownHostException { public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationFound() throws UnknownHostException {
RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small32().build()), ImmutableSet RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
.of(provider), EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap .of(provider), EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap
.<String, Credentials> of()); .<String, Credentials> of());
@ -181,7 +181,7 @@ public class RunningInstanceToNodeMetadataTest {
.privateAddresses(ImmutableSet.of("10.243.42.70")) .privateAddresses(ImmutableSet.of("10.243.42.70"))
.publicAddresses(ImmutableSet.of("174.129.81.68")) .publicAddresses(ImmutableSet.of("174.129.81.68"))
.imageId("us-east-1/ami-82e4b5c7") .imageId("us-east-1/ami-82e4b5c7")
.hardware(m1_small32().build()) .hardware(m1_small().build())
.operatingSystem( .operatingSystem(
new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual") new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual")
.description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()) .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build())
@ -203,7 +203,7 @@ public class RunningInstanceToNodeMetadataTest {
}; };
LoadingCache<RegionAndName, Image> instanceToImage = CacheBuilder.newBuilder().build(nullReturningFunction); LoadingCache<RegionAndName, Image> instanceToImage = CacheBuilder.newBuilder().build(nullReturningFunction);
RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small32().build()), ImmutableSet RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
.of(provider), ImmutableMap.<String, Credentials> of(), .of(provider), ImmutableMap.<String, Credentials> of(),
EC2ComputeServiceDependenciesModule.instanceToNodeState, instanceToImage); EC2ComputeServiceDependenciesModule.instanceToNodeState, instanceToImage);
@ -214,7 +214,7 @@ public class RunningInstanceToNodeMetadataTest {
new NodeMetadataBuilder().hostname("ip-10-243-42-70").state(NodeState.RUNNING) new NodeMetadataBuilder().hostname("ip-10-243-42-70").state(NodeState.RUNNING)
.privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68")) .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
.imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f") .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
.hardware(m1_small32().build()).location(provider).build()); .hardware(m1_small().build()).location(provider).build());
} }
@Test @Test

View File

@ -102,7 +102,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest {
// setup constants // setup constants
String region = Region.AP_SOUTHEAST_1; String region = Region.AP_SOUTHEAST_1;
String group = "group"; String group = "group";
Hardware size = EC2HardwareBuilder.m1_small32().build(); Hardware size = EC2HardwareBuilder.m1_small().build();
String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String systemGeneratedKeyPairName = "systemGeneratedKeyPair";
String generatedGroup = "group"; String generatedGroup = "group";
Set<String> generatedGroups = ImmutableSet.of(generatedGroup); Set<String> generatedGroups = ImmutableSet.of(generatedGroup);
@ -158,7 +158,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest {
// setup constants // setup constants
String region = Region.AP_SOUTHEAST_1; String region = Region.AP_SOUTHEAST_1;
String group = "group"; String group = "group";
Hardware size = EC2HardwareBuilder.m1_small32().build(); Hardware size = EC2HardwareBuilder.m1_small().build();
String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String systemGeneratedKeyPairName = "systemGeneratedKeyPair";
String generatedGroup = "group"; String generatedGroup = "group";
Set<String> generatedGroups = ImmutableSet.of(generatedGroup); Set<String> generatedGroups = ImmutableSet.of(generatedGroup);

View File

@ -24,7 +24,8 @@ import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc2_8xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc2_8xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cg1_4xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cg1_4xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_medium;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
@ -64,8 +65,8 @@ public class AWSEC2HardwareSupplier extends EC2HardwareSupplier {
sizes.add(cg1_4xlarge().supportsImageIds(ccAmis).build()); sizes.add(cg1_4xlarge().supportsImageIds(ccAmis).build());
sizes.add(cc2_8xlarge().supportsImageIds(ccAmis).build()); sizes.add(cc2_8xlarge().supportsImageIds(ccAmis).build());
sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large() sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large()
.build(), m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(), .build(), m1_small().build(), m1_medium().build(), m1_xlarge().build(), m2_xlarge().build(),
m2_4xlarge().build())); m2_2xlarge().build(), m2_4xlarge().build()));
return sizes.build(); return sizes.build();
} }
} }

View File

@ -92,9 +92,9 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
} }
@Test @Test
public void testTemplateBuilderM1SMALLWithNegativeLookaroundDoesntMatchTestImages() { public void testTemplateBuilderM1MEDIUMWithNegativeLookaroundDoesntMatchTestImages() {
Template template = context.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL) Template template = context.getComputeService().templateBuilder().hardwareId(InstanceType.M1_MEDIUM)
// need to select versions with double-digits so that lexicographic // need to select versions with double-digits so that lexicographic
// doesn't end up prefering 9.x vs 11.x // doesn't end up prefering 9.x vs 11.x
.osVersionMatches("1[012].[10][04]") .osVersionMatches("1[012].[10][04]")
@ -113,7 +113,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getLocation().getId(), "us-east-1");
assertEquals(getCores(template.getHardware()), 1.0d); assertEquals(getCores(template.getHardware()), 1.0d);
assertEquals(template.getHardware().getId(), InstanceType.M1_SMALL); assertEquals(template.getHardware().getId(), InstanceType.M1_MEDIUM);
assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual"); assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual");
} }
@ -184,7 +184,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
.imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build(); .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1"); assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
@ -258,9 +258,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getVersion(), "4.4.10");
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getLocation().getId(), "us-east-1");
assertEquals(getCores(template.getHardware()), 2.0d); assertEquals(getCores(template.getHardware()), 1.0d);
assertEquals(template.getHardware().getId(), "m1.large"); // because it assertEquals(template.getHardware().getId(), "m1.small");
// is 64bit
// ensure we cache the new image for next time // ensure we cache the new image for next time
assertEquals(context.getComputeService().listImages().size(), 1); assertEquals(context.getComputeService().listImages().size(), 1);
@ -294,9 +293,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getVersion(), "4.4.10");
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getLocation().getId(), "us-east-1");
assertEquals(getCores(template.getHardware()), 2.0d); assertEquals(getCores(template.getHardware()), 1.0d);
assertEquals(template.getHardware().getId(), "m1.large"); // because it assertEquals(template.getHardware().getId(), "m1.small");
// is 64bit
// ensure we cache the new image for next time // ensure we cache the new image for next time
assertEquals(context.getComputeService().listImages().size(), 1); assertEquals(context.getComputeService().listImages().size(), 1);
@ -337,9 +335,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(template.getImage().getVersion(), "2011.09.2"); assertEquals(template.getImage().getVersion(), "2011.09.2");
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "eu-west-1"); assertEquals(template.getLocation().getId(), "eu-west-1");
assertEquals(getCores(template.getHardware()), 2.0d); assertEquals(getCores(template.getHardware()), 1.0d);
assertEquals(template.getHardware().getId(), "m1.large"); // because it assertEquals(template.getHardware().getId(), "m1.small");
// is 64bit
} finally { } finally {
if (context != null) if (context != null)

View File

@ -80,7 +80,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT
// setup constants // setup constants
String region = Region.AP_SOUTHEAST_1; String region = Region.AP_SOUTHEAST_1;
String group = "group"; String group = "group";
Hardware size = EC2HardwareBuilder.m1_small32().build(); Hardware size = EC2HardwareBuilder.m1_small().build();
String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String systemGeneratedKeyPairName = "systemGeneratedKeyPair";
String generatedGroup = "group"; String generatedGroup = "group";
Set<String> generatedGroups = ImmutableSet.of(generatedGroup); Set<String> generatedGroups = ImmutableSet.of(generatedGroup);
@ -275,7 +275,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT
// setup constants // setup constants
String region = Region.AP_SOUTHEAST_1; String region = Region.AP_SOUTHEAST_1;
String group = "group"; String group = "group";
Hardware size = EC2HardwareBuilder.m1_small32().build(); Hardware size = EC2HardwareBuilder.m1_small().build();
String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String systemGeneratedKeyPairName = "systemGeneratedKeyPair";
// create mocks // create mocks
@ -335,7 +335,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT
// setup constants // setup constants
String region = Region.AP_SOUTHEAST_1; String region = Region.AP_SOUTHEAST_1;
String group = "group"; String group = "group";
Hardware size = EC2HardwareBuilder.m1_small32().build(); Hardware size = EC2HardwareBuilder.m1_small().build();
String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String systemGeneratedKeyPairName = "systemGeneratedKeyPair";
String generatedGroup = "group"; String generatedGroup = "group";
Set<String> generatedGroups = ImmutableSet.of(generatedGroup); Set<String> generatedGroups = ImmutableSet.of(generatedGroup);