mirror of https://github.com/apache/jclouds.git
Issue 512: locked virtualization type down
This commit is contained in:
parent
f39514a861
commit
a3fc778035
|
@ -21,6 +21,8 @@ package org.jclouds.ec2.compute.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.google.common.base.Predicates.not;
|
||||||
|
import static org.jclouds.compute.predicates.ImagePredicates.any;
|
||||||
import static org.jclouds.compute.predicates.ImagePredicates.idIn;
|
import static org.jclouds.compute.predicates.ImagePredicates.idIn;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -28,16 +30,21 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.InstanceType;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
|
||||||
import org.jclouds.compute.domain.HardwareBuilder;
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.domain.Processor;
|
import org.jclouds.compute.domain.Processor;
|
||||||
import org.jclouds.compute.domain.Volume;
|
import org.jclouds.compute.domain.Volume;
|
||||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
import org.jclouds.compute.domain.internal.VolumeImpl;
|
||||||
|
import org.jclouds.compute.predicates.ImagePredicates;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.ec2.domain.InstanceType;
|
||||||
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
|
import org.jclouds.ec2.domain.VirtualizationType;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +55,15 @@ import com.google.common.collect.ImmutableList;
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
public class EC2HardwareBuilder extends HardwareBuilder {
|
public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
|
private Predicate<Image> rootDeviceType = any();
|
||||||
|
private Predicate<Image> virtualizationType = Predicates.or(new IsWindows(), new RequiresVirtualizationType(
|
||||||
|
VirtualizationType.PARAVIRTUAL));
|
||||||
|
private Predicate<Image> imageIds = any();
|
||||||
|
private Predicate<Image> is64Bit = any();
|
||||||
|
|
||||||
|
public EC2HardwareBuilder() {
|
||||||
|
this.supportsImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* evaluates true if the Image has the following rootDeviceType
|
* evaluates true if the Image has the following rootDeviceType
|
||||||
|
@ -56,39 +72,84 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* rootDeviceType of the image
|
* rootDeviceType of the image
|
||||||
* @return predicate
|
* @return predicate
|
||||||
*/
|
*/
|
||||||
public static class HasRootDeviceType implements Predicate<Image> {
|
public static class RequiresRootDeviceType implements Predicate<Image> {
|
||||||
final RootDeviceType type;
|
final RootDeviceType type;
|
||||||
|
|
||||||
public HasRootDeviceType(final RootDeviceType type) {
|
public RequiresRootDeviceType(final RootDeviceType type) {
|
||||||
|
|
||||||
this.type = checkNotNull(type, "type must be defined");
|
this.type = checkNotNull(type, "type must be defined");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Image image) {
|
public boolean apply(Image image) {
|
||||||
return type.toString().equals(image.getUserMetadata().get("rootDeviceType"));
|
return image.getUserMetadata().containsKey("rootDeviceType")
|
||||||
|
&& type == RootDeviceType.fromValue(image.getUserMetadata().get("rootDeviceType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "hasRootDeviceType(" + type + ")";
|
return "requiresRootDeviceType(" + type + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class IsWindows implements Predicate<Image> {
|
||||||
|
|
||||||
|
@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
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* virtualizationType of the image
|
||||||
|
* @return predicate
|
||||||
|
*/
|
||||||
|
public static class RequiresVirtualizationType implements Predicate<Image> {
|
||||||
|
final VirtualizationType type;
|
||||||
|
|
||||||
|
public RequiresVirtualizationType(final VirtualizationType type) {
|
||||||
|
this.type = checkNotNull(type, "type must be defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Image image) {
|
||||||
|
return image.getOperatingSystem() != null && image.getOperatingSystem().getArch() != null
|
||||||
|
&& type == VirtualizationType.fromValue(image.getOperatingSystem().getArch());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "requiresVirtualizationType(" + type + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EC2HardwareBuilder(String instanceType) {
|
public EC2HardwareBuilder(String instanceType) {
|
||||||
super();
|
|
||||||
ids(instanceType);
|
ids(instanceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EC2HardwareBuilder virtualizationType(VirtualizationType virtualizationType) {
|
||||||
|
this.virtualizationType = new RequiresVirtualizationType(virtualizationType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public EC2HardwareBuilder rootDeviceType(RootDeviceType rootDeviceType) {
|
public EC2HardwareBuilder rootDeviceType(RootDeviceType rootDeviceType) {
|
||||||
supportsImage(new HasRootDeviceType(rootDeviceType));
|
this.rootDeviceType = new RequiresRootDeviceType(rootDeviceType);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EC2HardwareBuilder supportsImageIds(String... ids) {
|
public EC2HardwareBuilder supportsImageIds(String... ids) {
|
||||||
checkArgument(ids != null && ids.length > 0, "ids must be specified");
|
checkArgument(ids != null && ids.length > 0, "ids must be specified");
|
||||||
supportsImage(idIn(Arrays.asList(ids)));
|
this.imageIds = idIn(Arrays.asList(ids));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +174,8 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public EC2HardwareBuilder is64Bit(boolean is64Bit) {
|
public EC2HardwareBuilder is64Bit(boolean is64Bit) {
|
||||||
return EC2HardwareBuilder.class.cast(super.is64Bit(is64Bit));
|
this.is64Bit = is64Bit ? ImagePredicates.is64Bit() : not(ImagePredicates.is64Bit());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EC2HardwareBuilder id(String id) {
|
public EC2HardwareBuilder id(String id) {
|
||||||
|
@ -149,11 +211,9 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#M1_SMALL
|
* @see InstanceType#M1_SMALL
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m1_small() {
|
public static EC2HardwareBuilder m1_small() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M1_SMALL)
|
return new EC2HardwareBuilder(InstanceType.M1_SMALL).ram(1740).processors(
|
||||||
.ram(1740)
|
ImmutableList.of(new Processor(1.0, 1.0))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(1.0, 1.0)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(150.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(150.0f,
|
|
||||||
"/dev/sda2", false, false))).is64Bit(false);
|
"/dev/sda2", false, false))).is64Bit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,19 +221,17 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#T1_MICRO
|
* @see InstanceType#T1_MICRO
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder t1_micro() {
|
public static EC2HardwareBuilder t1_micro() {
|
||||||
return new EC2HardwareBuilder(InstanceType.T1_MICRO).ram(630)
|
return new EC2HardwareBuilder(InstanceType.T1_MICRO).ram(630).processors(
|
||||||
.processors(ImmutableList.of(new Processor(1.0, 1.0))).rootDeviceType(RootDeviceType.EBS);
|
ImmutableList.of(new Processor(1.0, 1.0))).rootDeviceType(RootDeviceType.EBS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M1_LARGE
|
* @see InstanceType#M1_LARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m1_large() {
|
public static EC2HardwareBuilder m1_large() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M1_LARGE)
|
return new EC2HardwareBuilder(InstanceType.M1_LARGE).ram(7680).processors(
|
||||||
.ram(7680)
|
ImmutableList.of(new Processor(2.0, 2.0))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(2.0, 2.0)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
|
||||||
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false))).is64Bit(true);
|
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false))).is64Bit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,34 +239,30 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#M1_XLARGE
|
* @see InstanceType#M1_XLARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m1_xlarge() {
|
public static EC2HardwareBuilder m1_xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M1_XLARGE)
|
return new EC2HardwareBuilder(InstanceType.M1_XLARGE).ram(15360).processors(
|
||||||
.ram(15360)
|
ImmutableList.of(new Processor(4.0, 2.0))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(4.0, 2.0)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
|
||||||
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false), new VolumeImpl(
|
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false), new VolumeImpl(
|
||||||
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false)))
|
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false))).is64Bit(
|
||||||
.is64Bit(true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M2_XLARGE
|
* @see InstanceType#M2_XLARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m2_xlarge() {
|
public static EC2HardwareBuilder m2_xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M2_XLARGE).ram(17510)
|
return new EC2HardwareBuilder(InstanceType.M2_XLARGE).ram(17510).processors(
|
||||||
.processors(ImmutableList.of(new Processor(2.0, 3.25)))
|
ImmutableList.of(new Processor(2.0, 3.25))).volumes(
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl(420.0f, "/dev/sda1", true, false))).is64Bit(true);
|
ImmutableList.<Volume> of(new VolumeImpl(420.0f, "/dev/sda1", true, false))).is64Bit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M2_2XLARGE
|
* @see InstanceType#M2_2XLARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m2_2xlarge() {
|
public static EC2HardwareBuilder m2_2xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M2_2XLARGE)
|
return new EC2HardwareBuilder(InstanceType.M2_2XLARGE).ram(35020).processors(
|
||||||
.ram(35020)
|
ImmutableList.of(new Processor(4.0, 3.25))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(4.0, 3.25)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
|
||||||
"/dev/sdb", false, false))).is64Bit(true);
|
"/dev/sdb", false, false))).is64Bit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,11 +270,9 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#M2_4XLARGE
|
* @see InstanceType#M2_4XLARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder m2_4xlarge() {
|
public static EC2HardwareBuilder m2_4xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.M2_4XLARGE)
|
return new EC2HardwareBuilder(InstanceType.M2_4XLARGE).ram(70041).processors(
|
||||||
.ram(70041)
|
ImmutableList.of(new Processor(8.0, 3.25))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(8.0, 3.25)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
|
||||||
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false))).is64Bit(true);
|
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false))).is64Bit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +280,9 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#C1_MEDIUM
|
* @see InstanceType#C1_MEDIUM
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder c1_medium() {
|
public static EC2HardwareBuilder c1_medium() {
|
||||||
return new EC2HardwareBuilder(InstanceType.C1_MEDIUM)
|
return new EC2HardwareBuilder(InstanceType.C1_MEDIUM).ram(1740).processors(
|
||||||
.ram(1740)
|
ImmutableList.of(new Processor(2.0, 2.5))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(2.0, 2.5)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(340.0f,
|
|
||||||
"/dev/sda2", false, false))).is64Bit(false);
|
"/dev/sda2", false, false))).is64Bit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,23 +290,36 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
||||||
* @see InstanceType#C1_XLARGE
|
* @see InstanceType#C1_XLARGE
|
||||||
*/
|
*/
|
||||||
public static EC2HardwareBuilder c1_xlarge() {
|
public static EC2HardwareBuilder c1_xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.C1_XLARGE)
|
return new EC2HardwareBuilder(InstanceType.C1_XLARGE).ram(7168).processors(
|
||||||
.ram(7168)
|
ImmutableList.of(new Processor(8.0, 2.5))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(8.0, 2.5)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
||||||
.volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(420.0f,
|
|
||||||
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false), new VolumeImpl(
|
"/dev/sdb", false, false), new VolumeImpl(420.0f, "/dev/sdc", false, false), new VolumeImpl(
|
||||||
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false)))
|
420.0f, "/dev/sdd", false, false), new VolumeImpl(420.0f, "/dev/sde", false, false))).is64Bit(
|
||||||
.is64Bit(true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EC2HardwareBuilder cc1_4xlarge() {
|
public static EC2HardwareBuilder cc1_4xlarge() {
|
||||||
return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE)
|
return new EC2HardwareBuilder(InstanceType.CC1_4XLARGE).ram(23 * 1024).processors(
|
||||||
.ram(23 * 1024)
|
ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0))).volumes(
|
||||||
.processors(ImmutableList.of(new Processor(4.0, 4.0), new Processor(4.0, 4.0)))
|
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
||||||
.volumes(
|
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false)))
|
||||||
ImmutableList.<Volume> of(new VolumeImpl(10.0f, "/dev/sda1", true, false), new VolumeImpl(840.0f,
|
.virtualizationType(VirtualizationType.HVM);
|
||||||
"/dev/sdb", false, false), new VolumeImpl(840.0f, "/dev/sdc", false, false)));
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public Hardware build() {
|
||||||
|
boolean reset = false;
|
||||||
|
if (this.supportsImage == null)
|
||||||
|
reset = true;
|
||||||
|
try {
|
||||||
|
supportsImage = Predicates.<Image> and(rootDeviceType, virtualizationType, imageIds, is64Bit);
|
||||||
|
return super.build();
|
||||||
|
} finally {
|
||||||
|
if (reset)
|
||||||
|
this.supportsImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.collect.Memoized;
|
import org.jclouds.collect.Memoized;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
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.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
|
@ -91,14 +91,14 @@ public class EC2ImageParser implements Function<org.jclouds.ec2.domain.Image, Im
|
||||||
builder.userMetadata(ImmutableMap.<String, String> of("owner", from.getImageOwnerId(), "rootDeviceType", from
|
builder.userMetadata(ImmutableMap.<String, String> of("owner", from.getImageOwnerId(), "rootDeviceType", from
|
||||||
.getRootDeviceType().toString()));
|
.getRootDeviceType().toString()));
|
||||||
|
|
||||||
OperatingSystemBuilder osBuilder = new OperatingSystemBuilder();
|
OperatingSystem.Builder osBuilder = OperatingSystem.builder();
|
||||||
osBuilder.is64Bit(from.getArchitecture() == Architecture.X86_64);
|
osBuilder.is64Bit(from.getArchitecture() == Architecture.X86_64);
|
||||||
OsFamily family = parseOsFamilyOrUnrecognized(from.getImageLocation());
|
OsFamily family = parseOsFamilyOrUnrecognized(from.getImageLocation());
|
||||||
osBuilder.family(family);
|
osBuilder.family(family);
|
||||||
osBuilder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, from.getImageLocation(),
|
osBuilder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, from.getImageLocation(),
|
||||||
osVersionMap));
|
osVersionMap));
|
||||||
osBuilder.description(from.getImageLocation());
|
osBuilder.description(from.getImageLocation());
|
||||||
osBuilder.arch(from.getVirtualizationType());
|
osBuilder.arch(from.getVirtualizationType().value());
|
||||||
|
|
||||||
reviseParsedImage.reviseParsedImage(from, builder, family, osBuilder);
|
reviseParsedImage.reviseParsedImage(from, builder, family, osBuilder);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ package org.jclouds.ec2.compute.strategy;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
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 com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
@ -36,14 +36,14 @@ import com.google.inject.ImplementedBy;
|
||||||
@ImplementedBy(ReviseParsedImage.NoopReviseParsedImage.class)
|
@ImplementedBy(ReviseParsedImage.NoopReviseParsedImage.class)
|
||||||
public interface ReviseParsedImage {
|
public interface ReviseParsedImage {
|
||||||
void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
||||||
OperatingSystemBuilder osBuilder);
|
OperatingSystem.Builder osBuilder);
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public static class NoopReviseParsedImage implements ReviseParsedImage {
|
public static class NoopReviseParsedImage implements ReviseParsedImage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
||||||
OperatingSystemBuilder osBuilder) {
|
OperatingSystem.Builder osBuilder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -61,9 +61,9 @@ public class Image implements Comparable<Image> {
|
||||||
@Nullable
|
@Nullable
|
||||||
private final String rootDeviceName;
|
private final String rootDeviceName;
|
||||||
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
||||||
private final String virtualizationType;
|
private final VirtualizationType virtualizationType;
|
||||||
|
|
||||||
public String getVirtualizationType() {
|
public VirtualizationType getVirtualizationType() {
|
||||||
return virtualizationType;
|
return virtualizationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class Image implements Comparable<Image> {
|
||||||
String imageId, String imageLocation, String imageOwnerId, ImageState imageState, ImageType imageType,
|
String imageId, String imageLocation, String imageOwnerId, ImageState imageState, ImageType imageType,
|
||||||
boolean isPublic, Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform,
|
boolean isPublic, Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform,
|
||||||
@Nullable String ramdiskId, RootDeviceType rootDeviceType, @Nullable String rootDeviceName,
|
@Nullable String ramdiskId, RootDeviceType rootDeviceType, @Nullable String rootDeviceName,
|
||||||
Map<String, EbsBlockDevice> ebsBlockDevices, String virtualizationType) {
|
Map<String, EbsBlockDevice> ebsBlockDevices, VirtualizationType virtualizationType) {
|
||||||
this.region = checkNotNull(region, "region");
|
this.region = checkNotNull(region, "region");
|
||||||
this.architecture = checkNotNull(architecture, "architecture");
|
this.architecture = checkNotNull(architecture, "architecture");
|
||||||
this.imageId = checkNotNull(imageId, "imageId");
|
this.imageId = checkNotNull(imageId, "imageId");
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.ec2.domain;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtualization type of the image.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public enum VirtualizationType {
|
||||||
|
|
||||||
|
PARAVIRTUAL,
|
||||||
|
|
||||||
|
HVM, UNRECOGNIZED;
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return value();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VirtualizationType fromValue(String v) {
|
||||||
|
try {
|
||||||
|
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, v));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ import javax.inject.Inject;
|
||||||
import org.jclouds.aws.util.AWSUtils;
|
import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.ec2.domain.Image;
|
import org.jclouds.ec2.domain.Image;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
|
import org.jclouds.ec2.domain.VirtualizationType;
|
||||||
import org.jclouds.ec2.domain.Image.Architecture;
|
import org.jclouds.ec2.domain.Image.Architecture;
|
||||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
||||||
import org.jclouds.ec2.domain.Image.ImageState;
|
import org.jclouds.ec2.domain.Image.ImageState;
|
||||||
|
@ -46,8 +47,7 @@ import com.google.common.collect.Sets;
|
||||||
* DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
* DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href=
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Set<Image>> {
|
public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Set<Image>> {
|
||||||
|
@ -86,7 +86,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR
|
||||||
private Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
private Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
private String snapshotId;
|
private String snapshotId;
|
||||||
private String virtualizationType = "paravirtual";
|
private VirtualizationType virtualizationType = VirtualizationType.PARAVIRTUAL;
|
||||||
|
|
||||||
private int volumeSize;
|
private int volumeSize;
|
||||||
private boolean deleteOnTermination = true;// correct default is true.
|
private boolean deleteOnTermination = true;// correct default is true.
|
||||||
|
@ -150,7 +150,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR
|
||||||
} else if (qName.equals("rootDeviceName")) {
|
} else if (qName.equals("rootDeviceName")) {
|
||||||
rootDeviceName = currentText.toString().trim();
|
rootDeviceName = currentText.toString().trim();
|
||||||
} else if (qName.equals("virtualizationType")) {
|
} else if (qName.equals("virtualizationType")) {
|
||||||
virtualizationType = currentText.toString().trim();
|
virtualizationType = VirtualizationType.fromValue(currentText.toString().trim());
|
||||||
} else if (qName.equals("item")) {
|
} else if (qName.equals("item")) {
|
||||||
if (inBlockDeviceMapping) {
|
if (inBlockDeviceMapping) {
|
||||||
ebsBlockDevices.put(deviceName, new Image.EbsBlockDevice(snapshotId, volumeSize, deleteOnTermination));
|
ebsBlockDevices.put(deviceName, new Image.EbsBlockDevice(snapshotId, volumeSize, deleteOnTermination));
|
||||||
|
@ -164,8 +164,8 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR
|
||||||
if (region == null)
|
if (region == null)
|
||||||
region = defaultRegion;
|
region = defaultRegion;
|
||||||
contents.add(new Image(region, architecture, this.name, description, imageId, imageLocation,
|
contents.add(new Image(region, architecture, this.name, description, imageId, imageLocation,
|
||||||
imageOwnerId, imageState, imageType, isPublic, productCodes, kernelId, platform, ramdiskId,
|
imageOwnerId, imageState, imageType, isPublic, productCodes, kernelId, platform, ramdiskId,
|
||||||
rootDeviceType, rootDeviceName, ebsBlockDevices, virtualizationType));
|
rootDeviceType, rootDeviceName, ebsBlockDevices, virtualizationType));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
logger.warn(e, "malformed image: %s", imageId);
|
logger.warn(e, "malformed image: %s", imageId);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR
|
||||||
this.rootDeviceType = RootDeviceType.INSTANCE_STORE;
|
this.rootDeviceType = RootDeviceType.INSTANCE_STORE;
|
||||||
this.rootDeviceName = null;
|
this.rootDeviceName = null;
|
||||||
this.ebsBlockDevices = Maps.newHashMap();
|
this.ebsBlockDevices = Maps.newHashMap();
|
||||||
this.virtualizationType = "paravirtual";
|
this.virtualizationType = VirtualizationType.PARAVIRTUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class EC2TemplateBuilderTest {
|
||||||
// assert m2_xlarge().build().equals(template.getHardware()) : format(
|
// assert m2_xlarge().build().equals(template.getHardware()) : format(
|
||||||
// "Incorrect image determined by the template. Expected: %s. Found: %s.", "m2.xlarge",
|
// "Incorrect image determined by the template. Expected: %s. Found: %s.", "m2.xlarge",
|
||||||
// String.valueOf(template.getHardware()));
|
// String.valueOf(template.getHardware()));
|
||||||
assertEquals(m2_xlarge().build(), template.getHardware());
|
assertEquals(m2_xlarge().build().getId(), template.getHardware().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -100,15 +100,15 @@ public class EC2TemplateBuilderTest {
|
||||||
|
|
||||||
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.";
|
||||||
assert CC1_4XLARGE.equals(template.getHardware()) : format(
|
assert CC1_4XLARGE.equals(template.getHardware()) : format(
|
||||||
"Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE.getId(), String
|
"Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE.getId(), template
|
||||||
.valueOf(template.getHardware()));
|
.getHardware().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
||||||
* on physical attributes (# of cores, ram, etc).
|
* on physical attributes (# of cores, ram, etc).
|
||||||
*
|
*
|
||||||
* Expected size: m2.xlarge
|
* Expected size: CC1_4XLARGE
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTemplateChoiceForInstanceByAttributes() throws Exception {
|
public void testTemplateChoiceForInstanceByAttributes() throws Exception {
|
||||||
|
@ -116,9 +116,7 @@ public class EC2TemplateBuilderTest {
|
||||||
"us-east-1").build();
|
"us-east-1").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.";
|
||||||
assert CC1_4XLARGE.equals(template.getHardware()) : format(
|
assertEquals(template.getHardware().getId(), "cc1.4xlarge");
|
||||||
"Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE, String
|
|
||||||
.valueOf(template.getHardware()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,8 +134,8 @@ public class EC2TemplateBuilderTest {
|
||||||
|
|
||||||
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.";
|
||||||
assert !m2_xlarge().build().equals(template.getHardware()) : format(
|
assert !m2_xlarge().build().equals(template.getHardware()) : format(
|
||||||
"Incorrect image determined by the template. Expected: not %s. Found: %s.", "m2.xlarge", String
|
"Incorrect image determined by the template. Expected: not %s. Found: %s.", "m2.xlarge", template
|
||||||
.valueOf(template.getHardware()));
|
.getHardware().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -149,15 +147,19 @@ public class EC2TemplateBuilderTest {
|
||||||
|
|
||||||
expect(optionsProvider.get()).andReturn(defaultOptions);
|
expect(optionsProvider.get()).andReturn(defaultOptions);
|
||||||
|
|
||||||
Image image = new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
|
|
||||||
.operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", null, "ubuntu", true)).description(
|
|
||||||
"description").version("1.0").defaultCredentials(new Credentials("root", null)).build();
|
|
||||||
replay(optionsProvider);
|
replay(optionsProvider);
|
||||||
replay(templateBuilderProvider);
|
replay(templateBuilderProvider);
|
||||||
Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
||||||
.<Location> of(location));
|
.<Location> of(location));
|
||||||
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> of(image));
|
new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
|
||||||
|
.operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
|
||||||
|
.description("description").version("1.0").defaultCredentials(new Credentials("root", null))
|
||||||
|
.build(), new ImageBuilder().providerId("normal-image").name("image").id("us-east-1/cc-image")
|
||||||
|
.location(location).operatingSystem(
|
||||||
|
new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "paravirtual", "ubuntu", true))
|
||||||
|
.description("description").version("1.0").defaultCredentials(new Credentials("root", null))
|
||||||
|
.build()));
|
||||||
Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
|
||||||
.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large().build(),
|
.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large().build(),
|
||||||
m1_small().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
|
m1_small().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.jclouds.compute.domain.Hardware;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
@ -138,7 +139,7 @@ public class RunningInstanceToNodeMetadataTest {
|
||||||
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.RUNNING).privateAddresses(
|
assertEquals(parser.apply(server), new NodeMetadataBuilder().state(NodeState.RUNNING).privateAddresses(
|
||||||
ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68")).imageId(
|
ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68")).imageId(
|
||||||
"us-east-1/ami-82e4b5c7").hardware(m1_small().build()).operatingSystem(
|
"us-east-1/ami-82e4b5c7").hardware(m1_small().build()).operatingSystem(
|
||||||
new OperatingSystemBuilder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual").description(
|
new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).version("").arch("paravirtual").description(
|
||||||
"137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).id("us-east-1/i-0799056f")
|
"137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).id("us-east-1/i-0799056f")
|
||||||
.providerId("i-0799056f").location(provider).build());
|
.providerId("i-0799056f").location(provider).build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class EC2TemplateBuilderImplTest extends TemplateBuilderImplTest {
|
||||||
expect(os.getVersion()).andReturn(null).atLeastOnce();
|
expect(os.getVersion()).andReturn(null).atLeastOnce();
|
||||||
expect(os.getFamily()).andReturn(null).atLeastOnce();
|
expect(os.getFamily()).andReturn(null).atLeastOnce();
|
||||||
expect(os.getDescription()).andReturn(null).atLeastOnce();
|
expect(os.getDescription()).andReturn(null).atLeastOnce();
|
||||||
expect(os.getArch()).andReturn(null).atLeastOnce();
|
expect(os.getArch()).andReturn("paravirtual").atLeastOnce();
|
||||||
expect(os.is64Bit()).andReturn(false).atLeastOnce();
|
expect(os.is64Bit()).andReturn(false).atLeastOnce();
|
||||||
|
|
||||||
replay(knownImage);
|
replay(knownImage);
|
||||||
|
|
|
@ -26,11 +26,12 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.ec2.compute.functions.EC2ImageParserTest;
|
import org.jclouds.ec2.compute.functions.EC2ImageParserTest;
|
||||||
import org.jclouds.ec2.domain.Image;
|
import org.jclouds.ec2.domain.Image;
|
||||||
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
|
import org.jclouds.ec2.domain.VirtualizationType;
|
||||||
import org.jclouds.ec2.domain.Image.Architecture;
|
import org.jclouds.ec2.domain.Image.Architecture;
|
||||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
||||||
import org.jclouds.ec2.domain.Image.ImageState;
|
import org.jclouds.ec2.domain.Image.ImageState;
|
||||||
import org.jclouds.ec2.domain.Image.ImageType;
|
import org.jclouds.ec2.domain.Image.ImageType;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.config.SaxParserModule;
|
import org.jclouds.http.functions.config.SaxParserModule;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
|
@ -53,9 +54,10 @@ public class DescribeImagesResponseHandlerTest {
|
||||||
|
|
||||||
public void testUNIX() {
|
public void testUNIX() {
|
||||||
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.I386, null, null, "ami-be3adfd7",
|
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.I386, null, null, "ami-be3adfd7",
|
||||||
"ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml", "206029621532", ImageState.AVAILABLE,
|
"ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml", "206029621532", ImageState.AVAILABLE,
|
||||||
ImageType.MACHINE, false, Sets.<String> newHashSet("9961934F"), "aki-4438dd2d", null, "ari-4538dd2c",
|
ImageType.MACHINE, false, Sets.<String> newHashSet("9961934F"), "aki-4438dd2d", null, "ari-4538dd2c",
|
||||||
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(), "paravirtual"));
|
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(),
|
||||||
|
VirtualizationType.PARAVIRTUAL));
|
||||||
|
|
||||||
Set<Image> result = parseImages("/describe_images.xml");
|
Set<Image> result = parseImages("/describe_images.xml");
|
||||||
|
|
||||||
|
@ -64,9 +66,10 @@ public class DescribeImagesResponseHandlerTest {
|
||||||
|
|
||||||
public void testWindows() {
|
public void testWindows() {
|
||||||
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.X86_64, null, null, "ami-02eb086b",
|
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.X86_64, null, null, "ami-02eb086b",
|
||||||
"aws-solutions-amis/SqlSvrStd2003r2-x86_64-Win_SFWBasic5.1-v1.0.manifest.xml", "771350841976",
|
"aws-solutions-amis/SqlSvrStd2003r2-x86_64-Win_SFWBasic5.1-v1.0.manifest.xml", "771350841976",
|
||||||
ImageState.AVAILABLE, ImageType.MACHINE, true, Sets.<String> newHashSet("5771E9A6"), null, "windows", null,
|
ImageState.AVAILABLE, ImageType.MACHINE, true, Sets.<String> newHashSet("5771E9A6"), null, "windows",
|
||||||
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(), "paravirtual"));
|
null, RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(),
|
||||||
|
VirtualizationType.PARAVIRTUAL));
|
||||||
|
|
||||||
Set<Image> result = parseImages("/describe_images_windows.xml");
|
Set<Image> result = parseImages("/describe_images_windows.xml");
|
||||||
|
|
||||||
|
@ -75,10 +78,11 @@ public class DescribeImagesResponseHandlerTest {
|
||||||
|
|
||||||
public void testEBS() {
|
public void testEBS() {
|
||||||
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.I386, "websrv_2009-12-10",
|
Set<Image> contents = ImmutableSet.of(new Image("us-east-1", Architecture.I386, "websrv_2009-12-10",
|
||||||
"Web Server AMI", "ami-246f8d4d", "706093390852/websrv_2009-12-10", "706093390852", ImageState.AVAILABLE,
|
"Web Server AMI", "ami-246f8d4d", "706093390852/websrv_2009-12-10", "706093390852",
|
||||||
ImageType.MACHINE, true, Sets.<String> newHashSet(), null, "windows", null, RootDeviceType.EBS,
|
ImageState.AVAILABLE, ImageType.MACHINE, true, Sets.<String> newHashSet(), null, "windows", null,
|
||||||
"/dev/sda1", ImmutableMap.<String, EbsBlockDevice> of("/dev/sda1", new EbsBlockDevice("snap-d01272b9", 30,
|
RootDeviceType.EBS, "/dev/sda1", ImmutableMap.<String, EbsBlockDevice> of("/dev/sda1",
|
||||||
true), "xvdf", new EbsBlockDevice("snap-d31272ba", 250, false)), "hvm"));
|
new EbsBlockDevice("snap-d01272b9", 30, true), "xvdf", new EbsBlockDevice("snap-d31272ba", 250,
|
||||||
|
false)), VirtualizationType.HVM));
|
||||||
|
|
||||||
Set<Image> result = parseImages("/describe_images_ebs.xml");
|
Set<Image> result = parseImages("/describe_images_ebs.xml");
|
||||||
|
|
||||||
|
@ -95,7 +99,7 @@ public class DescribeImagesResponseHandlerTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
ParseSax<Set<Image>> parser = (ParseSax<Set<Image>>) injector.getInstance(ParseSax.Factory.class).create(
|
ParseSax<Set<Image>> parser = (ParseSax<Set<Image>>) injector.getInstance(ParseSax.Factory.class).create(
|
||||||
injector.getInstance(DescribeImagesResponseHandler.class));
|
injector.getInstance(DescribeImagesResponseHandler.class));
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,10 @@ import com.google.common.collect.Lists;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class HardwareBuilder extends ComputeMetadataBuilder {
|
public class HardwareBuilder extends ComputeMetadataBuilder {
|
||||||
private List<Processor> processors = Lists.newArrayList();
|
protected List<Processor> processors = Lists.newArrayList();
|
||||||
private int ram;
|
protected int ram;
|
||||||
private List<Volume> volumes = Lists.newArrayList();
|
protected List<Volume> volumes = Lists.newArrayList();
|
||||||
private Predicate<Image> supportsImage = any();
|
protected Predicate<Image> supportsImage = any();
|
||||||
|
|
||||||
public HardwareBuilder() {
|
public HardwareBuilder() {
|
||||||
super(ComputeType.HARDWARE);
|
super(ComputeType.HARDWARE);
|
||||||
|
|
|
@ -118,43 +118,4 @@ public class HardwareImpl extends ComputeMetadataImpl implements Hardware {
|
||||||
return supportsImage;
|
return supportsImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = super.hashCode();
|
|
||||||
result = prime * result + ((processors == null) ? 0 : processors.hashCode());
|
|
||||||
result = prime * result + ram;
|
|
||||||
result = prime * result + ((supportsImage == null) ? 0 : supportsImage.hashCode());
|
|
||||||
result = prime * result + ((volumes == null) ? 0 : volumes.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (!super.equals(obj))
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
HardwareImpl other = (HardwareImpl) obj;
|
|
||||||
if (processors == null) {
|
|
||||||
if (other.processors != null)
|
|
||||||
return false;
|
|
||||||
} else if (!processors.equals(other.processors))
|
|
||||||
return false;
|
|
||||||
if (ram != other.ram)
|
|
||||||
return false;
|
|
||||||
if (supportsImage == null) {
|
|
||||||
if (other.supportsImage != null)
|
|
||||||
return false;
|
|
||||||
} else if (!supportsImage.equals(other.supportsImage))
|
|
||||||
return false;
|
|
||||||
if (volumes == null) {
|
|
||||||
if (other.volumes != null)
|
|
||||||
return false;
|
|
||||||
} else if (!volumes.equals(other.volumes))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
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.compute.util.ComputeServiceUtils;
|
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||||
|
@ -78,7 +78,7 @@ public class AWSEC2ReviseParsedImage implements ReviseParsedImage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
||||||
OperatingSystemBuilder osBuilder) {
|
OperatingSystem.Builder osBuilder) {
|
||||||
try {
|
try {
|
||||||
Matcher matcher = getMatcherAndFind(from.getImageLocation());
|
Matcher matcher = getMatcherAndFind(from.getImageLocation());
|
||||||
if (matcher.pattern() == AMZN_PATTERN) {
|
if (matcher.pattern() == AMZN_PATTERN) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(template.getHardware()), 1.0d);
|
assertEquals(getCores(template.getHardware()), 1.0d);
|
||||||
assertEquals(template.getHardware().getId(), InstanceType.M1_SMALL);
|
assertEquals(template.getHardware().getId(), InstanceType.M1_SMALL);
|
||||||
|
assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -108,7 +108,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(template.getHardware()), 4.0d);
|
assertEquals(getCores(template.getHardware()), 4.0d);
|
||||||
assertEquals(template.getHardware().getId(), InstanceType.M2_2XLARGE);
|
assertEquals(template.getHardware().getId(), InstanceType.M2_2XLARGE);
|
||||||
|
assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -116,27 +116,27 @@ 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-beta");
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1");
|
||||||
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");
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFastestTemplateBuilder() throws IOException {
|
public void testFastestTemplateBuilder() throws IOException {
|
||||||
|
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().fastest().build();
|
Template fastestTemplate = context.getComputeService().templateBuilder().fastest().build();
|
||||||
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1-beta");
|
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.02.1-beta");
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
||||||
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 8.0d);
|
assertEquals(getCores(fastestTemplate.getHardware()), 8.0d);
|
||||||
|
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -152,7 +152,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
assertEquals(microTemplate.getLocation().getId(), "us-east-1");
|
assertEquals(microTemplate.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(microTemplate.getHardware()), 1.0d);
|
assertEquals(getCores(microTemplate.getHardware()), 1.0d);
|
||||||
|
assertEquals(microTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -105,24 +105,24 @@ public class SpotInstanceClientLiveTest {
|
||||||
public void setupClient() throws FileNotFoundException, IOException {
|
public void setupClient() throws FileNotFoundException, IOException {
|
||||||
setupCredentials();
|
setupCredentials();
|
||||||
Properties overrides = setupProperties();
|
Properties overrides = setupProperties();
|
||||||
context = new ComputeServiceContextFactory().createContext(provider,
|
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||||
|
|
||||||
client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
|
client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
|
||||||
activeTester = new RetryablePredicate<SpotInstanceRequest>(new SpotInstanceRequestActive(client),
|
activeTester = new RetryablePredicate<SpotInstanceRequest>(new SpotInstanceRequestActive(client),
|
||||||
SPOT_DELAY_SECONDS, 1, 1, TimeUnit.SECONDS);
|
SPOT_DELAY_SECONDS, 1, 1, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDescribeSpotRequestsInRegion() {
|
void testDescribeSpotRequestsInRegion() {
|
||||||
for (String region : Region.DEFAULT_REGIONS) {
|
for (String region : Region.DEFAULT_REGIONS) {
|
||||||
SortedSet<SpotInstanceRequest> allResults = ImmutableSortedSet.copyOf(client.getSpotInstanceServices()
|
SortedSet<SpotInstanceRequest> allResults = ImmutableSortedSet.copyOf(client.getSpotInstanceServices()
|
||||||
.describeSpotInstanceRequestsInRegion(region));
|
.describeSpotInstanceRequestsInRegion(region));
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
if (allResults.size() >= 1) {
|
if (allResults.size() >= 1) {
|
||||||
SpotInstanceRequest request = allResults.last();
|
SpotInstanceRequest request = allResults.last();
|
||||||
SortedSet<SpotInstanceRequest> result = ImmutableSortedSet.copyOf(client.getSpotInstanceServices()
|
SortedSet<SpotInstanceRequest> result = ImmutableSortedSet.copyOf(client.getSpotInstanceServices()
|
||||||
.describeSpotInstanceRequestsInRegion(region, request.getId()));
|
.describeSpotInstanceRequestsInRegion(region, request.getId()));
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
SpotInstanceRequest compare = result.last();
|
SpotInstanceRequest compare = result.last();
|
||||||
assertEquals(compare, request);
|
assertEquals(compare, request);
|
||||||
|
@ -142,8 +142,8 @@ public class SpotInstanceClientLiveTest {
|
||||||
assertEquals(spot.getRegion(), region);
|
assertEquals(spot.getRegion(), region);
|
||||||
assert in(ImmutableSet.of("Linux/UNIX", "SUSE Linux", "Windows")).apply(spot.getProductDescription()) : spot;
|
assert in(ImmutableSet.of("Linux/UNIX", "SUSE Linux", "Windows")).apply(spot.getProductDescription()) : spot;
|
||||||
assert in(
|
assert in(
|
||||||
ImmutableSet.of("c1.medium", "c1.xlarge", "m1.large", "m1.small", "m1.xlarge", "m2.2xlarge",
|
ImmutableSet.of("c1.medium", "c1.xlarge", "c1g.4xlarge", "m1.large", "m1.small", "m1.xlarge",
|
||||||
"m2.4xlarge", "m2.xlarge", "t1.micro")).apply(spot.getInstanceType()) : spot;
|
"m2.2xlarge", "m2.4xlarge", "m2.xlarge", "t1.micro")).apply(spot.getInstanceType()) : spot;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,18 +154,18 @@ public class SpotInstanceClientLiveTest {
|
||||||
void testCreateSpotInstance() {
|
void testCreateSpotInstance() {
|
||||||
String launchGroup = PREFIX + "1";
|
String launchGroup = PREFIX + "1";
|
||||||
for (SpotInstanceRequest request : client.getSpotInstanceServices().describeSpotInstanceRequestsInRegion(
|
for (SpotInstanceRequest request : client.getSpotInstanceServices().describeSpotInstanceRequestsInRegion(
|
||||||
"us-west-1"))
|
"us-west-1"))
|
||||||
if (launchGroup.equals(request.getLaunchGroup()))
|
if (launchGroup.equals(request.getLaunchGroup()))
|
||||||
client.getSpotInstanceServices().cancelSpotInstanceRequestsInRegion("us-west-1", request.getId());
|
client.getSpotInstanceServices().cancelSpotInstanceRequestsInRegion("us-west-1", request.getId());
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
|
|
||||||
requests = client.getSpotInstanceServices().requestSpotInstancesInRegion(
|
requests = client.getSpotInstanceServices().requestSpotInstancesInRegion(
|
||||||
"us-west-1",
|
"us-west-1",
|
||||||
0.03f,
|
0.03f,
|
||||||
1,
|
1,
|
||||||
LaunchSpecification.builder().imageId("ami-595a0a1c").instanceType(InstanceType.T1_MICRO).build(),
|
LaunchSpecification.builder().imageId("ami-595a0a1c").instanceType(InstanceType.T1_MICRO).build(),
|
||||||
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(new Date())
|
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(new Date()).validUntil(
|
||||||
.validUntil(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));
|
new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));
|
||||||
assertNotNull(requests);
|
assertNotNull(requests);
|
||||||
|
|
||||||
for (SpotInstanceRequest request : requests)
|
for (SpotInstanceRequest request : requests)
|
||||||
|
@ -181,13 +181,13 @@ public class SpotInstanceClientLiveTest {
|
||||||
spot = refresh(request);
|
spot = refresh(request);
|
||||||
assert spot.getInstanceId() != null : spot;
|
assert spot.getInstanceId() != null : spot;
|
||||||
instance = getOnlyElement(getOnlyElement(client.getInstanceServices().describeInstancesInRegion("us-west-1",
|
instance = getOnlyElement(getOnlyElement(client.getInstanceServices().describeInstancesInRegion("us-west-1",
|
||||||
spot.getInstanceId())));
|
spot.getInstanceId())));
|
||||||
assertEquals(instance.getSpotInstanceRequestId(), spot.getId());
|
assertEquals(instance.getSpotInstanceRequestId(), spot.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpotInstanceRequest refresh(SpotInstanceRequest request) {
|
public SpotInstanceRequest refresh(SpotInstanceRequest request) {
|
||||||
return getOnlyElement(client.getSpotInstanceServices().describeSpotInstanceRequestsInRegion("us-west-1",
|
return getOnlyElement(client.getSpotInstanceServices().describeSpotInstanceRequestsInRegion("us-west-1",
|
||||||
request.getId()));
|
request.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String PREFIX = System.getProperty("user.name") + "ec2";
|
public static final String PREFIX = System.getProperty("user.name") + "ec2";
|
||||||
|
|
|
@ -32,7 +32,7 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
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.compute.util.ComputeServiceUtils;
|
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||||
|
@ -62,7 +62,7 @@ public class EucalyptusPartnerCloudReviseParsedImage implements ReviseParsedImag
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
|
||||||
OperatingSystemBuilder osBuilder) {
|
OperatingSystem.Builder osBuilder) {
|
||||||
try {
|
try {
|
||||||
if (from.getImageLocation().startsWith("windows")) {
|
if (from.getImageLocation().startsWith("windows")) {
|
||||||
family = OsFamily.WINDOWS;
|
family = OsFamily.WINDOWS;
|
||||||
|
|
Loading…
Reference in New Issue