From 2b682c5dbbed35f5c1ff65284a825fab3090949c Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 9 Sep 2010 12:44:42 -0700 Subject: [PATCH] Issue 345: added t1 micro instance and made it the default instance size in ec2 --- .../EC2ComputeServiceContextModule.java | 4 +- .../aws/ec2/compute/domain/EC2Size.java | 37 ++++++++++++++ .../ec2/compute/functions/ImageParser.java | 3 +- .../compute/suppliers/EC2SizeSupplier.java | 4 +- .../jclouds/aws/ec2/domain/InstanceType.java | 10 ++++ .../aws/ec2/domain/RootDeviceType.java | 4 ++ .../compute/EC2ComputeServiceLiveTest.java | 2 +- .../ec2/compute/EC2ComputeServiceTest.java | 4 +- .../compute/EC2TemplateBuilderLiveTest.java | 26 +++++++++- .../compute/functions/ImageParserTest.java | 51 +++++++++++++++---- .../test/resources/ec2/alestic_canonical.xml | 24 +++++++++ .../compute/domain/TemplateBuilder.java | 6 +-- .../compute/BaseComputeServiceLiveTest.java | 2 +- 13 files changed, 153 insertions(+), 24 deletions(-) diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java index 283a1b6f92..5bd736b07c 100755 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java @@ -169,8 +169,8 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod @Override protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { String region = injector.getInstance(Key.get(String.class, Region.class)); - return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest() : template.os64Bit(false).osFamily( - UBUNTU).osVersionMatches(".*10\\.?04.*").osDescriptionMatches("^ubuntu-images.*"); + return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest() : template.osFamily( + UBUNTU).osVersionMatches("10.04").os64Bit(true).osDescriptionMatches(".*ubuntu-images.*"); } @Provides diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/EC2Size.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/EC2Size.java index 6b1b7957dc..5dc7e56222 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/EC2Size.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/domain/EC2Size.java @@ -19,6 +19,7 @@ package org.jclouds.aws.ec2.compute.domain; +import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.not; import static org.jclouds.compute.predicates.ImagePredicates.idIn; import static org.jclouds.compute.predicates.ImagePredicates.is64Bit; @@ -26,9 +27,12 @@ import static org.jclouds.compute.predicates.ImagePredicates.is64Bit; import java.util.Arrays; import org.jclouds.aws.ec2.domain.InstanceType; +import org.jclouds.aws.ec2.domain.RootDeviceType; +import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.internal.SizeImpl; import org.jclouds.domain.Location; +import com.google.common.base.Predicate; import com.google.common.collect.ImmutableMap; /** @@ -40,6 +44,34 @@ public class EC2Size extends SizeImpl { private static final long serialVersionUID = 8605688733788974797L; private final String instanceType; + /** + * evaluates true if the Image has the following rootDeviceType + * + * @param type + * rootDeviceType of the image + * @return predicate + */ + public static Predicate hasRootDeviceType(final RootDeviceType type) { + checkNotNull(type, "type must be defined"); + return new Predicate() { + @Override + public boolean apply(Image image) { + return type.toString().equals(image.getUserMetadata().get("rootDeviceType")); + } + + @Override + public String toString() { + return "hasRootDeviceType(" + type + ")"; + } + }; + } + + EC2Size(String instanceType, Double cores, Integer ram, Integer disk, RootDeviceType rootDeviceType) { + super(instanceType, instanceType, instanceType, null, null, ImmutableMap. of(), cores, ram, disk, + hasRootDeviceType(rootDeviceType)); + this.instanceType = instanceType; + } + EC2Size(String instanceType, Double cores, Integer ram, Integer disk, boolean is64Bit) { super(instanceType, instanceType, instanceType, null, null, ImmutableMap. of(), cores, ram, disk, is64Bit ? is64Bit() : not(is64Bit())); @@ -59,10 +91,15 @@ public class EC2Size extends SizeImpl { return instanceType; } + /** * @see InstanceType#M1_SMALL */ public static final EC2Size M1_SMALL = new EC2Size(InstanceType.M1_SMALL, 1.0, 1740, 160, false); + /** + * @see InstanceType#T1_MICRO + */ + public static final EC2Size T1_MICRO = new EC2Size(InstanceType.T1_MICRO, 1.0, 630, 0, RootDeviceType.EBS); /** * @see InstanceType#M1_LARGE */ diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java index 5fb2d1103e..0b1238d78e 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/functions/ImageParser.java @@ -136,7 +136,8 @@ public class ImageParser implements Function of("owner", from.getImageOwnerId()), os, description, version, defaultCredentials); + . of("owner", from.getImageOwnerId(), "rootDeviceType", from.getRootDeviceType() + .toString()), os, description, version, defaultCredentials); } diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/suppliers/EC2SizeSupplier.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/suppliers/EC2SizeSupplier.java index 68a43d5849..b39f8aa386 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/suppliers/EC2SizeSupplier.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/suppliers/EC2SizeSupplier.java @@ -75,8 +75,8 @@ public class EC2SizeSupplier implements Supplier> { }); sizes.add(new EC2Size(location, InstanceType.CC1_4XLARGE, 33.5, 23 * 1024, 1690, ccAmis)); } - sizes.addAll(ImmutableSet. of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL, - EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE)); + sizes.addAll(ImmutableSet. of(EC2Size.T1_MICRO, EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, + EC2Size.M1_SMALL, EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE)); return sizes; } } \ No newline at end of file diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceType.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceType.java index 40eecd2257..6c7e203e5c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceType.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/InstanceType.java @@ -32,6 +32,16 @@ import org.jclouds.aws.ec2.EC2AsyncClient; * */ public class InstanceType { + /** + * Micro Instance + *
    + *
  • 613 MB of memory
  • + *
  • up to 2 ECUs (for short periodic bursts)
  • + *
  • No instance storage (EBS storage only)
  • + *
  • 32-bit or 64-bit platform
  • + *
+ */ + public static final String T1_MICRO = "t1.micro"; /** * Small Instance *
    diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RootDeviceType.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RootDeviceType.java index 2c0d3e3b34..6919013bab 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RootDeviceType.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/RootDeviceType.java @@ -37,6 +37,10 @@ public enum RootDeviceType { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); } + public String toString() { + return value(); + } + public static RootDeviceType fromValue(String v) { return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v)); } diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceLiveTest.java index 339254cc89..e754c2dc05 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceLiveTest.java @@ -90,7 +90,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest { protected void assertDefaultWorks() { Template defaultTemplate = client.templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getSize().getCores(), 1.0d); } diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceTest.java index 31354bc30c..81714255f9 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2ComputeServiceTest.java @@ -149,8 +149,8 @@ public class EC2ComputeServiceTest { Supplier> images = Suppliers.> ofInstance(ImmutableSet . of(image)); Supplier> sizes = Suppliers.> ofInstance(ImmutableSet. of( - EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL, EC2Size.M1_XLARGE, - EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE, CC1_4XLARGE)); + EC2Size.T1_MICRO, EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL, + EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE, CC1_4XLARGE)); return new TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider, templateBuilderProvider) { diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java index b5bc116dc1..6d35cfe9f0 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java @@ -70,6 +70,7 @@ public class EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getVersion(), "4.4.10"); + assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getSize().getCores(), 13.0d); // because it is m2 2xl assertEquals(template.getSize().getId(), InstanceType.M2_2XLARGE); @@ -90,8 +91,9 @@ public class EC2TemplateBuilderLiveTest { Template defaultTemplate = newContext.getComputeService().templateBuilder().build(); assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); assertEquals(defaultTemplate.getLocation().getId(), "us-east-1"); assertEquals(defaultTemplate.getSize().getCores(), 1.0d); newContext.getComputeService().templateBuilder().imageId( @@ -105,7 +107,28 @@ public class EC2TemplateBuilderLiveTest { newContext.close(); } } + + @Test + public void testTemplateBuilderMicro() throws IOException { + ComputeServiceContext newContext = null; + try { + newContext = new ComputeServiceContextFactory().createContext("ec2", user, password, ImmutableSet + .of(new Log4JLoggingModule())); + Template microTemplate = newContext.getComputeService().templateBuilder().sizeId(InstanceType.T1_MICRO).build(); + assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate; + assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "9.10"); + assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), false); + assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); + assertEquals(microTemplate.getLocation().getId(), "us-east-1"); + assertEquals(microTemplate.getSize().getCores(), 1.0d); + } finally { + if (newContext != null) + newContext.close(); + } + } + @Test public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException { ComputeServiceContext newContext = null; @@ -126,6 +149,7 @@ public class EC2TemplateBuilderLiveTest { assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getVersion(), "4.4.10"); + assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getSize().getCores(), 4.0d); // because it is 64bit assertEquals(template.getSize().getId(), "m1.large"); // because it is 64bit diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/ImageParserTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/ImageParserTest.java index ee5f3904eb..44f80014e3 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/ImageParserTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/ImageParserTest.java @@ -54,7 +54,7 @@ public class ImageParserTest extends BaseEC2HandlerTest { InputStream is = getClass().getResourceAsStream("/ec2/alestic_canonical.xml"); Set result = parseImages(is); - assertEquals(result.size(), 7); + assertEquals(result.size(), 8); ImageParser parser = new ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), Suppliers .> ofInstance(ImmutableSet. of(defaultLocation)), Suppliers @@ -73,7 +73,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(ubuntuHardy.getOperatingSystem().getDescription(), "ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml"); assertEquals(ubuntuHardy.getOperatingSystem().is64Bit(), false); - assertEquals(ubuntuHardy.getUserMetadata(), ImmutableMap. of("owner", "099720109477")); + assertEquals(ubuntuHardy.getUserMetadata(), ImmutableMap. of("owner", "099720109477", + "rootDeviceType", "instance-store")); assertEquals(ubuntuHardy.getVersion(), "20091130"); org.jclouds.compute.domain.Image alesticKarmic = parser.apply(Iterables.get(result, 1)); @@ -90,7 +91,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(alesticKarmic.getOperatingSystem().getDescription(), "alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml"); assertEquals(alesticKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(alesticKarmic.getUserMetadata(), ImmutableMap. of("owner", "063491364108")); + assertEquals(alesticKarmic.getUserMetadata(), ImmutableMap. of("owner", "063491364108", + "rootDeviceType", "instance-store")); assertEquals(alesticKarmic.getVersion(), "20090623"); org.jclouds.compute.domain.Image ubuntuKarmic = parser.apply(Iterables.get(result, 2)); @@ -108,7 +110,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(ubuntuKarmic.getOperatingSystem().getDescription(), "ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml"); assertEquals(ubuntuKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(ubuntuKarmic.getUserMetadata(), ImmutableMap. of("owner", "099720109477")); + assertEquals(ubuntuKarmic.getUserMetadata(), ImmutableMap. of("owner", "099720109477", + "rootDeviceType", "instance-store")); assertEquals(ubuntuKarmic.getVersion(), "20100121"); // should skip testing image @@ -128,7 +131,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(alesticHardy.getOperatingSystem().getDescription(), "alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml"); assertEquals(alesticHardy.getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(alesticHardy.getUserMetadata(), ImmutableMap. of("owner", "063491364108")); + assertEquals(alesticHardy.getUserMetadata(), ImmutableMap. of("owner", "063491364108", + "rootDeviceType", "instance-store")); assertEquals(alesticHardy.getVersion(), "20080905"); org.jclouds.compute.domain.Image ubuntuLucid = parser.apply(Iterables.get(result, 5)); @@ -146,11 +150,31 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(ubuntuLucid.getOperatingSystem().getDescription(), "ubuntu-images-us-west-1/ubuntu-lucid-10.04-i386-server-20100427.1.manifest.xml"); assertEquals(ubuntuLucid.getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(ubuntuLucid.getUserMetadata(), ImmutableMap. of("owner", "099720109477")); + assertEquals(ubuntuLucid.getUserMetadata(), ImmutableMap. of("owner", "099720109477", + "rootDeviceType", "instance-store")); assertEquals(ubuntuLucid.getVersion(), "20100427.1"); // should skip kernel assert parser.apply(Iterables.get(result, 6)) == null; + + org.jclouds.compute.domain.Image ubuntuEbs = parser.apply(Iterables.get(result, 7)); + + assertEquals(ubuntuEbs.getOperatingSystem().is64Bit(), false); + assertEquals(ubuntuEbs.getDescription(), "099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827"); + assertEquals(ubuntuEbs.getId(), "us-east-1/ami-10f3a255"); + assertEquals(ubuntuEbs.getProviderId(), "ami-10f3a255"); + assertEquals(ubuntuEbs.getLocation(), defaultLocation); + assertEquals(ubuntuEbs.getName(), null); + assertEquals(ubuntuEbs.getOperatingSystem().getName(), null); + assertEquals(ubuntuEbs.getOperatingSystem().getVersion(), "10.04"); + assertEquals(ubuntuEbs.getOperatingSystem().getArch(), "paravirtual"); + assertEquals(ubuntuEbs.getOperatingSystem().getDescription(), + "099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827"); + assertEquals(ubuntuEbs.getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(ubuntuEbs.getUserMetadata(), ImmutableMap. of("owner", "099720109477", + "rootDeviceType", "ebs")); + assertEquals(ubuntuEbs.getVersion(), "20100827"); + } private Location defaultLocation = new LocationImpl(LocationScope.REGION, "us-east-1", "us-east-1", null); @@ -178,7 +202,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(image.getOperatingSystem().getDescription(), "vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml"); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNKNOWN); - assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "133804938231")); + assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "133804938231", "rootDeviceType", + "instance-store")); assertEquals(image.getVersion(), "5622"); } @@ -205,7 +230,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(image.getOperatingSystem().getArch(), "hvm"); assertEquals(image.getOperatingSystem().getDescription(), "amazon/EC2 CentOS 5.4 HVM AMI"); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS); - assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "206029621532")); + assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "206029621532", "rootDeviceType", + "ebs")); assertEquals(image.getVersion(), null); } @@ -233,7 +259,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(image.getOperatingSystem().getDescription(), "rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml"); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS); - assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "411009282317")); + assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "411009282317", "rootDeviceType", + "instance-store")); assertEquals(image.getVersion(), "4.4.10"); image = parser.apply(Iterables.get(result, 1)); @@ -249,7 +276,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(image.getOperatingSystem().getDescription(), "411009282317/RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha"); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "411009282317")); + assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "411009282317", "rootDeviceType", + "ebs")); assertEquals(image.getVersion(), "4.5.3_EBS_Alpha"); } @@ -276,7 +304,8 @@ public class ImageParserTest extends BaseEC2HandlerTest { assertEquals(image.getOperatingSystem().getArch(), "paravirtual"); assertEquals(image.getOperatingSystem().getDescription(), "centos-5.3-x86_64/centos.5-3.x86-64.img.manifest.xml"); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS); - assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "admin")); + assertEquals(image.getUserMetadata(), ImmutableMap. of("owner", "admin", "rootDeviceType", + "instance-store")); assertEquals(image.getVersion(), null); // should skip test images diff --git a/aws/core/src/test/resources/ec2/alestic_canonical.xml b/aws/core/src/test/resources/ec2/alestic_canonical.xml index 97569d6418..ac3fcd8b8d 100644 --- a/aws/core/src/test/resources/ec2/alestic_canonical.xml +++ b/aws/core/src/test/resources/ec2/alestic_canonical.xml @@ -91,5 +91,29 @@ instance-store + + ami-10f3a255 + 099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827 + available + 099720109477 + true + i386 + machine + aki-a8f0a1ed + ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827 + ebs + /dev/sda1 + + + /dev/sda1 + + snap-76eff01e + 15 + true + + + + paravirtual + diff --git a/compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java b/compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java index d9bd97322a..da48b8c199 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java +++ b/compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java @@ -55,17 +55,17 @@ public interface TemplateBuilder { TemplateBuilder fromTemplate(Template image); /** - * configure this template to the smallest size. + * configure this template to the smallest size, based on cores, ram, then disk */ TemplateBuilder smallest(); /** - * configure this template to the fastest size. + * configure this template to the fastest size, based on cpu */ TemplateBuilder fastest(); /** - * configure this template to the largest size. + * configure this template to the largest size, based on cores, ram, then disk */ TemplateBuilder biggest(); diff --git a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java index 4f776095cf..28ece2bcc1 100755 --- a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java @@ -514,7 +514,7 @@ public abstract class BaseComputeServiceLiveTest { for (Size size : client.listSizes()) { assert size.getProviderId() != null; assert size.getCores() > 0; - assert size.getDisk() > 0; + assert size.getDisk() >= 0; assert size.getRam() > 0; assertEquals(size.getType(), ComputeType.SIZE); }