@Override public HardwareBuilder apply(Iterable<? extends ResourceAllocationSettingData> from) { HardwareBuilder builder = new HardwareBuilder(); builder.volumes(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE, ResourceType.BASE_PARTITIONABLE_UNIT, ResourceType.PARTITIONABLE_UNIT)), new Function<ResourceAllocationSettingData, Volume>() { @Override public Volume apply(ResourceAllocationSettingData from) { return HardwareBuilderFromResourceAllocations.this.apply(from); } })); builder.ram((int) find(from, CIMPredicates.resourceTypeIn(ResourceType.MEMORY)).getVirtualQuantity().longValue()); builder.processors(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)), new Function<ResourceAllocationSettingData, Processor>() { @Override public Processor apply(ResourceAllocationSettingData arg0) { return new Processor(arg0.getVirtualQuantity(), 1); } })); return builder; }
@Override public HardwareBuilder apply(Iterable<? extends ResourceAllocationSettingData> from) { HardwareBuilder builder = new HardwareBuilder(); builder.volumes(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE, ResourceType.BASE_PARTITIONABLE_UNIT, ResourceType.PARTITIONABLE_UNIT)), new Function<ResourceAllocationSettingData, Volume>() { @Override public Volume apply(ResourceAllocationSettingData from) { return HardwareBuilderFromResourceAllocations.this.apply(from); } })); builder.ram((int) find(from, CIMPredicates.resourceTypeIn(ResourceType.MEMORY)).getVirtualQuantity().longValue()); builder.processors(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)), new Function<ResourceAllocationSettingData, Processor>() { @Override public Processor apply(ResourceAllocationSettingData arg0) { return new Processor(arg0.getVirtualQuantity(), 1); } })); return builder; }
@Override public HardwareBuilder apply(Iterable<? extends ResourceAllocationSettingData> from) { HardwareBuilder builder = new HardwareBuilder(); builder.volumes(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE, ResourceType.BASE_PARTITIONABLE_UNIT, ResourceType.PARTITIONABLE_UNIT)), new Function<ResourceAllocationSettingData, Volume>() { @Override public Volume apply(ResourceAllocationSettingData from) { return HardwareBuilderFromResourceAllocations.this.apply(from); } })); builder.ram((int) find(from, CIMPredicates.resourceTypeIn(ResourceType.MEMORY)).getVirtualQuantity().longValue()); builder.processors(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)), new Function<ResourceAllocationSettingData, Processor>() { @Override public Processor apply(ResourceAllocationSettingData arg0) { return new Processor(arg0.getVirtualQuantity(), 1); } })); return builder; }
@Override public HardwareBuilder apply(Iterable<? extends ResourceAllocationSettingData> from) { HardwareBuilder builder = new HardwareBuilder(); builder.volumes(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE, ResourceType.BASE_PARTITIONABLE_UNIT, ResourceType.PARTITIONABLE_UNIT)), new Function<ResourceAllocationSettingData, Volume>() { @Override public Volume apply(ResourceAllocationSettingData from) { return HardwareBuilderFromResourceAllocations.this.apply(from); } })); builder.ram((int) find(from, CIMPredicates.resourceTypeIn(ResourceType.MEMORY)).getVirtualQuantity().longValue()); builder.processors(transform(filter(from, CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)), new Function<ResourceAllocationSettingData, Processor>() { @Override public Processor apply(ResourceAllocationSettingData arg0) { return new Processor(arg0.getVirtualQuantity(), 1); } })); return builder; }
private void addProcessorItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) { ResourceAllocationSettingData cpu = find(vApp.getResourceAllocations(), CIMPredicates .resourceTypeIn(ResourceType.PROCESSOR)); long quantity = configuration.getProcessorCount() != null ? configuration.getProcessorCount() : cpu .getVirtualQuantity(); addResourceWithQuantity(sectionBuilder, cpu, quantity); }
private void addMemoryItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) { ResourceAllocationSettingData memory = find(vApp.getResourceAllocations(), CIMPredicates .resourceTypeIn(ResourceType.MEMORY)); long quantity = configuration.getMemory() != null ? configuration.getMemory() : memory.getVirtualQuantity(); addResourceWithQuantity(sectionBuilder, memory, quantity); }
protected void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount, long memory, long hardDisk) { assertEquals(vApp.getName(), serverName); assertEquals(vApp.getOperatingSystemDescription(), expectedOs); assertEquals((int) find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)) .getVirtualQuantity().longValue(), processorCount); assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.MEMORY)) .getVirtualQuantity().longValue(), memory); assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)) .getVirtualQuantity().longValue(), hardDisk); assertEquals(vApp.getSize().longValue(), find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)) .getVirtualQuantity().longValue()); }
CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) { if (net instanceof VCloudNetworkAdapter) { VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) { if (net instanceof VCloudNetworkAdapter) { VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) { if (net instanceof VCloudNetworkAdapter) { VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
private void addDiskItems(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) { for (ResourceAllocationSettingData disk : filter(vApp.getResourceAllocations(), CIMPredicates .resourceTypeIn(ResourceType.DISK_DRIVE))) { if (!configuration.getDisksToDelete().contains(Integer.valueOf(disk.getAddressOnParent()))) { addDiskWithQuantity(sectionBuilder, disk); } } for (Long quantity : configuration.getDisks()) { ResourceAllocationSettingData disk = ResourceAllocationSettingData.builder().instanceID("9").addressOnParent( "-1").elementName("").resourceType(ResourceType.DISK_DRIVE).virtualQuantity(quantity).build(); addDiskWithQuantity(sectionBuilder, disk); } }
@Test(enabled = true, dependsOnMethods = "testLifeCycle") public void testConfigure() throws InterruptedException, ExecutionException, TimeoutException, IOException { vApp = api.getVApp(vApp.getHref()); Task task = api.configureVApp(vApp, changeNameTo("eduardo").changeMemoryTo(1536).changeProcessorCountTo(1) .addDisk(25 * 1048576).addDisk(25 * 1048576)); assert successTester.apply(task.getHref()); vApp = api.getVApp(vApp.getHref()); assertEquals(vApp.getName(), "eduardo"); assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)) .getVirtualQuantity().longValue(), 1); assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.MEMORY)) .getVirtualQuantity().longValue(), 1536); assertEquals(size(filter(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE))), 3); assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref()); loopAndCheckPass(); assert successTester.apply(api.powerOffVApp(vApp.getHref()).getHref()); // extract the disks on the vApp sorted by addressOnParent List<ResourceAllocationSettingData> disks = Lists.newArrayList(filter(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE))); // delete the second disk task = api.configureVApp(vApp, deleteDiskWithAddressOnParent(Integer.parseInt(disks.get(1).getAddressOnParent()))); assert successTester.apply(task.getHref()); assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref()); loopAndCheckPass(); }
.virtualQuantity(10485760l).virtualQuantityUnits("byte * 2^20").build(); assertEquals(result.getResourceAllocations(), ImmutableSet.of(cpu, memory, controller, disk)); assertEquals(find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)) .getVirtualQuantity().intValue(), 1); find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PARALLEL_SCSI_HBA)); assertEquals(find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.MEMORY)) .getVirtualQuantity().intValue(), 512); assertEquals(find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)) .getVirtualQuantity().longValue(), 10485760); assertEquals(result.getSize().longValue(), find(result.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)).getVirtualQuantity().longValue());
assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR)) .getVirtualQuantity().intValue(), 2); find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PARALLEL_SCSI_HBA)); assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.MEMORY)) .getVirtualQuantity().longValue(), 1024); CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)));