From 04a4095ca691e01a3794477d66aad679e9647196 Mon Sep 17 00:00:00 2001 From: Alex Heneveld Date: Wed, 22 Apr 2015 10:25:03 +0100 Subject: [PATCH] indicate virtualization type for all ec2 instance types --- .../compute/domain/EC2HardwareBuilder.java | 238 +++++++++++++----- 1 file changed, 173 insertions(+), 65 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 716dd8bfd0..c9256be5f3 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 @@ -29,7 +29,6 @@ import java.util.Map; import org.jclouds.compute.domain.Hardware; import org.jclouds.compute.domain.HardwareBuilder; import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Processor; import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.VolumeBuilder; @@ -39,22 +38,33 @@ import org.jclouds.ec2.domain.InstanceType; import org.jclouds.ec2.domain.RootDeviceType; import org.jclouds.ec2.domain.VirtualizationType; +import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; /** * * @see + * + * and . + * + * Also note Windows only supports HVM, as per + * . + * On Windows you may have to constrain hardware appropriately. */ public class EC2HardwareBuilder extends HardwareBuilder { private Predicate rootDeviceType = any(); - private Predicate virtualizationType = Predicates.or(new IsWindows(), new RequiresVirtualizationType( - VirtualizationType.PARAVIRTUAL)); + private Predicate virtualizationType = null; private Predicate imageIds = any(); private Predicate is64Bit = any(); @@ -89,20 +99,6 @@ public class EC2HardwareBuilder extends HardwareBuilder { } - public static class IsWindows implements Predicate { - - @Override - public boolean apply(Image image) { - return image.getOperatingSystem() != null && OsFamily.WINDOWS == image.getOperatingSystem().getFamily(); - } - - @Override - public String toString() { - return "isWindows()"; - } - - } - /** * evaluates true if the Image requires the following virtualizationType * @@ -139,6 +135,20 @@ public class EC2HardwareBuilder extends HardwareBuilder { return this; } + public EC2HardwareBuilder virtualizationTypes(VirtualizationType ...virtualizationTypes) { + Preconditions.checkArgument(virtualizationTypes.length > 0, "At least one virtualization type is required."); + if (virtualizationTypes.length == 1) { + this.virtualizationType = new RequiresVirtualizationType(virtualizationTypes[0]); + } else { + List supportedVirtualizationTypes = Lists.newArrayList(); + for (VirtualizationType virtualizationType : virtualizationTypes) { + supportedVirtualizationTypes.add(new RequiresVirtualizationType(virtualizationType)); + } + this.virtualizationType = Predicates.or(supportedVirtualizationTypes); + } + return this; + } + public EC2HardwareBuilder rootDeviceType(RootDeviceType rootDeviceType) { this.rootDeviceType = new RequiresRootDeviceType(rootDeviceType); return this; @@ -203,11 +213,104 @@ public class EC2HardwareBuilder extends HardwareBuilder { return EC2HardwareBuilder.class.cast(super.userMetadata(userMetadata)); } + private EC2HardwareBuilder t2() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder m3() { + virtualizationTypes(VirtualizationType.HVM, VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder c3() { + virtualizationTypes(VirtualizationType.HVM, VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder c4() { + virtualizationTypes(VirtualizationType.HVM, VirtualizationType.PARAVIRTUAL); + return this; + } + + // TODO include D2 (dense) types? + @SuppressWarnings("unused") + private EC2HardwareBuilder d2() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder r3() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder g2() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder i2() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder hs1() { + virtualizationTypes(VirtualizationType.HVM, VirtualizationType.PARAVIRTUAL); + return this; + } + + // TODO below this line are previous generation, discouraged + // http://aws.amazon.com/ec2/previous-generation/ + private EC2HardwareBuilder m1() { + virtualizationTypes(VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder c1() { + virtualizationTypes(VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder cc2() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder m2() { + virtualizationTypes(VirtualizationType.PARAVIRTUAL); + return this; + } + + // cr1 never included in jclouds, so skipped here + + private EC2HardwareBuilder hi1() { + virtualizationTypes(VirtualizationType.HVM, VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder t1() { + virtualizationTypes(VirtualizationType.PARAVIRTUAL); + return this; + } + + private EC2HardwareBuilder cg1() { + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + private EC2HardwareBuilder cc1() { + // often no longer available - not adding capacity (use cc2) + virtualizationTypes(VirtualizationType.HVM); + return this; + } + + /** * @see InstanceType#M1_SMALL */ public static EC2HardwareBuilder m1_small() { - return new EC2HardwareBuilder(InstanceType.M1_SMALL) + return new EC2HardwareBuilder(InstanceType.M1_SMALL).m1() .ram(1740) .processors(ImmutableList.of(new Processor(1.0, 1.0))) .volumes(ImmutableList. of( @@ -219,7 +322,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M1_MEDIUM */ public static EC2HardwareBuilder m1_medium() { - return new EC2HardwareBuilder(InstanceType.M1_MEDIUM) + return new EC2HardwareBuilder(InstanceType.M1_MEDIUM).m1() .ram(3750) .processors(ImmutableList.of(new Processor(1.0, 2.0))) .volumes(ImmutableList. of( @@ -233,7 +336,8 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#T1_MICRO */ public static EC2HardwareBuilder t1_micro() { - return new EC2HardwareBuilder(InstanceType.T1_MICRO).ram(630) + return new EC2HardwareBuilder(InstanceType.T1_MICRO).t1() + .ram(630) .processors(ImmutableList.of(new Processor(1.0, 1.0))).rootDeviceType(RootDeviceType.EBS); } @@ -241,7 +345,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#T2_MICRO */ public static EC2HardwareBuilder t2_micro() { - return new EC2HardwareBuilder(InstanceType.T2_MICRO) + return new EC2HardwareBuilder(InstanceType.T2_MICRO).t2() .ram(1024) .processors(ImmutableList.of(new Processor(1.0, 0.1))).rootDeviceType(RootDeviceType.EBS); } @@ -250,7 +354,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#T2_SMALL */ public static EC2HardwareBuilder t2_small() { - return new EC2HardwareBuilder(InstanceType.T2_SMALL) + return new EC2HardwareBuilder(InstanceType.T2_SMALL).t2() .ram(2048) .processors(ImmutableList.of(new Processor(1.0, 0.2))).rootDeviceType(RootDeviceType.EBS); } @@ -259,7 +363,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#T2_MEDIUM */ public static EC2HardwareBuilder t2_medium() { - return new EC2HardwareBuilder(InstanceType.T2_MEDIUM) + return new EC2HardwareBuilder(InstanceType.T2_MEDIUM).t2() .ram(4096) .processors(ImmutableList.of(new Processor(1.0, 0.4))).rootDeviceType(RootDeviceType.EBS); } @@ -277,7 +381,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M1_LARGE */ public static EC2HardwareBuilder m1_large() { - return new EC2HardwareBuilder(InstanceType.M1_LARGE) + return new EC2HardwareBuilder(InstanceType.M1_LARGE).m1() .ram(7680) .processors(ImmutableList.of(new Processor(2.0, 2.0))) .volumes(ImmutableList. of( @@ -291,7 +395,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M1_XLARGE */ public static EC2HardwareBuilder m1_xlarge() { - return new EC2HardwareBuilder(InstanceType.M1_XLARGE) + return new EC2HardwareBuilder(InstanceType.M1_XLARGE).m1() .ram(15360) .processors(ImmutableList.of(new Processor(4.0, 2.0))) .volumes(ImmutableList. of( @@ -307,7 +411,8 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M2_XLARGE */ public static EC2HardwareBuilder m2_xlarge() { - return new EC2HardwareBuilder(InstanceType.M2_XLARGE).ram(17510) + return new EC2HardwareBuilder(InstanceType.M2_XLARGE).m2() + .ram(17510) .processors(ImmutableList.of(new Processor(2.0, 3.25))) .volumes(ImmutableList. of( new VolumeBuilder().type(LOCAL).size(420.0f).device("/dev/sda1").bootDevice(true).durable(false).build())) @@ -318,7 +423,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M2_2XLARGE */ public static EC2HardwareBuilder m2_2xlarge() { - return new EC2HardwareBuilder(InstanceType.M2_2XLARGE) + return new EC2HardwareBuilder(InstanceType.M2_2XLARGE).m2() .ram(35020) .processors(ImmutableList.of(new Processor(4.0, 3.25))) .volumes(ImmutableList. of( @@ -331,7 +436,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M2_4XLARGE */ public static EC2HardwareBuilder m2_4xlarge() { - return new EC2HardwareBuilder(InstanceType.M2_4XLARGE) + return new EC2HardwareBuilder(InstanceType.M2_4XLARGE).m2() .ram(70041) .processors(ImmutableList.of(new Processor(8.0, 3.25))) .volumes(ImmutableList. of( @@ -345,7 +450,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M3_MEDIUM */ public static EC2HardwareBuilder m3_medium() { - return new EC2HardwareBuilder(InstanceType.M3_MEDIUM) + return new EC2HardwareBuilder(InstanceType.M3_MEDIUM).m3() .ram(3840) .processors(ImmutableList.of(new Processor(1.0, 3.0))) .volumes(ImmutableList. of( @@ -357,7 +462,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M3_LARGE */ public static EC2HardwareBuilder m3_large() { - return new EC2HardwareBuilder(InstanceType.M3_LARGE) + return new EC2HardwareBuilder(InstanceType.M3_LARGE).m3() .ram(7680) .processors(ImmutableList.of(new Processor(2.0, 3.25))) .volumes(ImmutableList. of( @@ -369,7 +474,8 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M3_XLARGE */ public static EC2HardwareBuilder m3_xlarge() { - return new EC2HardwareBuilder(InstanceType.M3_XLARGE).ram(15360) + return new EC2HardwareBuilder(InstanceType.M3_XLARGE).m3() + .ram(15360) .processors(ImmutableList.of(new Processor(4.0, 3.25))) .is64Bit(true) .volumes(ImmutableList.of( @@ -382,13 +488,14 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#M3_2XLARGE */ public static EC2HardwareBuilder m3_2xlarge() { - return new EC2HardwareBuilder(InstanceType.M3_2XLARGE).ram(30720) - .processors(ImmutableList.of(new Processor(8.0, 3.25))) - .is64Bit(true) - .volumes(ImmutableList.of( - new VolumeBuilder().type(LOCAL).size(10.0f).device("/dev/sda1").bootDevice(true).durable(false).build(), - new VolumeBuilder().type(LOCAL).size(80.0f).device("/dev/sdb").bootDevice(false).durable(false).build(), - new VolumeBuilder().type(LOCAL).size(80.0f).device("/dev/sdc").bootDevice(false).durable(false).build())); + return new EC2HardwareBuilder(InstanceType.M3_2XLARGE).m3() + .ram(30720) + .processors(ImmutableList.of(new Processor(8.0, 3.25))) + .is64Bit(true) + .volumes(ImmutableList. of( + new VolumeBuilder().type(LOCAL).size(10.0f).device("/dev/sda1").bootDevice(true).durable(false).build(), + new VolumeBuilder().type(LOCAL).size(80.0f).device("/dev/sdb").bootDevice(false).durable(false).build(), + new VolumeBuilder().type(LOCAL).size(80.0f).device("/dev/sdc").bootDevice(false).durable(false).build())); } /** @@ -445,7 +552,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C1_MEDIUM */ public static EC2HardwareBuilder c1_medium() { - return new EC2HardwareBuilder(InstanceType.C1_MEDIUM) + return new EC2HardwareBuilder(InstanceType.C1_MEDIUM).c1() .ram(1740) .processors(ImmutableList.of(new Processor(2.0, 2.5))) .volumes(ImmutableList.of( @@ -457,7 +564,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C1_XLARGE */ public static EC2HardwareBuilder c1_xlarge() { - return new EC2HardwareBuilder(InstanceType.C1_XLARGE) + return new EC2HardwareBuilder(InstanceType.C1_XLARGE).c1() .ram(7168) .processors(ImmutableList.of(new Processor(8.0, 2.5))) .volumes(ImmutableList.of( @@ -473,7 +580,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C3_LARGE */ public static EC2HardwareBuilder c3_large() { - return new EC2HardwareBuilder(InstanceType.C3_LARGE) + return new EC2HardwareBuilder(InstanceType.C3_LARGE).c3() .ram(3750) .processors(ImmutableList.of(new Processor(2.0, 3.5))) .volumes(ImmutableList.of( @@ -487,7 +594,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C3_XLARGE */ public static EC2HardwareBuilder c3_xlarge() { - return new EC2HardwareBuilder(InstanceType.C3_XLARGE) + return new EC2HardwareBuilder(InstanceType.C3_XLARGE).c3() .ram(7168) .processors(ImmutableList.of(new Processor(4.0, 3.5))) .volumes(ImmutableList. of( @@ -501,7 +608,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C3_2XLARGE */ public static EC2HardwareBuilder c3_2xlarge() { - return new EC2HardwareBuilder(InstanceType.C3_2XLARGE) + return new EC2HardwareBuilder(InstanceType.C3_2XLARGE).c3() .ram(15360) .processors(ImmutableList.of(new Processor(8.0, 3.5))) .volumes(ImmutableList. of( @@ -515,7 +622,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C3_4XLARGE */ public static EC2HardwareBuilder c3_4xlarge() { - return new EC2HardwareBuilder(InstanceType.C3_4XLARGE) + return new EC2HardwareBuilder(InstanceType.C3_4XLARGE).c3() .ram(30720) .processors(ImmutableList.of(new Processor(16.0, 3.4375))) .volumes(ImmutableList. of( @@ -529,7 +636,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C3_8XLARGE */ public static EC2HardwareBuilder c3_8xlarge() { - return new EC2HardwareBuilder(InstanceType.C3_8XLARGE) + return new EC2HardwareBuilder(InstanceType.C3_8XLARGE).c3() .ram(61440) .processors(ImmutableList.of(new Processor(32.0, 3.375))) .volumes(ImmutableList. of( @@ -543,7 +650,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C4_LARGE */ public static EC2HardwareBuilder c4_large() { - return new EC2HardwareBuilder(InstanceType.C4_LARGE) + return new EC2HardwareBuilder(InstanceType.C4_LARGE).c4() .ram(3840) .processors(ImmutableList.of(new Processor(2.0, 3.5))) .rootDeviceType(RootDeviceType.EBS); @@ -553,7 +660,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C4_XLARGE */ public static EC2HardwareBuilder c4_xlarge() { - return new EC2HardwareBuilder(InstanceType.C4_XLARGE) + return new EC2HardwareBuilder(InstanceType.C4_XLARGE).c4() .ram(7680) .processors(ImmutableList.of(new Processor(4.0, 3.5))) .rootDeviceType(RootDeviceType.EBS); @@ -563,7 +670,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C4_2XLARGE */ public static EC2HardwareBuilder c4_2xlarge() { - return new EC2HardwareBuilder(InstanceType.C4_2XLARGE) + return new EC2HardwareBuilder(InstanceType.C4_2XLARGE).c4() .ram(15360) .processors(ImmutableList.of(new Processor(8.0, 3.5))) .rootDeviceType(RootDeviceType.EBS); @@ -573,7 +680,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C4_4XLARGE */ public static EC2HardwareBuilder c4_4xlarge() { - return new EC2HardwareBuilder(InstanceType.C4_4XLARGE) + return new EC2HardwareBuilder(InstanceType.C4_4XLARGE).c4() .ram(30720) .processors(ImmutableList.of(new Processor(16.0, 3.5))) .rootDeviceType(RootDeviceType.EBS); @@ -583,7 +690,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#C4_8XLARGE */ public static EC2HardwareBuilder c4_8xlarge() { - return new EC2HardwareBuilder(InstanceType.C4_8XLARGE) + return new EC2HardwareBuilder(InstanceType.C4_8XLARGE).c4() .ram(61440) .processors(ImmutableList.of(new Processor(36.0, 3.5))) .rootDeviceType(RootDeviceType.EBS); @@ -683,7 +790,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { } public static EC2HardwareBuilder cg1_4xlarge() { - return new EC2HardwareBuilder(InstanceType.CG1_4XLARGE) + return new EC2HardwareBuilder(InstanceType.CG1_4XLARGE).cg1() .ram(22 * 1024) .processors(ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0))) .volumes(ImmutableList. of( @@ -694,7 +801,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { } public static EC2HardwareBuilder cc1_4xlarge() { - return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE) + return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE).cc1() .ram(23 * 1024) .processors(ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0))) .volumes(ImmutableList. of( @@ -705,7 +812,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { } public static EC2HardwareBuilder cc2_8xlarge() { - return new EC2HardwareBuilder(InstanceType.CC2_8XLARGE) + return new EC2HardwareBuilder(InstanceType.CC2_8XLARGE).cc2() .ram(60 * 1024 + 512) .processors(ImmutableList.of(new Processor(8.0, 5.5), new Processor(8.0, 5.5))) .volumes(ImmutableList. of( @@ -721,7 +828,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#G2_2XLARGE */ public static EC2HardwareBuilder g2_2xlarge() { - return new EC2HardwareBuilder(InstanceType.G2_2XLARGE) + return new EC2HardwareBuilder(InstanceType.G2_2XLARGE).g2() .ram(15 * 1024) .processors(ImmutableList.of(new Processor(8.0, 3.25))) .volumes(ImmutableList. of( @@ -734,7 +841,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#I2_XLARGE */ public static EC2HardwareBuilder i2_xlarge() { - return new EC2HardwareBuilder(InstanceType.I2_XLARGE) + return new EC2HardwareBuilder(InstanceType.I2_XLARGE).i2() .ram(30 * 1024 + 512) .processors(ImmutableList.of(new Processor(4.0, 3.5))) .volumes(ImmutableList. of( @@ -747,7 +854,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#I2_2XLARGE */ public static EC2HardwareBuilder i2_2xlarge() { - return new EC2HardwareBuilder(InstanceType.I2_2XLARGE) + return new EC2HardwareBuilder(InstanceType.I2_2XLARGE).i2() .ram(61 * 1024) .processors(ImmutableList.of(new Processor(8.0, 3.375))) .volumes(ImmutableList. of( @@ -761,7 +868,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#I2_4XLARGE */ public static EC2HardwareBuilder i2_4xlarge() { - return new EC2HardwareBuilder(InstanceType.I2_4XLARGE) + return new EC2HardwareBuilder(InstanceType.I2_4XLARGE).i2() .ram(122 * 1024) .processors(ImmutableList.of(new Processor(16.0, 3.3125))) .volumes(ImmutableList. of( @@ -777,7 +884,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#I2_8XLARGE */ public static EC2HardwareBuilder i2_8xlarge() { - return new EC2HardwareBuilder(InstanceType.I2_8XLARGE) + return new EC2HardwareBuilder(InstanceType.I2_8XLARGE).i2() .ram(244 * 1024) .processors(ImmutableList.of(new Processor(32.0, 3.25))) .volumes(ImmutableList. of( @@ -794,7 +901,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { } public static EC2HardwareBuilder hi1_4xlarge() { - return new EC2HardwareBuilder(InstanceType.HI1_4XLARGE) + return new EC2HardwareBuilder(InstanceType.HI1_4XLARGE).hi1() .ram(60 * 1024 + 512) .processors(ImmutableList.of(new Processor(16.0, 2.1875))) .volumes(ImmutableList. of( @@ -811,7 +918,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { 'q', 'r', 's', 't', 'u', 'v', 'w', 'x')) { all24Volumes.add(new VolumeBuilder().type(LOCAL).size(twoTB).device("/dev/sd" + letter).bootDevice(false).durable(false).build()); } - return new EC2HardwareBuilder(InstanceType.HS1_8XLARGE) + return new EC2HardwareBuilder(InstanceType.HS1_8XLARGE).hs1() .ram(117 * 1024) .processors(ImmutableList.of(new Processor(16.0, 2.1875))) .volumes(all24Volumes.build()) @@ -822,7 +929,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#R3_LARGE */ public static EC2HardwareBuilder r3_large() { - return new EC2HardwareBuilder(InstanceType.R3_LARGE) + return new EC2HardwareBuilder(InstanceType.R3_LARGE).r3() .ram(15616) .processors(ImmutableList.of(new Processor(2.0, 2.5))) .volumes(ImmutableList. of( @@ -834,7 +941,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#R3_XLARGE */ public static EC2HardwareBuilder r3_xlarge() { - return new EC2HardwareBuilder(InstanceType.R3_XLARGE) + return new EC2HardwareBuilder(InstanceType.R3_XLARGE).r3() .ram(31232) .processors(ImmutableList.of(new Processor(4.0, 2.5))) .volumes(ImmutableList. of( @@ -846,7 +953,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#R3_2XLARGE */ public static EC2HardwareBuilder r3_2xlarge() { - return new EC2HardwareBuilder(InstanceType.R3_2XLARGE) + return new EC2HardwareBuilder(InstanceType.R3_2XLARGE).r3() .ram(62464) .processors(ImmutableList.of(new Processor(8.0, 2.5))) .volumes(ImmutableList. of( @@ -858,7 +965,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#R3_4XLARGE */ public static EC2HardwareBuilder r3_4xlarge() { - return new EC2HardwareBuilder(InstanceType.R3_4XLARGE) + return new EC2HardwareBuilder(InstanceType.R3_4XLARGE).r3() .ram(124928) .processors(ImmutableList.of(new Processor(16.0, 2.5))) .volumes(ImmutableList. of( @@ -870,7 +977,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { * @see InstanceType#R3_8XLARGE */ public static EC2HardwareBuilder r3_8xlarge() { - return new EC2HardwareBuilder(InstanceType.R3_8XLARGE) + return new EC2HardwareBuilder(InstanceType.R3_8XLARGE).r3() .ram(249856) .processors(ImmutableList.of(new Processor(32.0, 2.5))) .volumes(ImmutableList. of( @@ -882,6 +989,7 @@ public class EC2HardwareBuilder extends HardwareBuilder { @SuppressWarnings("unchecked") @Override public Hardware build() { + Preconditions.checkNotNull(virtualizationType, "virtualizationType"); boolean reset = false; if (this.supportsImage == null) reset = true;