mirror of https://github.com/apache/jclouds.git
Issue 512: aws-ec2 compute cluster size -> amzn linux
This commit is contained in:
parent
72e93e96d4
commit
41ed21d5b0
|
@ -51,7 +51,7 @@ public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilde
|
||||||
// amazon, alestic, canonical, and rightscale
|
// amazon, alestic, canonical, and rightscale
|
||||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317");
|
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317");
|
||||||
// amis that work with the cluster instances
|
// amis that work with the cluster instances
|
||||||
properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-7ea24a17");
|
properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-321eed5b,us-east-1/ami-7ea24a17");
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class AWSEC2ReviseParsedImage implements ReviseParsedImage {
|
||||||
// amzn-ami-us-east-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml
|
// amzn-ami-us-east-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml
|
||||||
// amzn-ami-us-east-1/amzn-ami-0.9.7-beta.i386.manifest.xml
|
// amzn-ami-us-east-1/amzn-ami-0.9.7-beta.i386.manifest.xml
|
||||||
public static final Pattern AMZN_PATTERN = Pattern
|
public static final Pattern AMZN_PATTERN = Pattern
|
||||||
.compile(".*/amzn-ami-(.*)\\.(i386|x86_64)(-ebs|\\.manifest.xml)?");
|
.compile(".*/(amzn-hvm-|amzn-)?ami-(.*)\\.(i386|x86_64)(-ebs|\\.manifest.xml)?");
|
||||||
|
|
||||||
// amazon/EC2 CentOS 5.4 HVM AMI
|
// amazon/EC2 CentOS 5.4 HVM AMI
|
||||||
public static final Pattern AMAZON_PATTERN = Pattern.compile("amazon/EC2 ([^ ]+) ([^ ]+).*");
|
public static final Pattern AMAZON_PATTERN = Pattern.compile("amazon/EC2 ([^ ]+) ([^ ]+).*");
|
||||||
|
@ -83,8 +83,8 @@ public class AWSEC2ReviseParsedImage implements ReviseParsedImage {
|
||||||
Matcher matcher = getMatcherAndFind(from.getImageLocation());
|
Matcher matcher = getMatcherAndFind(from.getImageLocation());
|
||||||
if (matcher.pattern() == AMZN_PATTERN) {
|
if (matcher.pattern() == AMZN_PATTERN) {
|
||||||
osBuilder.family(OsFamily.AMZN_LINUX);
|
osBuilder.family(OsFamily.AMZN_LINUX);
|
||||||
osBuilder.version(matcher.group(1));
|
osBuilder.version(matcher.group(2));
|
||||||
builder.version(matcher.group(1));
|
builder.version(matcher.group(2));
|
||||||
} else if (matcher.pattern() == AMAZON_PATTERN) {
|
} else if (matcher.pattern() == AMAZON_PATTERN) {
|
||||||
family = OsFamily.fromValue(matcher.group(1));
|
family = OsFamily.fromValue(matcher.group(1));
|
||||||
osBuilder.family(family);
|
osBuilder.family(family);
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
|
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1");
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1-beta");
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
||||||
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
|
@ -125,6 +125,20 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFastestTemplateBuilder() throws IOException {
|
||||||
|
|
||||||
|
Template defaultTemplate = context.getComputeService().templateBuilder().fastest().build();
|
||||||
|
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1-beta");
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
||||||
|
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
|
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
||||||
|
assertEquals(getCores(defaultTemplate.getHardware()), 8.0d);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTemplateBuilderMicro() throws IOException {
|
public void testTemplateBuilderMicro() throws IOException {
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||||
import org.jclouds.compute.domain.ImageBuilder;
|
import org.jclouds.compute.domain.ImageBuilder;
|
||||||
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
@ -60,7 +60,7 @@ public class AWSEC2ImageParserTest {
|
||||||
Set<org.jclouds.compute.domain.Image> result = convertImages("/alestic_canonical.xml");
|
Set<org.jclouds.compute.domain.Image> result = convertImages("/alestic_canonical.xml");
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04").description(
|
new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04").description(
|
||||||
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml").is64Bit(false).build())
|
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml").is64Bit(false).build())
|
||||||
.description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml").defaultCredentials(
|
.description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml").defaultCredentials(
|
||||||
new Credentials("ubuntu", null)).id("us-east-1/ami-7e28ca17").providerId("ami-7e28ca17")
|
new Credentials("ubuntu", null)).id("us-east-1/ami-7e28ca17").providerId("ami-7e28ca17")
|
||||||
|
@ -68,7 +68,7 @@ public class AWSEC2ImageParserTest {
|
||||||
ImmutableMap.of("owner", "099720109477", "rootDeviceType", "instance-store")).build());
|
ImmutableMap.of("owner", "099720109477", "rootDeviceType", "instance-store")).build());
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 4), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 4), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04").description(
|
new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04").description(
|
||||||
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").is64Bit(false).build()).description(
|
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").is64Bit(false).build()).description(
|
||||||
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").defaultCredentials(
|
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").defaultCredentials(
|
||||||
new Credentials("ubuntu", null)).id("us-east-1/ami-c0fa1ea9").providerId("ami-c0fa1ea9").location(
|
new Credentials("ubuntu", null)).id("us-east-1/ami-c0fa1ea9").providerId("ami-c0fa1ea9").location(
|
||||||
|
@ -76,7 +76,7 @@ public class AWSEC2ImageParserTest {
|
||||||
ImmutableMap.of("owner", "063491364108", "rootDeviceType", "instance-store")).build());
|
ImmutableMap.of("owner", "063491364108", "rootDeviceType", "instance-store")).build());
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 6), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 6), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04").description(
|
new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04").description(
|
||||||
"099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827").is64Bit(false)
|
"099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827").is64Bit(false)
|
||||||
.build()).description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
|
.build()).description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
|
||||||
.defaultCredentials(new Credentials("ubuntu", null)).id("us-east-1/ami-10f3a255").providerId(
|
.defaultCredentials(new Credentials("ubuntu", null)).id("us-east-1/ami-10f3a255").providerId(
|
||||||
|
@ -90,7 +90,7 @@ public class AWSEC2ImageParserTest {
|
||||||
Set<org.jclouds.compute.domain.Image> result = convertImages("/vostok.xml");
|
Set<org.jclouds.compute.domain.Image> result = convertImages("/vostok.xml");
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
|
new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
|
||||||
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml").is64Bit(false).build())
|
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml").is64Bit(false).build())
|
||||||
.description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml").defaultCredentials(
|
.description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml").defaultCredentials(
|
||||||
new Credentials("root", null)).id("us-east-1/ami-870de2ee").providerId("ami-870de2ee")
|
new Credentials("root", null)).id("us-east-1/ami-870de2ee").providerId("ami-870de2ee")
|
||||||
|
@ -104,7 +104,7 @@ public class AWSEC2ImageParserTest {
|
||||||
Set<org.jclouds.compute.domain.Image> result = convertImages("/describe_images_cc.xml");
|
Set<org.jclouds.compute.domain.Image> result = convertImages("/describe_images_cc.xml");
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("hvm").version("5.4").description(
|
new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("hvm").version("5.4").description(
|
||||||
"amazon/EC2 CentOS 5.4 HVM AMI").is64Bit(true).build()).description("EC2 CentOS 5.4 HVM AMI")
|
"amazon/EC2 CentOS 5.4 HVM AMI").is64Bit(true).build()).description("EC2 CentOS 5.4 HVM AMI")
|
||||||
.defaultCredentials(new Credentials("root", null)).id("us-east-1/ami-7ea24a17").providerId(
|
.defaultCredentials(new Credentials("root", null)).id("us-east-1/ami-7ea24a17").providerId(
|
||||||
"ami-7ea24a17").location(defaultLocation).userMetadata(
|
"ami-7ea24a17").location(defaultLocation).userMetadata(
|
||||||
|
@ -117,7 +117,7 @@ public class AWSEC2ImageParserTest {
|
||||||
Set<org.jclouds.compute.domain.Image> result = convertImages("/rightscale_images.xml");
|
Set<org.jclouds.compute.domain.Image> result = convertImages("/rightscale_images.xml");
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("paravirtual").version("5.4").description(
|
new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.4").description(
|
||||||
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").is64Bit(true).build()).description(
|
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").is64Bit(true).build()).description(
|
||||||
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").defaultCredentials(
|
"rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").defaultCredentials(
|
||||||
new Credentials("root", null)).id("us-east-1/ami-ccb35ea5").providerId("ami-ccb35ea5").location(
|
new Credentials("root", null)).id("us-east-1/ami-ccb35ea5").providerId("ami-ccb35ea5").location(
|
||||||
|
@ -138,14 +138,14 @@ public class AWSEC2ImageParserTest {
|
||||||
Set<org.jclouds.compute.domain.Image> result = convertImages("/amzn_images.xml");
|
Set<org.jclouds.compute.domain.Image> result = convertImages("/amzn_images.xml");
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.AMZN_LINUX).arch("paravirtual").version("0.9.7-beta")
|
new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual").version("0.9.7-beta")
|
||||||
.description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).description(
|
.description("137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).description(
|
||||||
"Amazon").defaultCredentials(new Credentials("ec2-user", null)).id("us-east-1/ami-82e4b5c7").providerId(
|
"Amazon").defaultCredentials(new Credentials("ec2-user", null)).id("us-east-1/ami-82e4b5c7").providerId(
|
||||||
"ami-82e4b5c7").location(defaultLocation).version("0.9.7-beta").userMetadata(
|
"ami-82e4b5c7").location(defaultLocation).version("0.9.7-beta").userMetadata(
|
||||||
ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
|
ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
|
||||||
|
|
||||||
assertEquals(Iterables.get(result, 3), new ImageBuilder().operatingSystem(
|
assertEquals(Iterables.get(result, 3), new ImageBuilder().operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.AMZN_LINUX).arch("paravirtual").version("0.9.7-beta")
|
new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual").version("0.9.7-beta")
|
||||||
.description("amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true)
|
.description("amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true)
|
||||||
.build()).description("Amazon Linux AMI x86_64 S3").defaultCredentials(
|
.build()).description("Amazon Linux AMI x86_64 S3").defaultCredentials(
|
||||||
new Credentials("ec2-user", null)).id("us-east-1/ami-f2e4b5b7").providerId("ami-f2e4b5b7").location(
|
new Credentials("ec2-user", null)).id("us-east-1/ami-f2e4b5b7").providerId("ami-f2e4b5b7").location(
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class PlacementGroupClientLiveTest {
|
||||||
Template template = context.getComputeService().templateBuilder().fastest().build();
|
Template template = context.getComputeService().templateBuilder().fastest().build();
|
||||||
assert template != null : "The returned template was null, but it should have a value.";
|
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.CC1_4XLARGE);
|
||||||
assertEquals(template.getImage().getId(), "us-east-1/ami-7ea24a17");
|
assertEquals(template.getImage().getId(), "us-east-1/ami-321eed5b");
|
||||||
|
|
||||||
template.getOptions().overrideLoginCredentialWith(keyPair.get("private"))
|
template.getOptions().overrideLoginCredentialWith(keyPair.get("private"))
|
||||||
.authorizePublicKey(keyPair.get("public")).runScript(buildScript(template.getImage().getOperatingSystem()));
|
.authorizePublicKey(keyPair.get("public")).runScript(buildScript(template.getImage().getOperatingSystem()));
|
||||||
|
|
Loading…
Reference in New Issue