Issue 755:support new cc2.8xlarge instance size

This commit is contained in:
Adrian Cole 2011-11-16 10:47:44 +02:00
parent fa4e7da19d
commit 85a0cdfa9c
6 changed files with 124 additions and 54 deletions

View File

@ -47,14 +47,14 @@ import com.google.common.collect.ImmutableList;
/**
*
* @author Adrian Cole
* @see <a
* href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html"
* @see <a href=
* "http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html"
* />
*/
public class EC2HardwareBuilder extends HardwareBuilder {
private Predicate<Image> rootDeviceType = any();
private Predicate<Image> virtualizationType = Predicates.or(new IsWindows(), new RequiresVirtualizationType(
VirtualizationType.PARAVIRTUAL));
VirtualizationType.PARAVIRTUAL));
private Predicate<Image> imageIds = any();
private Predicate<Image> is64Bit = any();
@ -79,7 +79,7 @@ public class EC2HardwareBuilder extends HardwareBuilder {
@Override
public boolean apply(Image image) {
return image.getUserMetadata().containsKey("rootDeviceType")
&& type == RootDeviceType.fromValue(image.getUserMetadata().get("rootDeviceType"));
&& type == RootDeviceType.fromValue(image.getUserMetadata().get("rootDeviceType"));
}
@Override
@ -120,7 +120,7 @@ public class EC2HardwareBuilder extends HardwareBuilder {
@Override
public boolean apply(Image image) {
return image.getOperatingSystem() != null && image.getOperatingSystem().getArch() != null
&& type == VirtualizationType.fromValue(image.getOperatingSystem().getArch());
&& type == VirtualizationType.fromValue(image.getOperatingSystem().getArch());
}
@Override
@ -207,9 +207,11 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @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,
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);
}
@ -217,9 +219,11 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#M1_SMALL
*/
public static EC2HardwareBuilder m1_small() {
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,
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)));
}
@ -227,17 +231,19 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#T1_MICRO
*/
public static EC2HardwareBuilder t1_micro() {
return new EC2HardwareBuilder(InstanceType.T1_MICRO).ram(630).processors(
ImmutableList.of(new Processor(1.0, 1.0))).rootDeviceType(RootDeviceType.EBS);
return new EC2HardwareBuilder(InstanceType.T1_MICRO).ram(630)
.processors(ImmutableList.of(new Processor(1.0, 1.0))).rootDeviceType(RootDeviceType.EBS);
}
/**
* @see InstanceType#M1_LARGE
*/
public static EC2HardwareBuilder m1_large() {
return new EC2HardwareBuilder(InstanceType.M1_LARGE).ram(7680).processors(
ImmutableList.of(new Processor(2.0, 2.0))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
return new EC2HardwareBuilder(InstanceType.M1_LARGE)
.ram(7680)
.processors(ImmutableList.of(new Processor(2.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))).is64Bit(true);
}
@ -245,30 +251,34 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#M1_XLARGE
*/
public static EC2HardwareBuilder m1_xlarge() {
return new EC2HardwareBuilder(InstanceType.M1_XLARGE).ram(15360).processors(
ImmutableList.of(new Processor(4.0, 2.0))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
return new EC2HardwareBuilder(InstanceType.M1_XLARGE)
.ram(15360)
.processors(ImmutableList.of(new Processor(4.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), new VolumeImpl(
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false))).is64Bit(
true);
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false)))
.is64Bit(true);
}
/**
* @see InstanceType#M2_XLARGE
*/
public static EC2HardwareBuilder m2_xlarge() {
return new EC2HardwareBuilder(InstanceType.M2_XLARGE).ram(17510).processors(
ImmutableList.of(new Processor(2.0, 3.25))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(420.0f, "/dev/sda1", true, false))).is64Bit(true);
return new EC2HardwareBuilder(InstanceType.M2_XLARGE).ram(17510)
.processors(ImmutableList.of(new Processor(2.0, 3.25)))
.volumes(ImmutableList.<Volume> of(new VolumeImpl(420.0f, "/dev/sda1", true, false))).is64Bit(true);
}
/**
* @see InstanceType#M2_2XLARGE
*/
public static EC2HardwareBuilder m2_2xlarge() {
return new EC2HardwareBuilder(InstanceType.M2_2XLARGE).ram(35020).processors(
ImmutableList.of(new Processor(4.0, 3.25))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
return new EC2HardwareBuilder(InstanceType.M2_2XLARGE)
.ram(35020)
.processors(ImmutableList.of(new Processor(4.0, 3.25)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
"/dev/sdb", false, false))).is64Bit(true);
}
@ -276,9 +286,11 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#M2_4XLARGE
*/
public static EC2HardwareBuilder m2_4xlarge() {
return new EC2HardwareBuilder(InstanceType.M2_4XLARGE).ram(70041).processors(
ImmutableList.of(new Processor(8.0, 3.25))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
return new EC2HardwareBuilder(InstanceType.M2_4XLARGE)
.ram(70041)
.processors(ImmutableList.of(new Processor(8.0, 3.25)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false))).is64Bit(true);
}
@ -286,9 +298,11 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#C1_MEDIUM
*/
public static EC2HardwareBuilder c1_medium() {
return new EC2HardwareBuilder(InstanceType.C1_MEDIUM).ram(1740).processors(
ImmutableList.of(new Processor(2.0, 2.5))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f,
return new EC2HardwareBuilder(InstanceType.C1_MEDIUM)
.ram(1740)
.processors(ImmutableList.of(new Processor(2.0, 2.5)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f,
"/dev/sda2", false, false))).is64Bit(false);
}
@ -296,20 +310,45 @@ public class EC2HardwareBuilder extends HardwareBuilder {
* @see InstanceType#C1_XLARGE
*/
public static EC2HardwareBuilder c1_xlarge() {
return new EC2HardwareBuilder(InstanceType.C1_XLARGE).ram(7168).processors(
ImmutableList.of(new Processor(8.0, 2.5))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
return new EC2HardwareBuilder(InstanceType.C1_XLARGE)
.ram(7168)
.processors(ImmutableList.of(new Processor(8.0, 2.5)))
.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), new VolumeImpl(
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false))).is64Bit(
true);
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false)))
.is64Bit(true);
}
public static EC2HardwareBuilder cg1_4xlarge() {
return new EC2HardwareBuilder(InstanceType.CG1_4XLARGE)
.ram(22 * 1024)
.processors(ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false)))
.virtualizationType(VirtualizationType.HVM);
}
public static EC2HardwareBuilder cc1_4xlarge() {
return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE).ram(23 * 1024).processors(
ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0))).volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE)
.ram(23 * 1024)
.processors(ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false)))
.virtualizationType(VirtualizationType.HVM);
.virtualizationType(VirtualizationType.HVM);
}
public static EC2HardwareBuilder cc2_8xlarge() {
return new EC2HardwareBuilder(InstanceType.CC2_8XLARGE)
.ram(60 * 1024 + 512)
.processors(ImmutableList.of(new Processor(8.0, 5.5), new Processor(8.0, 5.5)))
.volumes(
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false), new VolumeImpl(
840.0f, "/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false)))
.virtualizationType(VirtualizationType.HVM);
}
@SuppressWarnings("unchecked")

View File

@ -134,6 +134,20 @@ public class InstanceType {
*/
public static final String C1_XLARGE = "c1.xlarge";
/**
* Cluster Compute Instance
* <ul>
* <li>22 GB of memory</li>
* <li>33.5 EC2 Compute Units (2 x Intel Xeon X5570, quad-core "Nehalem"
* architecture)</li>
* <li>1690 GB of 64-bit storage (2 x 840 GB, plus 10 GB root partition)</li>
* <li>10 Gbps Ethernet</li>
* <li>64-bit platform</li>
* <li>I/O Performance: High</li>
* </ul>
*/
public static final String CG1_4XLARGE = "cg1.4xlarge";
/**
* Cluster Compute Instance
* <ul>
@ -148,4 +162,17 @@ public class InstanceType {
*/
public static final String CC1_4XLARGE = "cc1.4xlarge";
/**
* Cluster Compute Eight Extra Large specifications
* <ul>
* <li>60.5 GB of memory</li>
* <li>88 EC2 Compute Units (Eight-core 2 x Intel Xeon)</li>
* <li>3370 GB of 64-bit storage (4 x 840 GB, plus 10 GB root partition)</li>
* <li>10 Gbps Ethernet</li>
* <li>64-bit platform</li>
* <li>I/O Performance: High</li>
* </ul>
*/
public static final String CC2_8XLARGE = "cc2.8xlarge";
}

View File

@ -21,6 +21,8 @@ package org.jclouds.aws.ec2.compute.suppliers;
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.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_xlarge;
@ -59,6 +61,8 @@ public class AWSEC2HardwareSupplier extends EC2HardwareSupplier {
public Set<? extends Hardware> get() {
Builder<Hardware> sizes = ImmutableSet.builder();
sizes.add(cc1_4xlarge().supportsImageIds(ccAmis).build());
sizes.add(cg1_4xlarge().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()
.build(), m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
m2_4xlarge().build()));

View File

@ -188,25 +188,25 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
Template fastestTemplate = context.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX)
.build();
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2");
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
assertEquals(getCores(fastestTemplate.getHardware()), 8.0d);
assertEquals(getCores(fastestTemplate.getHardware()), 16.0d);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
fastestTemplate = context.getComputeService().templateBuilder().fastest().build();
System.out.println(fastestTemplate.getImage());
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "12.04");
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
assertEquals(getCores(fastestTemplate.getHardware()), 8.0d);
assertEquals(getCores(fastestTemplate.getHardware()), 16.0d);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
}

