mirror of https://github.com/apache/jclouds.git
Issue 824:add field for hypervisor
This commit is contained in:
parent
f50e3f5b8e
commit
abeffc1119
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FlavorToHardware implements Function<Flavor, Hardware> {
|
public class FlavorToHardware implements Function<Flavor, Hardware> {
|
||||||
public Hardware apply(Flavor from) {
|
public Hardware apply(Flavor from) {
|
||||||
return new HardwareBuilder().ids(from.getId() + "").name(from.getName())
|
return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen")
|
||||||
.processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam())
|
.processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam())
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build();
|
.volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class CloudSigmaComputeServiceAdapter implements
|
||||||
return "sizeLessThanOrEqual(" + size + ")";
|
return "sizeLessThanOrEqual(" + size + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu)))
|
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
|
||||||
.volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
|
.volumes(ImmutableList.<Volume>of(new VolumeImpl(size, true, true))).build());
|
||||||
}
|
}
|
||||||
return hardware.build();
|
return hardware.build();
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
|
||||||
builder.operatingSystem(image.getOperatingSystem());
|
builder.operatingSystem(image.getOperatingSystem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.hardware(new HardwareBuilder().ids(from.getUuid())
|
builder.hardware(new HardwareBuilder().ids(from.getUuid()).hypervisor("kvm")
|
||||||
.processors(ImmutableList.of(new Processor(1, from.getCpu()))).ram(from.getMem())
|
.processors(ImmutableList.of(new Processor(1, from.getCpu()))).ram(from.getMem())
|
||||||
.volumes(Iterables.transform(from.getDevices().values(), deviceToVolume)).build());
|
.volumes(Iterables.transform(from.getDevices().values(), deviceToVolume)).build());
|
||||||
builder.state(serverStatusToNodeState.get(from.getStatus()));
|
builder.state(serverStatusToNodeState.get(from.getStatus()));
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class ServiceOfferingToHardware implements Function<ServiceOffering, Hard
|
||||||
.tags(offering.getTags())
|
.tags(offering.getTags())
|
||||||
.processors(ImmutableList.of(new Processor(offering.getCpuNumber(), offering.getCpuSpeed())))
|
.processors(ImmutableList.of(new Processor(offering.getCpuNumber(), offering.getCpuSpeed())))
|
||||||
.ram(offering.getMemory())//
|
.ram(offering.getMemory())//
|
||||||
|
// TODO: hypervisor probably from zone?
|
||||||
// TODO .volumes()
|
// TODO .volumes()
|
||||||
// displayText
|
// displayText
|
||||||
// created
|
// created
|
||||||
|
|
|
@ -35,10 +35,12 @@ import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||||
import org.jclouds.collect.FindResourceInSet;
|
import org.jclouds.collect.FindResourceInSet;
|
||||||
import org.jclouds.collect.Memoized;
|
import org.jclouds.collect.Memoized;
|
||||||
import org.jclouds.compute.domain.Hardware;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
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.Processor;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
import org.jclouds.util.InetAddresses2;
|
import org.jclouds.util.InetAddresses2;
|
||||||
|
@ -49,6 +51,7 @@ import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||||
|
@ -72,17 +75,14 @@ public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, No
|
||||||
.put(VirtualMachine.State.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
|
.put(VirtualMachine.State.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
|
||||||
|
|
||||||
private final FindLocationForVirtualMachine findLocationForVirtualMachine;
|
private final FindLocationForVirtualMachine findLocationForVirtualMachine;
|
||||||
private final FindHardwareForVirtualMachine findHardwareForVirtualMachine;
|
|
||||||
private final FindImageForVirtualMachine findImageForVirtualMachine;
|
private final FindImageForVirtualMachine findImageForVirtualMachine;
|
||||||
private final LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine;
|
private final LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VirtualMachineToNodeMetadata(FindLocationForVirtualMachine findLocationForVirtualMachine,
|
VirtualMachineToNodeMetadata(FindLocationForVirtualMachine findLocationForVirtualMachine,
|
||||||
FindHardwareForVirtualMachine findHardwareForVirtualMachine,
|
|
||||||
FindImageForVirtualMachine findImageForVirtualMachine,
|
FindImageForVirtualMachine findImageForVirtualMachine,
|
||||||
LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine) {
|
LoadingCache<Long, Set<IPForwardingRule>> getIPForwardingRulesByVirtualMachine) {
|
||||||
this.findLocationForVirtualMachine = checkNotNull(findLocationForVirtualMachine, "findLocationForVirtualMachine");
|
this.findLocationForVirtualMachine = checkNotNull(findLocationForVirtualMachine, "findLocationForVirtualMachine");
|
||||||
this.findHardwareForVirtualMachine = checkNotNull(findHardwareForVirtualMachine, "findHardwareForVirtualMachine");
|
|
||||||
this.findImageForVirtualMachine = checkNotNull(findImageForVirtualMachine, "findImageForVirtualMachine");
|
this.findImageForVirtualMachine = checkNotNull(findImageForVirtualMachine, "findImageForVirtualMachine");
|
||||||
this.getIPForwardingRulesByVirtualMachine = checkNotNull(getIPForwardingRulesByVirtualMachine,
|
this.getIPForwardingRulesByVirtualMachine = checkNotNull(getIPForwardingRulesByVirtualMachine,
|
||||||
"getIPForwardingRulesByVirtualMachine");
|
"getIPForwardingRulesByVirtualMachine");
|
||||||
|
@ -108,10 +108,15 @@ public class VirtualMachineToNodeMetadata implements Function<VirtualMachine, No
|
||||||
builder.imageId(image.getId());
|
builder.imageId(image.getId());
|
||||||
builder.operatingSystem(image.getOperatingSystem());
|
builder.operatingSystem(image.getOperatingSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Hardware hardware = findHardwareForVirtualMachine.apply(from);
|
builder.hardware(new HardwareBuilder()
|
||||||
if (hardware != null)
|
.ids(from.getServiceOfferingId() + "")
|
||||||
builder.hardware(hardware);
|
.name(from.getServiceOfferingName() + "")
|
||||||
|
// .tags() TODO
|
||||||
|
.processors(ImmutableList.of(new Processor(from.getCpuCount(), from.getCpuSpeed())))
|
||||||
|
.ram((int)from.getMemory())//
|
||||||
|
.hypervisor(from.getHypervisor())//
|
||||||
|
.build());
|
||||||
|
|
||||||
builder.state(vmStateToNodeState.get(from.getState()));
|
builder.state(vmStateToNodeState.get(from.getState()));
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.cloudstack.compute.functions.VirtualMachineToNodeMetadata.FindHardwareForVirtualMachine;
|
|
||||||
import org.jclouds.cloudstack.compute.functions.VirtualMachineToNodeMetadata.FindImageForVirtualMachine;
|
import org.jclouds.cloudstack.compute.functions.VirtualMachineToNodeMetadata.FindImageForVirtualMachine;
|
||||||
import org.jclouds.cloudstack.compute.functions.VirtualMachineToNodeMetadata.FindLocationForVirtualMachine;
|
import org.jclouds.cloudstack.compute.functions.VirtualMachineToNodeMetadata.FindLocationForVirtualMachine;
|
||||||
import org.jclouds.cloudstack.domain.IPForwardingRule;
|
import org.jclouds.cloudstack.domain.IPForwardingRule;
|
||||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||||
import org.jclouds.cloudstack.parse.ListVirtualMachinesResponseTest;
|
import org.jclouds.cloudstack.parse.ListVirtualMachinesResponseTest;
|
||||||
import org.jclouds.compute.domain.Hardware;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||||
|
@ -57,13 +57,10 @@ public class VirtualMachineToNodeMetadataTest {
|
||||||
Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
||||||
.<Location> of(ZoneToLocationTest.one, ZoneToLocationTest.two));
|
.<Location> of(ZoneToLocationTest.one, ZoneToLocationTest.two));
|
||||||
|
|
||||||
Supplier<Set<? extends Hardware>> hardwareSupplier = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
|
|
||||||
.<Hardware> of(ServiceOfferingToHardwareTest.one, ServiceOfferingToHardwareTest.two));
|
|
||||||
|
|
||||||
Supplier<Set<? extends Image>> imageSupplier = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Image>> imageSupplier = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
||||||
.<Image> of(TemplateToImageTest.one, TemplateToImageTest.two));
|
.<Image> of(TemplateToImageTest.one, TemplateToImageTest.two));
|
||||||
VirtualMachineToNodeMetadata parser = new VirtualMachineToNodeMetadata(new FindLocationForVirtualMachine(
|
VirtualMachineToNodeMetadata parser = new VirtualMachineToNodeMetadata(new FindLocationForVirtualMachine(
|
||||||
locationSupplier), new FindHardwareForVirtualMachine(hardwareSupplier), new FindImageForVirtualMachine(
|
locationSupplier), new FindImageForVirtualMachine(
|
||||||
imageSupplier), CacheBuilder.newBuilder().<Long, Set<IPForwardingRule>> build(
|
imageSupplier), CacheBuilder.newBuilder().<Long, Set<IPForwardingRule>> build(
|
||||||
new CacheLoader<Long, Set<IPForwardingRule>>() {
|
new CacheLoader<Long, Set<IPForwardingRule>>() {
|
||||||
|
|
||||||
|
@ -84,7 +81,8 @@ public class VirtualMachineToNodeMetadataTest {
|
||||||
new NodeMetadataBuilder().id("54").providerId("54").name("i-3-54-VM").group("i-3")
|
new NodeMetadataBuilder().id("54").providerId("54").name("i-3-54-VM").group("i-3")
|
||||||
.location(ZoneToLocationTest.one).state(NodeState.PENDING).hostname("i-3-54-VM")
|
.location(ZoneToLocationTest.one).state(NodeState.PENDING).hostname("i-3-54-VM")
|
||||||
.privateAddresses(ImmutableSet.of("10.1.1.18")).publicAddresses(ImmutableSet.of("1.1.1.1"))
|
.privateAddresses(ImmutableSet.of("10.1.1.18")).publicAddresses(ImmutableSet.of("1.1.1.1"))
|
||||||
.hardware(ServiceOfferingToHardwareTest.one).imageId(TemplateToImageTest.one.getId())
|
.hardware(addHypervisor(ServiceOfferingToHardwareTest.one, "XenServer"))
|
||||||
|
.imageId(TemplateToImageTest.one.getId())
|
||||||
.operatingSystem(TemplateToImageTest.one.getOperatingSystem()).build().toString());
|
.operatingSystem(TemplateToImageTest.one.getOperatingSystem()).build().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,13 +93,10 @@ public class VirtualMachineToNodeMetadataTest {
|
||||||
Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Location>> locationSupplier = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
|
||||||
.<Location> of(ZoneToLocationTest.one, ZoneToLocationTest.two));
|
.<Location> of(ZoneToLocationTest.one, ZoneToLocationTest.two));
|
||||||
|
|
||||||
Supplier<Set<? extends Hardware>> hardwareSupplier = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
|
|
||||||
.<Hardware> of(ServiceOfferingToHardwareTest.one, ServiceOfferingToHardwareTest.two));
|
|
||||||
|
|
||||||
Supplier<Set<? extends Image>> imageSupplier = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
Supplier<Set<? extends Image>> imageSupplier = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet
|
||||||
.<Image> of(TemplateToImageTest.one, TemplateToImageTest.two));
|
.<Image> of(TemplateToImageTest.one, TemplateToImageTest.two));
|
||||||
VirtualMachineToNodeMetadata parser = new VirtualMachineToNodeMetadata(new FindLocationForVirtualMachine(
|
VirtualMachineToNodeMetadata parser = new VirtualMachineToNodeMetadata(new FindLocationForVirtualMachine(
|
||||||
locationSupplier), new FindHardwareForVirtualMachine(hardwareSupplier), new FindImageForVirtualMachine(
|
locationSupplier), new FindImageForVirtualMachine(
|
||||||
imageSupplier), CacheBuilder.newBuilder().<Long, Set<IPForwardingRule>> build(
|
imageSupplier), CacheBuilder.newBuilder().<Long, Set<IPForwardingRule>> build(
|
||||||
new CacheLoader<Long, Set<IPForwardingRule>>() {
|
new CacheLoader<Long, Set<IPForwardingRule>>() {
|
||||||
|
|
||||||
|
@ -121,9 +116,14 @@ public class VirtualMachineToNodeMetadataTest {
|
||||||
node.toString(),
|
node.toString(),
|
||||||
new NodeMetadataBuilder().id("54").providerId("54").name("i-3-54-VM").group("i-3")
|
new NodeMetadataBuilder().id("54").providerId("54").name("i-3-54-VM").group("i-3")
|
||||||
.location(ZoneToLocationTest.one).state(NodeState.PENDING).hostname("i-3-54-VM")
|
.location(ZoneToLocationTest.one).state(NodeState.PENDING).hostname("i-3-54-VM")
|
||||||
.privateAddresses(ImmutableSet.of("10.1.1.18")).hardware(ServiceOfferingToHardwareTest.one)
|
.privateAddresses(ImmutableSet.of("10.1.1.18"))
|
||||||
|
.hardware(addHypervisor(ServiceOfferingToHardwareTest.one, "XenServer"))
|
||||||
.imageId(TemplateToImageTest.one.getId())
|
.imageId(TemplateToImageTest.one.getId())
|
||||||
.operatingSystem(TemplateToImageTest.one.getOperatingSystem()).build().toString());
|
.operatingSystem(TemplateToImageTest.one.getOperatingSystem()).build().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Hardware addHypervisor(Hardware in, String hypervisor) {
|
||||||
|
return HardwareBuilder.fromHardware(in).hypervisor(hypervisor).build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
</monitoring>
|
</monitoring>
|
||||||
<kernelId>aki-ba3adfd3</kernelId>
|
<kernelId>aki-ba3adfd3</kernelId>
|
||||||
<ramdiskId>ari-badbad00</ramdiskId>
|
<ramdiskId>ari-badbad00</ramdiskId>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<instanceId>i-28a64435</instanceId>
|
<instanceId>i-28a64435</instanceId>
|
||||||
|
@ -66,6 +67,7 @@
|
||||||
</monitoring>
|
</monitoring>
|
||||||
<kernelId>aki-ba3adfd3</kernelId>
|
<kernelId>aki-ba3adfd3</kernelId>
|
||||||
<ramdiskId>ari-badbad00</ramdiskId>
|
<ramdiskId>ari-badbad00</ramdiskId>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
</instancesSet>
|
</instancesSet>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
<virtualizationType>hvm</virtualizationType>
|
<virtualizationType>hvm</virtualizationType>
|
||||||
<privateIpAddress>10.210.209.157</privateIpAddress>
|
<privateIpAddress>10.210.209.157</privateIpAddress>
|
||||||
<ipAddress>75.101.203.146</ipAddress>
|
<ipAddress>75.101.203.146</ipAddress>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
<rootDeviceType>ebs</rootDeviceType>
|
<rootDeviceType>ebs</rootDeviceType>
|
||||||
<rootDeviceName>/dev/sda1</rootDeviceName>
|
<rootDeviceName>/dev/sda1</rootDeviceName>
|
||||||
<blockDeviceMapping>
|
<blockDeviceMapping>
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
</monitoring>
|
</monitoring>
|
||||||
<privateIpAddress>10.243.42.70</privateIpAddress>
|
<privateIpAddress>10.243.42.70</privateIpAddress>
|
||||||
<ipAddress>174.129.81.68</ipAddress>
|
<ipAddress>174.129.81.68</ipAddress>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
</instancesSet>
|
</instancesSet>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<monitoring>
|
<monitoring>
|
||||||
<state>enabled</state>
|
<state>enabled</state>
|
||||||
</monitoring>
|
</monitoring>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<instanceId>i-2bc64242</instanceId>
|
<instanceId>i-2bc64242</instanceId>
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
<monitoring>
|
<monitoring>
|
||||||
<state>enabled</state>
|
<state>enabled</state>
|
||||||
</monitoring>
|
</monitoring>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<instanceId>i-2be64332</instanceId>
|
<instanceId>i-2be64332</instanceId>
|
||||||
|
@ -66,6 +68,7 @@
|
||||||
<monitoring>
|
<monitoring>
|
||||||
<state>enabled</state>
|
<state>enabled</state>
|
||||||
</monitoring>
|
</monitoring>
|
||||||
|
<hypervisor>xen</hypervisor>
|
||||||
</item>
|
</item>
|
||||||
</instancesSet>
|
</instancesSet>
|
||||||
</RunInstancesResponse>
|
</RunInstancesResponse>
|
|
@ -153,7 +153,7 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
return "sizeLessThanOrEqual(" + size + ")";
|
return "sizeLessThanOrEqual(" + size + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu)))
|
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).hypervisor("kvm")
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl(size, true, true))).build());
|
.volumes(ImmutableList.<Volume> of(new VolumeImpl(size, true, true))).build());
|
||||||
}
|
}
|
||||||
return hardware.build();
|
return hardware.build();
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
|
||||||
builder.operatingSystem(image.getOperatingSystem());
|
builder.operatingSystem(image.getOperatingSystem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.hardware(new HardwareBuilder().ids(from.getUuid())
|
builder.hardware(new HardwareBuilder().ids(from.getUuid()).hypervisor("kvm")
|
||||||
.processors(ImmutableList.of(new Processor(1, from.getCpu()))).ram(from.getMem())
|
.processors(ImmutableList.of(new Processor(1, from.getCpu()))).ram(from.getMem())
|
||||||
.volumes((List) ImmutableList.of(Iterables.transform(from.getDevices().values(), deviceToVolume))).build());
|
.volumes((List) ImmutableList.of(Iterables.transform(from.getDevices().values(), deviceToVolume))).build());
|
||||||
builder.state(serverStatusToNodeState.get(from.getStatus()));
|
builder.state(serverStatusToNodeState.get(from.getStatus()));
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class HardwareForVApp implements Function<VApp, Hardware> {
|
||||||
builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
|
builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
|
||||||
builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
|
builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
|
||||||
ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
||||||
|
builder.hypervisor("VMware");
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -75,6 +75,7 @@ public class HardwareForVAppTemplate implements Function<VAppTemplate, Hardware>
|
||||||
}
|
}
|
||||||
builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
|
builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
|
||||||
ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
||||||
|
builder.hypervisor("VMware");
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class HardwareForVCloudExpressVApp implements Function<VApp, Hardware> {
|
||||||
builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
|
builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
|
||||||
builder.ids(from.getHref().toASCIIString()).name(from.getName())
|
builder.ids(from.getHref().toASCIIString()).name(from.getName())
|
||||||
.supportsImage(ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
.supportsImage(ImagePredicates.idEquals(from.getHref().toASCIIString()));
|
||||||
|
builder.hypervisor("VMware");
|
||||||
return builder.build();
|
return builder.build();
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
logger.debug("incomplete data to form vApp %s", from.getHref());
|
logger.debug("incomplete data to form vApp %s", from.getHref());
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class StaticHardwareSupplier implements Supplier<Set<? extends Hardware>>
|
||||||
for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) {
|
for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) {
|
||||||
String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10);
|
String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10);
|
||||||
hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0)))
|
hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0)))
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).build());
|
.volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).hypervisor("VMware").build());
|
||||||
}
|
}
|
||||||
return hardware;
|
return hardware;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.compute.domain;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.internal.HardwareImpl;
|
import org.jclouds.compute.domain.internal.HardwareImpl;
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
@ -42,7 +43,7 @@ public interface Hardware extends ComputeMetadata {
|
||||||
* Amount of RAM provided in MB (256M, 1740)
|
* Amount of RAM provided in MB (256M, 1740)
|
||||||
*/
|
*/
|
||||||
int getRam();
|
int getRam();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* volumes associated with this.
|
* volumes associated with this.
|
||||||
*/
|
*/
|
||||||
|
@ -53,4 +54,9 @@ public interface Hardware extends ComputeMetadata {
|
||||||
*/
|
*/
|
||||||
Predicate<Image> supportsImage();
|
Predicate<Image> supportsImage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return hypervisor type, if this is a virtual machine and the type is known
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
String getHypervisor();
|
||||||
}
|
}
|
|
@ -43,6 +43,7 @@ public class HardwareBuilder extends ComputeMetadataBuilder {
|
||||||
protected int ram;
|
protected int ram;
|
||||||
protected List<Volume> volumes = Lists.newArrayList();
|
protected List<Volume> volumes = Lists.newArrayList();
|
||||||
protected Predicate<Image> supportsImage = any();
|
protected Predicate<Image> supportsImage = any();
|
||||||
|
protected String hypervisor;
|
||||||
|
|
||||||
public HardwareBuilder() {
|
public HardwareBuilder() {
|
||||||
super(ComputeType.HARDWARE);
|
super(ComputeType.HARDWARE);
|
||||||
|
@ -78,6 +79,11 @@ public class HardwareBuilder extends ComputeMetadataBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HardwareBuilder hypervisor(String hypervisor) {
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public HardwareBuilder is64Bit(boolean is64Bit) {
|
public HardwareBuilder is64Bit(boolean is64Bit) {
|
||||||
supportsImage(is64Bit ? ImagePredicates.is64Bit() : not(ImagePredicates.is64Bit()));
|
supportsImage(is64Bit ? ImagePredicates.is64Bit() : not(ImagePredicates.is64Bit()));
|
||||||
return this;
|
return this;
|
||||||
|
@ -126,7 +132,7 @@ public class HardwareBuilder extends ComputeMetadataBuilder {
|
||||||
@Override
|
@Override
|
||||||
public Hardware build() {
|
public Hardware build() {
|
||||||
return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes,
|
return new HardwareImpl(providerId, name, id, location, uri, userMetadata, tags, processors, ram, volumes,
|
||||||
supportsImage);
|
supportsImage, hypervisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -134,6 +140,6 @@ public class HardwareBuilder extends ComputeMetadataBuilder {
|
||||||
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
|
return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name(
|
||||||
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
|
in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors(
|
||||||
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
|
List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes()))
|
||||||
.supportsImage(in.supportsImage());
|
.supportsImage(in.supportsImage()).hypervisor(in.getHypervisor());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,15 +52,17 @@ public class HardwareImpl extends ComputeMetadataImpl implements Hardware {
|
||||||
private final int ram;
|
private final int ram;
|
||||||
private final List<Volume> volumes;
|
private final List<Volume> volumes;
|
||||||
private final Predicate<Image> supportsImage;
|
private final Predicate<Image> supportsImage;
|
||||||
|
private final String hypervisor;
|
||||||
|
|
||||||
public HardwareImpl(String providerId, String name, String id, @Nullable Location location, URI uri,
|
public HardwareImpl(String providerId, String name, String id, @Nullable Location location, URI uri,
|
||||||
Map<String, String> userMetadata, Set<String> tags, Iterable<? extends Processor> processors, int ram,
|
Map<String, String> userMetadata, Set<String> tags, Iterable<? extends Processor> processors, int ram,
|
||||||
Iterable<? extends Volume> volumes, Predicate<Image> supportsImage) {
|
Iterable<? extends Volume> volumes, Predicate<Image> supportsImage, @Nullable String hypervisor) {
|
||||||
super(ComputeType.HARDWARE, providerId, name, id, location, uri, userMetadata, tags);
|
super(ComputeType.HARDWARE, providerId, name, id, location, uri, userMetadata, tags);
|
||||||
this.processors = ImmutableList.copyOf(checkNotNull(processors, "processors"));
|
this.processors = ImmutableList.copyOf(checkNotNull(processors, "processors"));
|
||||||
this.ram = ram;
|
this.ram = ram;
|
||||||
this.volumes = ImmutableList.copyOf(checkNotNull(volumes, "volumes"));
|
this.volumes = ImmutableList.copyOf(checkNotNull(volumes, "volumes"));
|
||||||
this.supportsImage = supportsImage;
|
this.supportsImage = supportsImage;
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +89,15 @@ public class HardwareImpl extends ComputeMetadataImpl implements Hardware {
|
||||||
return volumes;
|
return volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public String getHypervisor() {
|
||||||
|
return hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -94,8 +105,9 @@ public class HardwareImpl extends ComputeMetadataImpl implements Hardware {
|
||||||
public int compareTo(ResourceMetadata<ComputeType> that) {
|
public int compareTo(ResourceMetadata<ComputeType> that) {
|
||||||
if (that instanceof Hardware) {
|
if (that instanceof Hardware) {
|
||||||
Hardware thatHardware = Hardware.class.cast(that);
|
Hardware thatHardware = Hardware.class.cast(that);
|
||||||
return ComparisonChain.start().compare(getCoresAndSpeed(this), getCoresAndSpeed(thatHardware))
|
return ComparisonChain.start().compare(getCoresAndSpeed(this), getCoresAndSpeed(thatHardware)).compare(
|
||||||
.compare(this.getRam(), thatHardware.getRam()).compare(getSpace(this), getSpace(thatHardware)).result();
|
this.getRam(), thatHardware.getRam()).compare(getSpace(this), getSpace(thatHardware)).compare(
|
||||||
|
getHypervisor(), thatHardware.getHypervisor()).result();
|
||||||
} else {
|
} else {
|
||||||
return super.compareTo(that);
|
return super.compareTo(that);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +119,8 @@ public class HardwareImpl extends ComputeMetadataImpl implements Hardware {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[id=" + getId() + ", providerId=" + getProviderId() + ", name=" + getName() + ", processors="
|
return "[id=" + getId() + ", providerId=" + getProviderId() + ", name=" + getName() + ", processors="
|
||||||
+ processors + ", ram=" + ram + ", volumes=" + volumes + ", supportsImage=" + supportsImage + ", tags=" + tags + "]";
|
+ processors + ", ram=" + ram + ", volumes=" + volumes + ", hypervisor=" + hypervisor
|
||||||
|
+ ", supportsImage=" + supportsImage + ", tags=" + tags + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class IMachineToHardware implements Function<IMachine, Hardware> {
|
||||||
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId()));
|
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId()));
|
||||||
hardwareBuilder.is64Bit(is64Bit);
|
hardwareBuilder.is64Bit(is64Bit);
|
||||||
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId()));
|
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId()));
|
||||||
|
hardwareBuilder.hypervisor("VirtualBox");
|
||||||
return hardwareBuilder.build();
|
return hardwareBuilder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
||||||
import org.jclouds.collect.Memoized;
|
import org.jclouds.collect.Memoized;
|
||||||
import org.jclouds.compute.domain.Hardware;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
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;
|
||||||
|
@ -72,10 +73,19 @@ public class AWSRunningInstanceToNodeMetadata extends RunningInstanceToNodeMetad
|
||||||
if (creds != null)
|
if (creds != null)
|
||||||
builder.credentials(creds);
|
builder.credentials(creds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Hardware parseHardware(RunningInstance instance) {
|
||||||
|
Hardware in = super.parseHardware(instance);
|
||||||
|
if (in == null)
|
||||||
|
return null;
|
||||||
|
AWSRunningInstance awsInstance = AWSRunningInstance.class.cast(instance);
|
||||||
|
return HardwareBuilder.fromHardware(in).hypervisor(awsInstance.getHypervisor().toString()).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NodeMetadataBuilder buildInstance(RunningInstance instance, NodeMetadataBuilder builder) {
|
protected NodeMetadataBuilder buildInstance(RunningInstance instance, NodeMetadataBuilder builder) {
|
||||||
Map<String, String> tags = AWSRunningInstance.class.cast(instance).getTags();
|
AWSRunningInstance awsInstance = AWSRunningInstance.class.cast(instance);
|
||||||
|
Map<String, String> tags = awsInstance.getTags();
|
||||||
return super.buildInstance(instance, builder).name(tags.get("Name")).tags(
|
return super.buildInstance(instance, builder).name(tags.get("Name")).tags(
|
||||||
filterValues(tags, equalTo("")).keySet()).userMetadata(filterValues(tags, not(equalTo(""))));
|
filterValues(tags, equalTo("")).keySet()).userMetadata(filterValues(tags, not(equalTo(""))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,14 @@ import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -56,6 +57,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
private String subnetId;
|
private String subnetId;
|
||||||
private String spotInstanceRequestId;
|
private String spotInstanceRequestId;
|
||||||
private String vpcId;
|
private String vpcId;
|
||||||
|
private Hypervisor hypervisor;
|
||||||
private Map<String, String> securityGroupIdToNames = Maps.newLinkedHashMap();
|
private Map<String, String> securityGroupIdToNames = Maps.newLinkedHashMap();
|
||||||
private Map<String, String> tags = Maps.newLinkedHashMap();
|
private Map<String, String> tags = Maps.newLinkedHashMap();
|
||||||
|
|
||||||
|
@ -117,6 +119,11 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
this.vpcId = vpcId;
|
this.vpcId = vpcId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder hypervisor(Hypervisor hypervisor) {
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder amiLaunchIndex(String amiLaunchIndex) {
|
public Builder amiLaunchIndex(String amiLaunchIndex) {
|
||||||
|
@ -244,7 +251,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
instanceState, instanceType, ipAddress, kernelId, keyName, launchTime, availabilityZone,
|
instanceState, instanceType, ipAddress, kernelId, keyName, launchTime, availabilityZone,
|
||||||
virtualizationType, platform, privateDnsName, privateIpAddress, ramdiskId, reason, rootDeviceType,
|
virtualizationType, platform, privateDnsName, privateIpAddress, ramdiskId, reason, rootDeviceType,
|
||||||
rootDeviceName, ebsBlockDevices, monitoringState, placementGroup, productCodes, subnetId,
|
rootDeviceName, ebsBlockDevices, monitoringState, placementGroup, productCodes, subnetId,
|
||||||
spotInstanceRequestId, vpcId, tags);
|
spotInstanceRequestId, vpcId, hypervisor, tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -259,6 +266,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
private final String spotInstanceRequestId;
|
private final String spotInstanceRequestId;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final String vpcId;
|
private final String vpcId;
|
||||||
|
private final Hypervisor hypervisor;
|
||||||
private final Map<String, String> securityGroupIdToNames;
|
private final Map<String, String> securityGroupIdToNames;
|
||||||
private final Map<String, String> tags;
|
private final Map<String, String> tags;
|
||||||
|
|
||||||
|
@ -268,7 +276,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
String virtualizationType, String platform, String privateDnsName, String privateIpAddress, String ramdiskId,
|
String virtualizationType, String platform, String privateDnsName, String privateIpAddress, String ramdiskId,
|
||||||
String reason, RootDeviceType rootDeviceType, String rootDeviceName, Map<String, BlockDevice> ebsBlockDevices,
|
String reason, RootDeviceType rootDeviceType, String rootDeviceName, Map<String, BlockDevice> ebsBlockDevices,
|
||||||
MonitoringState monitoringState, String placementGroup, Iterable<String> productCodes, String subnetId,
|
MonitoringState monitoringState, String placementGroup, Iterable<String> productCodes, String subnetId,
|
||||||
String spotInstanceRequestId, String vpcId, Map<String, String> tags) {
|
String spotInstanceRequestId, String vpcId, Hypervisor hypervisor, Map<String, String> tags) {
|
||||||
super(region, securityGroupIdToNames.values(), amiLaunchIndex, dnsName, imageId, instanceId, instanceState,
|
super(region, securityGroupIdToNames.values(), amiLaunchIndex, dnsName, imageId, instanceId, instanceState,
|
||||||
instanceType, ipAddress, kernelId, keyName, launchTime, availabilityZone, virtualizationType, platform,
|
instanceType, ipAddress, kernelId, keyName, launchTime, availabilityZone, virtualizationType, platform,
|
||||||
privateDnsName, privateIpAddress, ramdiskId, reason, rootDeviceType, rootDeviceName, ebsBlockDevices);
|
privateDnsName, privateIpAddress, ramdiskId, reason, rootDeviceType, rootDeviceName, ebsBlockDevices);
|
||||||
|
@ -278,6 +286,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
this.subnetId = subnetId;
|
this.subnetId = subnetId;
|
||||||
this.spotInstanceRequestId = spotInstanceRequestId;
|
this.spotInstanceRequestId = spotInstanceRequestId;
|
||||||
this.vpcId = vpcId;
|
this.vpcId = vpcId;
|
||||||
|
this.hypervisor = checkNotNull(hypervisor, "hypervisor");
|
||||||
this.securityGroupIdToNames = ImmutableMap.<String, String> copyOf(checkNotNull(securityGroupIdToNames,
|
this.securityGroupIdToNames = ImmutableMap.<String, String> copyOf(checkNotNull(securityGroupIdToNames,
|
||||||
"securityGroupIdToNames"));
|
"securityGroupIdToNames"));
|
||||||
this.tags = ImmutableMap.<String, String> copyOf(checkNotNull(tags, "tags"));
|
this.tags = ImmutableMap.<String, String> copyOf(checkNotNull(tags, "tags"));
|
||||||
|
@ -323,7 +332,15 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
public String getVpcId() {
|
public String getVpcId() {
|
||||||
return vpcId;
|
return vpcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hypervisor of the VM
|
||||||
|
* @see Hypervisor
|
||||||
|
*/
|
||||||
|
public Hypervisor getHypervisor() {
|
||||||
|
return hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the subnet ID in which the instance is running (Amazon Virtual
|
* Specifies the subnet ID in which the instance is running (Amazon Virtual
|
||||||
* Private Cloud).
|
* Private Cloud).
|
||||||
|
@ -348,6 +365,7 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
result = prime * result + ((spotInstanceRequestId == null) ? 0 : spotInstanceRequestId.hashCode());
|
result = prime * result + ((spotInstanceRequestId == null) ? 0 : spotInstanceRequestId.hashCode());
|
||||||
result = prime * result + ((subnetId == null) ? 0 : subnetId.hashCode());
|
result = prime * result + ((subnetId == null) ? 0 : subnetId.hashCode());
|
||||||
result = prime * result + ((vpcId == null) ? 0 : vpcId.hashCode());
|
result = prime * result + ((vpcId == null) ? 0 : vpcId.hashCode());
|
||||||
|
result = prime * result + ((hypervisor == null) ? 0 : hypervisor.hashCode());
|
||||||
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
|
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -391,20 +409,22 @@ public class AWSRunningInstance extends RunningInstance {
|
||||||
return false;
|
return false;
|
||||||
} else if (!tags.equals(other.tags))
|
} else if (!tags.equals(other.tags))
|
||||||
return false;
|
return false;
|
||||||
|
if (!Objects.equal(hypervisor, other.hypervisor))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[region=" + region + ", availabilityZone=" + availabilityZone + ", instanceId=" + instanceId
|
return "[region=" + region + ", availabilityZone=" + availabilityZone + ", instanceId=" + instanceId
|
||||||
+ ", instanceState=" + instanceState + ", instanceType=" + instanceType + ", virtualizationType="
|
+ ", instanceState=" + instanceState + ", instanceType=" + instanceType + ", virtualizationType="
|
||||||
+ virtualizationType + ", imageId=" + imageId + ", ipAddress=" + ipAddress + ", dnsName=" + dnsName
|
+ virtualizationType + ", imageId=" + imageId + ", ipAddress=" + ipAddress + ", dnsName=" + dnsName
|
||||||
+ ", privateIpAddress=" + privateIpAddress + ", privateDnsName=" + privateDnsName + ", keyName=" + keyName
|
+ ", privateIpAddress=" + privateIpAddress + ", privateDnsName=" + privateDnsName + ", keyName="
|
||||||
+ ", platform=" + platform + ", launchTime=" + launchTime + ", rootDeviceName=" + rootDeviceName
|
+ keyName + ", platform=" + platform + ", launchTime=" + launchTime + ", rootDeviceName="
|
||||||
+ ", rootDeviceType=" + rootDeviceType + ", ebsBlockDevices=" + ebsBlockDevices + ", monitoringState="
|
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType + ", ebsBlockDevices=" + ebsBlockDevices
|
||||||
+ monitoringState + ", placementGroup=" + placementGroup + ", productCodes=" + productCodes
|
+ ", monitoringState=" + monitoringState + ", placementGroup=" + placementGroup + ", productCodes="
|
||||||
+ ", spotInstanceRequestId=" + spotInstanceRequestId + ", subnetId=" + subnetId + ", vpcId=" + vpcId
|
+ productCodes + ", spotInstanceRequestId=" + spotInstanceRequestId + ", subnetId=" + subnetId
|
||||||
+ ", tags=" + tags + "]";
|
+ ", hypervisor=" + hypervisor + ", vpcId=" + vpcId + ", tags=" + tags + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
||||||
import org.jclouds.aws.ec2.domain.LaunchSpecification;
|
import org.jclouds.aws.ec2.domain.LaunchSpecification;
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -58,6 +59,8 @@ public class SpotInstanceRequestToAWSRunningInstance implements Function<SpotIns
|
||||||
builder.ramdiskId(spec.getRamdiskId());
|
builder.ramdiskId(spec.getRamdiskId());
|
||||||
builder.monitoringState(Boolean.TRUE.equals(spec.isMonitoringEnabled()) ? MonitoringState.PENDING
|
builder.monitoringState(Boolean.TRUE.equals(spec.isMonitoringEnabled()) ? MonitoringState.PENDING
|
||||||
: MonitoringState.DISABLED);
|
: MonitoringState.DISABLED);
|
||||||
|
//TODO: determine the exact hypervisor
|
||||||
|
builder.hypervisor(Hypervisor.XEN);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RunningInstance;
|
import org.jclouds.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.location.Region;
|
import org.jclouds.location.Region;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.jclouds.aws.util.AWSUtils;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
|
@ -133,6 +134,8 @@ public abstract class BaseAWSReservationHandler<T> extends HandlerForGeneratedRe
|
||||||
builder.spotInstanceRequestId(currentOrNull(currentText));
|
builder.spotInstanceRequestId(currentOrNull(currentText));
|
||||||
} else if (equalsOrSuffix(qName, "vpcId")) {
|
} else if (equalsOrSuffix(qName, "vpcId")) {
|
||||||
builder.vpcId(currentOrNull(currentText));
|
builder.vpcId(currentOrNull(currentText));
|
||||||
|
} else if (equalsOrSuffix(qName, "hypervisor")) {
|
||||||
|
builder.hypervisor(Hypervisor.fromValue(currentOrNull(currentText)));
|
||||||
} else if (equalsOrSuffix(qName, "productCode")) {
|
} else if (equalsOrSuffix(qName, "productCode")) {
|
||||||
builder.productCode(currentOrNull(currentText));
|
builder.productCode(currentOrNull(currentText));
|
||||||
} else if (equalsOrSuffix(qName, "instancesSet")) {
|
} else if (equalsOrSuffix(qName, "instancesSet")) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||||
import org.jclouds.ec2.compute.functions.ImagesToRegionAndIdMap;
|
import org.jclouds.ec2.compute.functions.ImagesToRegionAndIdMap;
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.RootDeviceType;
|
import org.jclouds.ec2.domain.RootDeviceType;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
|
@ -101,6 +102,7 @@ public class AWSRunningInstanceToNodeMetadataTest {
|
||||||
.virtualizationType("paravirtual")
|
.virtualizationType("paravirtual")
|
||||||
.tag("Name", "foo")
|
.tag("Name", "foo")
|
||||||
.tag("Empty", "")
|
.tag("Empty", "")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.build(),//
|
.build(),//
|
||||||
new AWSRunningInstance.Builder()
|
new AWSRunningInstance.Builder()
|
||||||
.region(defaultRegion)
|
.region(defaultRegion)
|
||||||
|
@ -123,6 +125,7 @@ public class AWSRunningInstanceToNodeMetadataTest {
|
||||||
.rootDeviceName("/dev/sda1")
|
.rootDeviceName("/dev/sda1")
|
||||||
.device("/dev/sda1", new BlockDevice("vol-5029fc3a", Attachment.Status.ATTACHED, dateService.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
.device("/dev/sda1", new BlockDevice("vol-5029fc3a", Attachment.Status.ATTACHED, dateService.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
||||||
.virtualizationType("paravirtual")
|
.virtualizationType("paravirtual")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.jclouds.aws.ec2.domain.LaunchSpecification;
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ public class SpotInstanceRequestToAWSRunningInstanceTest {
|
||||||
.groupId("default").instanceType("m1.large")
|
.groupId("default").instanceType("m1.large")
|
||||||
.tag("foo", "bar")
|
.tag("foo", "bar")
|
||||||
.tag("empty", "")
|
.tag("empty", "")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.monitoringState(MonitoringState.PENDING).build());
|
.monitoringState(MonitoringState.PENDING).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
import org.jclouds.ec2.domain.Attachment;
|
import org.jclouds.ec2.domain.Attachment;
|
||||||
import org.jclouds.ec2.domain.BlockDevice;
|
import org.jclouds.ec2.domain.BlockDevice;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.InstanceType;
|
import org.jclouds.ec2.domain.InstanceType;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
|
@ -91,6 +92,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
.privateIpAddress("10.243.42.70")
|
.privateIpAddress("10.243.42.70")
|
||||||
.ramdiskId("ari-a51cf9cc")
|
.ramdiskId("ari-a51cf9cc")
|
||||||
.rootDeviceType(RootDeviceType.INSTANCE_STORE)
|
.rootDeviceType(RootDeviceType.INSTANCE_STORE)
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.build()),
|
.build()),
|
||||||
"993194456877", null, "r-a3c508cb"));
|
"993194456877", null, "r-a3c508cb"));
|
||||||
|
|
||||||
|
@ -127,6 +129,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
"/dev/sda1",
|
"/dev/sda1",
|
||||||
new BlockDevice("vol-5829fc32", Attachment.Status.ATTACHED, dateService
|
new BlockDevice("vol-5829fc32", Attachment.Status.ATTACHED, dateService
|
||||||
.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.virtualizationType("paravirtual").build(),//
|
.virtualizationType("paravirtual").build(),//
|
||||||
new AWSRunningInstance.Builder()
|
new AWSRunningInstance.Builder()
|
||||||
.region(defaultRegion)
|
.region(defaultRegion)
|
||||||
|
@ -152,6 +155,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
"/dev/sda1",
|
"/dev/sda1",
|
||||||
new BlockDevice("vol-5029fc3a", Attachment.Status.ATTACHED, dateService
|
new BlockDevice("vol-5029fc3a", Attachment.Status.ATTACHED, dateService
|
||||||
.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
.iso8601DateParse("2011-08-16T13:41:19.000Z"), true))
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.virtualizationType("paravirtual").build()), defaultRegion, defaultRegion, defaultRegion));
|
.virtualizationType("paravirtual").build()), defaultRegion, defaultRegion, defaultRegion));
|
||||||
|
|
||||||
Set<Reservation<? extends RunningInstance>> result = parseAWSRunningInstances("/describe_instances_latest.xml");
|
Set<Reservation<? extends RunningInstance>> result = parseAWSRunningInstances("/describe_instances_latest.xml");
|
||||||
|
@ -176,6 +180,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
.monitoringState(MonitoringState.DISABLED).availabilityZone("us-east-1b")
|
.monitoringState(MonitoringState.DISABLED).availabilityZone("us-east-1b")
|
||||||
.virtualizationType("paravirtual").privateDnsName("10-251-50-132.ec2.internal")
|
.virtualizationType("paravirtual").privateDnsName("10-251-50-132.ec2.internal")
|
||||||
.productCode("774F4FF8").ramdiskId("ari-badbad00")
|
.productCode("774F4FF8").ramdiskId("ari-badbad00")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.rootDeviceType(RootDeviceType.INSTANCE_STORE).build(),
|
.rootDeviceType(RootDeviceType.INSTANCE_STORE).build(),
|
||||||
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("23")
|
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("23")
|
||||||
.dnsName("ec2-72-44-33-6.compute-1.amazonaws.com").imageId("ami-6ea54007")
|
.dnsName("ec2-72-44-33-6.compute-1.amazonaws.com").imageId("ami-6ea54007")
|
||||||
|
@ -185,6 +190,7 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
.monitoringState(MonitoringState.DISABLED).availabilityZone("us-east-1b")
|
.monitoringState(MonitoringState.DISABLED).availabilityZone("us-east-1b")
|
||||||
.virtualizationType("paravirtual").privateDnsName("10-251-50-134.ec2.internal")
|
.virtualizationType("paravirtual").privateDnsName("10-251-50-134.ec2.internal")
|
||||||
.productCode("774F4FF8").ramdiskId("ari-badbad00")
|
.productCode("774F4FF8").ramdiskId("ari-badbad00")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM",
|
.rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM",
|
||||||
null, "r-44a5402d"));
|
null, "r-44a5402d"));
|
||||||
|
|
||||||
|
@ -217,8 +223,10 @@ public class AWSDescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
.privateDnsName("domU-12-31-39-09-CE-53.compute-1.internal")
|
.privateDnsName("domU-12-31-39-09-CE-53.compute-1.internal")
|
||||||
.privateIpAddress("10.210.209.157")
|
.privateIpAddress("10.210.209.157")
|
||||||
.ramdiskId("ari-a51cf9cc")
|
.ramdiskId("ari-a51cf9cc")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.rootDeviceType(RootDeviceType.EBS)
|
.rootDeviceType(RootDeviceType.EBS)
|
||||||
.rootDeviceName("/dev/sda1")
|
.rootDeviceName("/dev/sda1")
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.device(
|
.device(
|
||||||
"/dev/sda1",
|
"/dev/sda1",
|
||||||
new BlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService
|
new BlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.io.InputStream;
|
||||||
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.ec2.domain.Hypervisor;
|
||||||
import org.jclouds.ec2.domain.InstanceState;
|
import org.jclouds.ec2.domain.InstanceState;
|
||||||
import org.jclouds.ec2.domain.InstanceType;
|
import org.jclouds.ec2.domain.InstanceType;
|
||||||
import org.jclouds.ec2.domain.Reservation;
|
import org.jclouds.ec2.domain.Reservation;
|
||||||
|
@ -85,18 +86,21 @@ public class AWSRunInstancesResponseHandlerTest extends BaseEC2HandlerTest {
|
||||||
.imageId("ami-60a54009").instanceId("i-2ba64342").instanceState(InstanceState.PENDING)
|
.imageId("ami-60a54009").instanceId("i-2ba64342").instanceState(InstanceState.PENDING)
|
||||||
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
||||||
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build(),
|
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build(),
|
||||||
|
|
||||||
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("1")
|
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("1")
|
||||||
.imageId("ami-60a54009").instanceId("i-2bc64242").instanceState(InstanceState.PENDING)
|
.imageId("ami-60a54009").instanceId("i-2bc64242").instanceState(InstanceState.PENDING)
|
||||||
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
||||||
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build(),
|
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build(),
|
||||||
|
|
||||||
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("2")
|
new AWSRunningInstance.Builder().region(defaultRegion).groupId("default").amiLaunchIndex("2")
|
||||||
.imageId("ami-60a54009").instanceId("i-2be64332").instanceState(InstanceState.PENDING)
|
.imageId("ami-60a54009").instanceId("i-2be64332").instanceState(InstanceState.PENDING)
|
||||||
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
.instanceType(InstanceType.M1_SMALL).keyName("example-key-name")
|
||||||
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
.launchTime(dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))
|
||||||
|
.hypervisor(Hypervisor.XEN)
|
||||||
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build())
|
.monitoringState(MonitoringState.ENABLED).availabilityZone("us-east-1b").build())
|
||||||
|
|
||||||
, "AIDADH4IGTRXXKCD", null, "r-47a5402e");
|
, "AIDADH4IGTRXXKCD", null, "r-47a5402e");
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class VMSpecToHardware implements Function<VMSpec, Hardware> {
|
||||||
for (Entry<String, Integer> disk : from.getDataDiskDeviceNameToSizeInGig().entrySet())
|
for (Entry<String, Integer> disk : from.getDataDiskDeviceNameToSizeInGig().entrySet())
|
||||||
builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(disk.getKey()).size(
|
builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(disk.getKey()).size(
|
||||||
new Float(disk.getValue())).durable(true).build());
|
new Float(disk.getValue())).durable(true).build());
|
||||||
|
builder.hypervisor("VMware");
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FlavorToHardware implements Function<Flavor, Hardware> {
|
public class FlavorToHardware implements Function<Flavor, Hardware> {
|
||||||
public Hardware apply(Flavor from) {
|
public Hardware apply(Flavor from) {
|
||||||
return new HardwareBuilder().ids(from.getId() + "").name(from.getName())
|
return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen")
|
||||||
.processors(ImmutableList.of(new Processor(from.getRam() / 1024.0, 1.0))).ram(from.getRam())
|
.processors(ImmutableList.of(new Processor(from.getRam() / 1024.0, 1.0))).ram(from.getRam())
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl((from.getRam() * 4) / 1024.0f, true, true))).build();
|
.volumes(ImmutableList.<Volume> of(new VolumeImpl((from.getRam() * 4) / 1024.0f, true, true))).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,9 @@ public class ProductItemsToHardware implements Function<Iterable<ProductItem>, H
|
||||||
int ram = ProductItems.capacity().apply(ramItem).intValue();
|
int ram = ProductItems.capacity().apply(ramItem).intValue();
|
||||||
|
|
||||||
return new HardwareBuilder().ids(hardwareId).processors(ImmutableList.of(new Processor(cores, coreSpeed))).ram(
|
return new HardwareBuilder().ids(hardwareId).processors(ImmutableList.of(new Processor(cores, coreSpeed))).ram(
|
||||||
ram).volumes(
|
ram)
|
||||||
|
.hypervisor("XenServer")
|
||||||
|
.volumes(
|
||||||
Iterables.transform(filter(items, categoryCodeMatches(diskCategoryRegex)),
|
Iterables.transform(filter(items, categoryCodeMatches(diskCategoryRegex)),
|
||||||
new Function<ProductItem, Volume>() {
|
new Function<ProductItem, Volume>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue