corrected disk size

This commit is contained in:
Adrian Cole 2010-09-12 09:31:08 -07:00
parent 198eeec3d9
commit 5af7235132
6 changed files with 16 additions and 17 deletions

View File

@ -66,7 +66,7 @@ public class EC2TemplateBuilderLiveTest {
Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5") Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5")
.hardwareId(InstanceType.M2_2XLARGE).build(); .hardwareId(InstanceType.M2_2XLARGE).build();
System.out.println(template.getImage()); System.out.println(template.getHardware());
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
@ -118,6 +118,8 @@ public class EC2TemplateBuilderLiveTest {
Template microTemplate = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO) Template microTemplate = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO)
.build(); .build();
System.out.println(microTemplate.getHardware());
assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate; assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate;
assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "9.10"); assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), false); assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), false);
@ -145,7 +147,7 @@ public class EC2TemplateBuilderLiveTest {
assertEquals(newContext.getComputeService().listImages().size(), 0); assertEquals(newContext.getComputeService().listImages().size(), 0);
Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build(); Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build();
System.out.println(template.getImage()); System.out.println(template.getHardware());
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);

View File

@ -61,13 +61,13 @@ public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeS
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)");
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation(); assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
System.out.println(defaultTemplate.getHardware());
} }
@Override @Override
protected Template buildTemplate(TemplateBuilder templateBuilder) { protected Template buildTemplate(TemplateBuilder templateBuilder) {
Template template = super.buildTemplate(templateBuilder); Template template = super.buildTemplate(templateBuilder);
Image image = template.getImage(); Image image = template.getImage();
assert image.getDefaultCredentials().identity != null : image;
assert image.getDefaultCredentials().credential != null : image; assert image.getDefaultCredentials().credential != null : image;
return template; return template;
} }

View File

@ -89,9 +89,8 @@ public class HardwareForVApp implements Function<VApp, Hardware> {
})); }));
Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(hardware.getResourceAllocations()); Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(hardware.getResourceAllocations());
return new HardwareImpl(from.getHref().toASCIIString(), from.getName() return new HardwareImpl(from.getHref().toASCIIString(), from.getName(), from.getHref().toASCIIString(), location,
+ String.format(": vpus(%s), ram(%d), volumes(%s)", processors, ram, volumes), from.getHref() null, ImmutableMap.<String, String> of(), processors, ram, volumes, ImagePredicates.idEquals(from
.toASCIIString(), location, null, ImmutableMap.<String, String> of(), processors, ram, volumes, .getHref().toASCIIString()));
ImagePredicates.idEquals(from.getHref().toASCIIString()));
} }
} }

View File

@ -114,10 +114,9 @@ public class HardwareForVAppTemplate implements Function<VAppTemplate, Hardware>
})); }));
Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(hardware.getResourceAllocations()); Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(hardware.getResourceAllocations());
return new HardwareImpl(from.getHref().toASCIIString(), from.getName() return new HardwareImpl(from.getHref().toASCIIString(), from.getName(), from.getHref().toASCIIString(), location,
+ String.format(": vpus(%s), ram(%d), volumes(%s)", processors, ram, volumes), from.getHref() null, ImmutableMap.<String, String> of(), processors, ram, volumes, ImagePredicates.idEquals(from
.toASCIIString(), location, null, ImmutableMap.<String, String> of(), processors, ram, volumes, .getHref().toASCIIString()));
ImagePredicates.idEquals(from.getHref().toASCIIString()));
} }

View File

@ -80,9 +80,8 @@ public class HardwareForVCloudExpressVApp implements Function<VCloudExpressVApp,
})); }));
Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(from.getResourceAllocations()); Iterable<? extends Volume> volumes = resourceAllocationsToVolumes.apply(from.getResourceAllocations());
return new HardwareImpl(from.getHref().toASCIIString(), from.getName() return new HardwareImpl(from.getHref().toASCIIString(), from.getName(), from.getHref().toASCIIString(), location,
+ String.format(": vpus(%s), ram(%d), volumes(%s)", processors, ram, volumes), from.getHref() null, ImmutableMap.<String, String> of(), processors, ram, volumes, ImagePredicates.idEquals(from
.toASCIIString(), location, null, ImmutableMap.<String, String> of(), processors, ram, volumes, .getHref().toASCIIString()));
ImagePredicates.idEquals(from.getHref().toASCIIString()));
} }
} }

View File

@ -49,10 +49,10 @@ public class ResourceAllocationsToVolumes implements
if (from instanceof VCloudHardDisk) { if (from instanceof VCloudHardDisk) {
VCloudHardDisk vDisk = VCloudHardDisk.class.cast(from); VCloudHardDisk vDisk = VCloudHardDisk.class.cast(from);
return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL, return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL,
vDisk.getCapacity() * 1024f, null, from.getAddressOnParent() == 0, true); vDisk.getCapacity() / 1024f, null, from.getAddressOnParent() == 0, true);
} else { } else {
return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL, from return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL, from
.getVirtualQuantity() * 1024 * 1024f, null, from.getAddressOnParent() == 0, true); .getVirtualQuantity() / 1024 / 1024f, null, from.getAddressOnParent() == 0, true);
} }
} }