View File

@ -67,7 +67,7 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true)
@Test(groups = "live", singleThreaded = true, testName = "PlacementGroupClientLiveTest")
public class PlacementGroupClientLiveTest {
private AWSEC2Client client;
@ -169,7 +169,7 @@ public class PlacementGroupClientLiveTest {
Template template = context.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX).build();
assert template != null : "The returned template was null, but it should have a value.";
assertEquals(template.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
assertEquals(template.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");

View File

@ -143,8 +143,8 @@ public class SpotInstanceClientLiveTest {
ImmutableSet.of("Linux/UNIX", "Linux/UNIX (Amazon VPC)", "SUSE Linux", "SUSE Linux (Amazon VPC)",
"Windows", "Windows (Amazon VPC)")).apply(spot.getProductDescription()) : spot;
assert in(
ImmutableSet.of("c1.medium", "c1.xlarge", "cc1.4xlarge", "cg1.4xlarge", "m1.large", "m1.small",
"m1.xlarge", "m2.2xlarge", "m2.4xlarge", "m2.xlarge", "t1.micro")).apply(
ImmutableSet.of("c1.medium", "c1.xlarge", "cc1.4xlarge", "cg1.4xlarge", "cc2.8xlarge", "m1.large",
"m1.small", "m1.xlarge", "m2.2xlarge", "m2.4xlarge", "m2.xlarge", "t1.micro")).apply(
spot.getInstanceType()) : spot;
}
@ -167,7 +167,7 @@ public class SpotInstanceClientLiveTest {
"us-west-2",
0.09f,
1,
LaunchSpecification.builder().imageId("ami-951945d0").instanceType(InstanceType.M1_SMALL).build(),
LaunchSpecification.builder().imageId("ami-38fe7308").instanceType(InstanceType.M1_SMALL).build(),
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(
new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(2))).validUntil(
new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));