@Singleton
public class VMSpecToHardware implements Function<VMSpec, Hardware> {
@Override
public Hardware apply(VMSpec from) {
HardwareBuilder builder = new HardwareBuilder();
builder.ids(from.toString());
for (int i = 0; i < from.getProcessorCount(); i++)
builder.processor(new Processor(1, 3.0));
builder.ram(from.getMemoryInGig() * 1024);
builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(from.getBootDeviceName()).size(
new Float(from.getBootDiskSize())).bootDevice(true).durable(true).build());
for (Entry<String, Integer> disk : from.getDataDiskDeviceNameToSizeInGig().entrySet())
builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device(disk.getKey()).size(
new Float(disk.getValue())).durable(true).build());
builder.hypervisor("VMware");
return builder.build();
}