mirror of https://github.com/apache/jclouds.git
Issue 345: added t1 micro instance and made it the default instance size in ec2
This commit is contained in:
parent
ef1c57509a
commit
2b682c5dbb
|
@ -169,8 +169,8 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod
|
||||||
@Override
|
@Override
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||||
String region = injector.getInstance(Key.get(String.class, Region.class));
|
String region = injector.getInstance(Key.get(String.class, Region.class));
|
||||||
return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest() : template.os64Bit(false).osFamily(
|
return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest() : template.osFamily(
|
||||||
UBUNTU).osVersionMatches(".*10\\.?04.*").osDescriptionMatches("^ubuntu-images.*");
|
UBUNTU).osVersionMatches("10.04").os64Bit(true).osDescriptionMatches(".*ubuntu-images.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.jclouds.aws.ec2.compute.domain;
|
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 com.google.common.base.Predicates.not;
|
||||||
import static org.jclouds.compute.predicates.ImagePredicates.idIn;
|
import static org.jclouds.compute.predicates.ImagePredicates.idIn;
|
||||||
import static org.jclouds.compute.predicates.ImagePredicates.is64Bit;
|
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 java.util.Arrays;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.domain.InstanceType;
|
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.compute.domain.internal.SizeImpl;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,6 +44,34 @@ public class EC2Size extends SizeImpl {
|
||||||
private static final long serialVersionUID = 8605688733788974797L;
|
private static final long serialVersionUID = 8605688733788974797L;
|
||||||
private final String instanceType;
|
private final String instanceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* evaluates true if the Image has the following rootDeviceType
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* rootDeviceType of the image
|
||||||
|
* @return predicate
|
||||||
|
*/
|
||||||
|
public static Predicate<Image> hasRootDeviceType(final RootDeviceType type) {
|
||||||
|
checkNotNull(type, "type must be defined");
|
||||||
|
return new Predicate<Image>() {
|
||||||
|
@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.<String, String> of(), cores, ram, disk,
|
||||||
|
hasRootDeviceType(rootDeviceType));
|
||||||
|
this.instanceType = instanceType;
|
||||||
|
}
|
||||||
|
|
||||||
EC2Size(String instanceType, Double cores, Integer ram, Integer disk, boolean is64Bit) {
|
EC2Size(String instanceType, Double cores, Integer ram, Integer disk, boolean is64Bit) {
|
||||||
super(instanceType, instanceType, instanceType, null, null, ImmutableMap.<String, String> of(), cores, ram, disk,
|
super(instanceType, instanceType, instanceType, null, null, ImmutableMap.<String, String> of(), cores, ram, disk,
|
||||||
is64Bit ? is64Bit() : not(is64Bit()));
|
is64Bit ? is64Bit() : not(is64Bit()));
|
||||||
|
@ -59,10 +91,15 @@ public class EC2Size extends SizeImpl {
|
||||||
return instanceType;
|
return instanceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M1_SMALL
|
* @see InstanceType#M1_SMALL
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M1_SMALL = new EC2Size(InstanceType.M1_SMALL, 1.0, 1740, 160, false);
|
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
|
* @see InstanceType#M1_LARGE
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -136,7 +136,8 @@ public class ImageParser implements Function<org.jclouds.aws.ec2.domain.Image, I
|
||||||
}
|
}
|
||||||
OperatingSystem os = new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
|
OperatingSystem os = new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
|
||||||
return new ImageImpl(from.getId(), name, from.getRegion() + "/" + from.getId(), location, null, ImmutableMap
|
return new ImageImpl(from.getId(), name, from.getRegion() + "/" + from.getId(), location, null, ImmutableMap
|
||||||
.<String, String> of("owner", from.getImageOwnerId()), os, description, version, defaultCredentials);
|
.<String, String> of("owner", from.getImageOwnerId(), "rootDeviceType", from.getRootDeviceType()
|
||||||
|
.toString()), os, description, version, defaultCredentials);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ public class EC2SizeSupplier implements Supplier<Set<? extends Size>> {
|
||||||
});
|
});
|
||||||
sizes.add(new EC2Size(location, InstanceType.CC1_4XLARGE, 33.5, 23 * 1024, 1690, ccAmis));
|
sizes.add(new EC2Size(location, InstanceType.CC1_4XLARGE, 33.5, 23 * 1024, 1690, ccAmis));
|
||||||
}
|
}
|
||||||
sizes.addAll(ImmutableSet.<Size> of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL,
|
sizes.addAll(ImmutableSet.<Size> of(EC2Size.T1_MICRO, EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE,
|
||||||
EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE));
|
EC2Size.M1_SMALL, EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE));
|
||||||
return sizes;
|
return sizes;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,6 +32,16 @@ import org.jclouds.aws.ec2.EC2AsyncClient;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InstanceType {
|
public class InstanceType {
|
||||||
|
/**
|
||||||
|
* Micro Instance
|
||||||
|
* <ul>
|
||||||
|
* <li>613 MB of memory</li>
|
||||||
|
* <li>up to 2 ECUs (for short periodic bursts)</li>
|
||||||
|
* <li>No instance storage (EBS storage only)</li>
|
||||||
|
* <li>32-bit or 64-bit platform</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public static final String T1_MICRO = "t1.micro";
|
||||||
/**
|
/**
|
||||||
* Small Instance
|
* Small Instance
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
|
@ -37,6 +37,10 @@ public enum RootDeviceType {
|
||||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return value();
|
||||||
|
}
|
||||||
|
|
||||||
public static RootDeviceType fromValue(String v) {
|
public static RootDeviceType fromValue(String v) {
|
||||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
|
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
protected void assertDefaultWorks() {
|
protected void assertDefaultWorks() {
|
||||||
Template defaultTemplate = client.templateBuilder().build();
|
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.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,8 +149,8 @@ public class EC2ComputeServiceTest {
|
||||||
Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
||||||
.<Image> of(image));
|
.<Image> of(image));
|
||||||
Supplier<Set<? extends Size>> sizes = Suppliers.<Set<? extends Size>> ofInstance(ImmutableSet.<Size> of(
|
Supplier<Set<? extends Size>> sizes = Suppliers.<Set<? extends Size>> ofInstance(ImmutableSet.<Size> of(
|
||||||
EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL, EC2Size.M1_XLARGE,
|
EC2Size.T1_MICRO, EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL,
|
||||||
EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE, CC1_4XLARGE));
|
EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE, CC1_4XLARGE));
|
||||||
|
|
||||||
return new TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider,
|
return new TemplateBuilderImpl(locations, images, sizes, Suppliers.ofInstance(location), optionsProvider,
|
||||||
templateBuilderProvider) {
|
templateBuilderProvider) {
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class EC2TemplateBuilderLiveTest {
|
||||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
||||||
assertEquals(template.getImage().getVersion(), "4.4.10");
|
assertEquals(template.getImage().getVersion(), "4.4.10");
|
||||||
|
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(template.getSize().getCores(), 13.0d); // because it is m2 2xl
|
assertEquals(template.getSize().getCores(), 13.0d); // because it is m2 2xl
|
||||||
assertEquals(template.getSize().getId(), InstanceType.M2_2XLARGE);
|
assertEquals(template.getSize().getId(), InstanceType.M2_2XLARGE);
|
||||||
|
@ -90,8 +91,9 @@ public class EC2TemplateBuilderLiveTest {
|
||||||
Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
|
Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
|
||||||
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
|
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().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
|
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||||
newContext.getComputeService().templateBuilder().imageId(
|
newContext.getComputeService().templateBuilder().imageId(
|
||||||
|
@ -105,7 +107,28 @@ public class EC2TemplateBuilderLiveTest {
|
||||||
newContext.close();
|
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
|
@Test
|
||||||
public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException {
|
public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException {
|
||||||
ComputeServiceContext newContext = null;
|
ComputeServiceContext newContext = null;
|
||||||
|
@ -126,6 +149,7 @@ public class EC2TemplateBuilderLiveTest {
|
||||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
||||||
assertEquals(template.getImage().getVersion(), "4.4.10");
|
assertEquals(template.getImage().getVersion(), "4.4.10");
|
||||||
|
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(template.getSize().getCores(), 4.0d); // because it is 64bit
|
assertEquals(template.getSize().getCores(), 4.0d); // because it is 64bit
|
||||||
assertEquals(template.getSize().getId(), "m1.large"); // because it is 64bit
|
assertEquals(template.getSize().getId(), "m1.large"); // because it is 64bit
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
InputStream is = getClass().getResourceAsStream("/ec2/alestic_canonical.xml");
|
InputStream is = getClass().getResourceAsStream("/ec2/alestic_canonical.xml");
|
||||||
|
|
||||||
Set<Image> result = parseImages(is);
|
Set<Image> result = parseImages(is);
|
||||||
assertEquals(result.size(), 7);
|
assertEquals(result.size(), 8);
|
||||||
|
|
||||||
ImageParser parser = new ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), Suppliers
|
ImageParser parser = new ImageParser(new EC2PopulateDefaultLoginCredentialsForImageStrategy(), Suppliers
|
||||||
.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(defaultLocation)), Suppliers
|
.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(defaultLocation)), Suppliers
|
||||||
|
@ -73,7 +73,8 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
assertEquals(ubuntuHardy.getOperatingSystem().getDescription(),
|
assertEquals(ubuntuHardy.getOperatingSystem().getDescription(),
|
||||||
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml");
|
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml");
|
||||||
assertEquals(ubuntuHardy.getOperatingSystem().is64Bit(), false);
|
assertEquals(ubuntuHardy.getOperatingSystem().is64Bit(), false);
|
||||||
assertEquals(ubuntuHardy.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477"));
|
assertEquals(ubuntuHardy.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477",
|
||||||
|
"rootDeviceType", "instance-store"));
|
||||||
assertEquals(ubuntuHardy.getVersion(), "20091130");
|
assertEquals(ubuntuHardy.getVersion(), "20091130");
|
||||||
|
|
||||||
org.jclouds.compute.domain.Image alesticKarmic = parser.apply(Iterables.get(result, 1));
|
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(),
|
assertEquals(alesticKarmic.getOperatingSystem().getDescription(),
|
||||||
"alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml");
|
"alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml");
|
||||||
assertEquals(alesticKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(alesticKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(alesticKarmic.getUserMetadata(), ImmutableMap.<String, String> of("owner", "063491364108"));
|
assertEquals(alesticKarmic.getUserMetadata(), ImmutableMap.<String, String> of("owner", "063491364108",
|
||||||
|
"rootDeviceType", "instance-store"));
|
||||||
assertEquals(alesticKarmic.getVersion(), "20090623");
|
assertEquals(alesticKarmic.getVersion(), "20090623");
|
||||||
|
|
||||||
org.jclouds.compute.domain.Image ubuntuKarmic = parser.apply(Iterables.get(result, 2));
|
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(),
|
assertEquals(ubuntuKarmic.getOperatingSystem().getDescription(),
|
||||||
"ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml");
|
"ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml");
|
||||||
assertEquals(ubuntuKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(ubuntuKarmic.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(ubuntuKarmic.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477"));
|
assertEquals(ubuntuKarmic.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477",
|
||||||
|
"rootDeviceType", "instance-store"));
|
||||||
assertEquals(ubuntuKarmic.getVersion(), "20100121");
|
assertEquals(ubuntuKarmic.getVersion(), "20100121");
|
||||||
|
|
||||||
// should skip testing image
|
// should skip testing image
|
||||||
|
@ -128,7 +131,8 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
assertEquals(alesticHardy.getOperatingSystem().getDescription(),
|
assertEquals(alesticHardy.getOperatingSystem().getDescription(),
|
||||||
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml");
|
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml");
|
||||||
assertEquals(alesticHardy.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(alesticHardy.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(alesticHardy.getUserMetadata(), ImmutableMap.<String, String> of("owner", "063491364108"));
|
assertEquals(alesticHardy.getUserMetadata(), ImmutableMap.<String, String> of("owner", "063491364108",
|
||||||
|
"rootDeviceType", "instance-store"));
|
||||||
assertEquals(alesticHardy.getVersion(), "20080905");
|
assertEquals(alesticHardy.getVersion(), "20080905");
|
||||||
|
|
||||||
org.jclouds.compute.domain.Image ubuntuLucid = parser.apply(Iterables.get(result, 5));
|
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(),
|
assertEquals(ubuntuLucid.getOperatingSystem().getDescription(),
|
||||||
"ubuntu-images-us-west-1/ubuntu-lucid-10.04-i386-server-20100427.1.manifest.xml");
|
"ubuntu-images-us-west-1/ubuntu-lucid-10.04-i386-server-20100427.1.manifest.xml");
|
||||||
assertEquals(ubuntuLucid.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(ubuntuLucid.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(ubuntuLucid.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477"));
|
assertEquals(ubuntuLucid.getUserMetadata(), ImmutableMap.<String, String> of("owner", "099720109477",
|
||||||
|
"rootDeviceType", "instance-store"));
|
||||||
assertEquals(ubuntuLucid.getVersion(), "20100427.1");
|
assertEquals(ubuntuLucid.getVersion(), "20100427.1");
|
||||||
|
|
||||||
// should skip kernel
|
// should skip kernel
|
||||||
assert parser.apply(Iterables.get(result, 6)) == null;
|
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.<String, String> of("owner", "099720109477",
|
||||||
|
"rootDeviceType", "ebs"));
|
||||||
|
assertEquals(ubuntuEbs.getVersion(), "20100827");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Location defaultLocation = new LocationImpl(LocationScope.REGION, "us-east-1", "us-east-1", null);
|
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(),
|
assertEquals(image.getOperatingSystem().getDescription(),
|
||||||
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml");
|
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml");
|
||||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNKNOWN);
|
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNKNOWN);
|
||||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "133804938231"));
|
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "133804938231", "rootDeviceType",
|
||||||
|
"instance-store"));
|
||||||
assertEquals(image.getVersion(), "5622");
|
assertEquals(image.getVersion(), "5622");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +230,8 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
assertEquals(image.getOperatingSystem().getArch(), "hvm");
|
assertEquals(image.getOperatingSystem().getArch(), "hvm");
|
||||||
assertEquals(image.getOperatingSystem().getDescription(), "amazon/EC2 CentOS 5.4 HVM AMI");
|
assertEquals(image.getOperatingSystem().getDescription(), "amazon/EC2 CentOS 5.4 HVM AMI");
|
||||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
||||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "206029621532"));
|
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "206029621532", "rootDeviceType",
|
||||||
|
"ebs"));
|
||||||
assertEquals(image.getVersion(), null);
|
assertEquals(image.getVersion(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -233,7 +259,8 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
assertEquals(image.getOperatingSystem().getDescription(),
|
assertEquals(image.getOperatingSystem().getDescription(),
|
||||||
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml");
|
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml");
|
||||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
||||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "411009282317"));
|
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "411009282317", "rootDeviceType",
|
||||||
|
"instance-store"));
|
||||||
assertEquals(image.getVersion(), "4.4.10");
|
assertEquals(image.getVersion(), "4.4.10");
|
||||||
|
|
||||||
image = parser.apply(Iterables.get(result, 1));
|
image = parser.apply(Iterables.get(result, 1));
|
||||||
|
@ -249,7 +276,8 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
||||||
assertEquals(image.getOperatingSystem().getDescription(),
|
assertEquals(image.getOperatingSystem().getDescription(),
|
||||||
"411009282317/RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha");
|
"411009282317/RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha");
|
||||||
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "411009282317"));
|
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "411009282317", "rootDeviceType",
|
||||||
|
"ebs"));
|
||||||
assertEquals(image.getVersion(), "4.5.3_EBS_Alpha");
|
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().getArch(), "paravirtual");
|
||||||
assertEquals(image.getOperatingSystem().getDescription(), "centos-5.3-x86_64/centos.5-3.x86-64.img.manifest.xml");
|
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.getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
||||||
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "admin"));
|
assertEquals(image.getUserMetadata(), ImmutableMap.<String, String> of("owner", "admin", "rootDeviceType",
|
||||||
|
"instance-store"));
|
||||||
assertEquals(image.getVersion(), null);
|
assertEquals(image.getVersion(), null);
|
||||||
|
|
||||||
// should skip test images
|
// should skip test images
|
||||||
|
|
|
@ -91,5 +91,29 @@
|
||||||
<rootDeviceType>instance-store</rootDeviceType>
|
<rootDeviceType>instance-store</rootDeviceType>
|
||||||
<blockDeviceMapping />
|
<blockDeviceMapping />
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<imageId>ami-10f3a255</imageId>
|
||||||
|
<imageLocation>099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827</imageLocation>
|
||||||
|
<imageState>available</imageState>
|
||||||
|
<imageOwnerId>099720109477</imageOwnerId>
|
||||||
|
<isPublic>true</isPublic>
|
||||||
|
<architecture>i386</architecture>
|
||||||
|
<imageType>machine</imageType>
|
||||||
|
<kernelId>aki-a8f0a1ed</kernelId>
|
||||||
|
<name>ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827</name>
|
||||||
|
<rootDeviceType>ebs</rootDeviceType>
|
||||||
|
<rootDeviceName>/dev/sda1</rootDeviceName>
|
||||||
|
<blockDeviceMapping>
|
||||||
|
<item>
|
||||||
|
<deviceName>/dev/sda1</deviceName>
|
||||||
|
<ebs>
|
||||||
|
<snapshotId>snap-76eff01e</snapshotId>
|
||||||
|
<volumeSize>15</volumeSize>
|
||||||
|
<deleteOnTermination>true</deleteOnTermination>
|
||||||
|
</ebs>
|
||||||
|
</item>
|
||||||
|
</blockDeviceMapping>
|
||||||
|
<virtualizationType>paravirtual</virtualizationType>
|
||||||
|
</item>
|
||||||
</imagesSet>
|
</imagesSet>
|
||||||
</DescribeImagesResponse>
|
</DescribeImagesResponse>
|
||||||
|
|
|
@ -55,17 +55,17 @@ public interface TemplateBuilder {
|
||||||
TemplateBuilder fromTemplate(Template image);
|
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();
|
TemplateBuilder smallest();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configure this template to the fastest size.
|
* configure this template to the fastest size, based on cpu
|
||||||
*/
|
*/
|
||||||
TemplateBuilder fastest();
|
TemplateBuilder fastest();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configure this template to the largest size.
|
* configure this template to the largest size, based on cores, ram, then disk
|
||||||
*/
|
*/
|
||||||
TemplateBuilder biggest();
|
TemplateBuilder biggest();
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
for (Size size : client.listSizes()) {
|
for (Size size : client.listSizes()) {
|
||||||
assert size.getProviderId() != null;
|
assert size.getProviderId() != null;
|
||||||
assert size.getCores() > 0;
|
assert size.getCores() > 0;
|
||||||
assert size.getDisk() > 0;
|
assert size.getDisk() >= 0;
|
||||||
assert size.getRam() > 0;
|
assert size.getRam() > 0;
|
||||||
assertEquals(size.getType(), ComputeType.SIZE);
|
assertEquals(size.getType(), ComputeType.SIZE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue