From 4d5b3b3d750e810de782968e6e9232666eb63253 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 8 Mar 2012 10:52:56 -0800 Subject: [PATCH] Issue 859:AWS EC2 Updates: New Medium Instance, 64-bit Ubiquity --- .../compute/domain/EC2HardwareBuilder.java | 27 ++++++++++--------- .../org/jclouds/ec2/domain/InstanceType.java | 13 ++++++++- .../ec2/compute/EC2TemplateBuilderTest.java | 4 +-- .../RunningInstanceToNodeMetadataTest.java | 10 +++---- ...GroupsAsNeededAndReturnRunOptionsTest.java | 4 +-- .../suppliers/AWSEC2HardwareSupplier.java | 7 ++--- .../AWSEC2TemplateBuilderLiveTest.java | 23 +++++++--------- ...GroupsAsNeededAndReturnRunOptionsTest.java | 6 ++--- 8 files changed, 52 insertions(+), 42 deletions(-) diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java index 79d5c1556d..7a7a3587c5 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java @@ -203,18 +203,6 @@ public class EC2HardwareBuilder extends HardwareBuilder { 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. of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(150.0f, - "/dev/sda2", false, false))).is64Bit(false); - } - /** * @see InstanceType#M1_SMALL */ @@ -227,6 +215,19 @@ public class EC2HardwareBuilder extends HardwareBuilder { "/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. 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 */ @@ -303,7 +304,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { .processors(ImmutableList.of(new Processor(2.0, 2.5))) .volumes( ImmutableList. of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f, - "/dev/sda2", false, false))).is64Bit(false); + "/dev/sda2", false, false))); } /** diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/domain/InstanceType.java b/apis/ec2/src/main/java/org/jclouds/ec2/domain/InstanceType.java index 80d13b703d..4d56268ed1 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/domain/InstanceType.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/domain/InstanceType.java @@ -47,11 +47,22 @@ public class InstanceType { *
  • 1.7 GB memory
  • *
  • 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)
  • *
  • 160 GB instance storage (150 GB plus 10 GB root partition)
  • - *
  • 32-bit platform
  • + *
  • 32-bit or 64-bit platform
  • *
  • I/O Performance: Moderate
  • * */ public static final String M1_SMALL = "m1.small"; + /** + * Medium Instance + *
      + *
    • 3.75 GB memory
    • + *
    • 2 EC2 Compute Unit (1 virtual core with 2 EC2 Compute Unit)
    • + *
    • 410 GB instance storage
    • + *
    • 32-bit or 64-bit platform
    • + *
    • I/O Performance: Moderate
    • + *
    + */ + public static final String M1_MEDIUM = "m1.medium"; /** * Large Instance *
      diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java index eb865ac83b..bdaae8f725 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java @@ -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.cc1_4xlarge; 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.m2_2xlarge; import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge; @@ -217,7 +217,7 @@ public class EC2TemplateBuilderTest { . of(location)); Supplier> sizes = Suppliers.> ofInstance(ImmutableSet . 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)); return new EC2TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider, diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java index 03987761c4..c2a2ee66c4 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java @@ -18,7 +18,7 @@ */ 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 java.net.UnknownHostException; @@ -167,7 +167,7 @@ public class RunningInstanceToNodeMetadataTest { @Test 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()); @@ -181,7 +181,7 @@ public class RunningInstanceToNodeMetadataTest { .privateAddresses(ImmutableSet.of("10.243.42.70")) .publicAddresses(ImmutableSet.of("174.129.81.68")) .imageId("us-east-1/ami-82e4b5c7") - .hardware(m1_small32().build()) + .hardware(m1_small().build()) .operatingSystem( new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual") .description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()) @@ -203,7 +203,7 @@ public class RunningInstanceToNodeMetadataTest { }; LoadingCache 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. of(), EC2ComputeServiceDependenciesModule.instanceToNodeState, instanceToImage); @@ -214,7 +214,7 @@ public class RunningInstanceToNodeMetadataTest { 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")) .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()); } protected RunningInstance firstInstanceFromResource(String resource) { diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java index 2d7b3b5440..bcc1b5b906 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java @@ -102,7 +102,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest { // setup constants String region = Region.AP_SOUTHEAST_1; String group = "group"; - Hardware size = EC2HardwareBuilder.m1_small32().build(); + Hardware size = EC2HardwareBuilder.m1_small().build(); String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String generatedGroup = "group"; Set generatedGroups = ImmutableSet.of(generatedGroup); @@ -158,7 +158,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest { // setup constants String region = Region.AP_SOUTHEAST_1; String group = "group"; - Hardware size = EC2HardwareBuilder.m1_small32().build(); + Hardware size = EC2HardwareBuilder.m1_small().build(); String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String generatedGroup = "group"; Set generatedGroups = ImmutableSet.of(generatedGroup); diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2HardwareSupplier.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2HardwareSupplier.java index fff76ed9c1..2428a3955a 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2HardwareSupplier.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2HardwareSupplier.java @@ -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.cg1_4xlarge; 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.m2_2xlarge; 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(cc2_8xlarge().supportsImageIds(ccAmis).build()); sizes.addAll(ImmutableSet. 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(), - m2_4xlarge().build())); + .build(), m1_small().build(), m1_medium().build(), m1_xlarge().build(), m2_xlarge().build(), + m2_2xlarge().build(), m2_4xlarge().build())); return sizes.build(); } } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java index b5f3fbf883..bdd47c992f 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java @@ -93,9 +93,9 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { } @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 // doesn't end up prefering 9.x vs 11.x .osVersionMatches("1[012].[10][04]") @@ -114,7 +114,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); 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"); } @@ -185,7 +185,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build(); assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; 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().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(defaultTemplate.getLocation().getId(), "us-east-1"); @@ -259,9 +259,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); - assertEquals(getCores(template.getHardware()), 2.0d); - assertEquals(template.getHardware().getId(), "m1.large"); // because it - // is 64bit + assertEquals(getCores(template.getHardware()), 1.0d); + assertEquals(template.getHardware().getId(), "m1.small"); // ensure we cache the new image for next time assertEquals(context.getComputeService().listImages().size(), 1); @@ -295,9 +294,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); - assertEquals(getCores(template.getHardware()), 2.0d); - assertEquals(template.getHardware().getId(), "m1.large"); // because it - // is 64bit + assertEquals(getCores(template.getHardware()), 1.0d); + assertEquals(template.getHardware().getId(), "m1.small"); // ensure we cache the new image for next time assertEquals(context.getComputeService().listImages().size(), 1); @@ -333,9 +331,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); - assertEquals(getCores(template.getHardware()), 2.0d); - assertEquals(template.getHardware().getId(), "m1.large"); // because it - // is 64bit + assertEquals(getCores(template.getHardware()), 1.0d); + assertEquals(template.getHardware().getId(), "m1.small"); } finally { if (context != null) diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java index 2be19c7070..1f7bb9fdb7 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/strategy/CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsTest.java @@ -80,7 +80,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT // setup constants String region = Region.AP_SOUTHEAST_1; String group = "group"; - Hardware size = EC2HardwareBuilder.m1_small32().build(); + Hardware size = EC2HardwareBuilder.m1_small().build(); String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String generatedGroup = "group"; Set generatedGroups = ImmutableSet.of(generatedGroup); @@ -275,7 +275,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT // setup constants String region = Region.AP_SOUTHEAST_1; String group = "group"; - Hardware size = EC2HardwareBuilder.m1_small32().build(); + Hardware size = EC2HardwareBuilder.m1_small().build(); String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; // create mocks @@ -335,7 +335,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptionsT // setup constants String region = Region.AP_SOUTHEAST_1; String group = "group"; - Hardware size = EC2HardwareBuilder.m1_small32().build(); + Hardware size = EC2HardwareBuilder.m1_small().build(); String systemGeneratedKeyPairName = "systemGeneratedKeyPair"; String generatedGroup = "group"; Set generatedGroups = ImmutableSet.of(generatedGroup);