Hi,
I want to configure VM (change CPU number and memory amount) using SDK for Java.
I have following code
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
vmConfigSpec.setCpuAllocation(getShares(cpuVal));
vmConfigSpec.setMemoryAllocation(getShares(memVal));
ManagedObjectReference tmor = service.reconfigVM_Task(vmRef, vmConfigSpec);
(...)
private ResourceAllocationInfo getShares(int val) {
ResourceAllocationInfo raInfo = new ResourceAllocationInfo();
SharesInfo sharesInfo = new SharesInfo();
sharesInfo.setLevel(SharesLevel.CUSTOM);
sharesInfo.setShares(val);
raInfo.setShares(sharesInfo);
return raInfo;
}
I have found following example: http://communities.vmware.com/docs/DOC-10011
Example is quite good, but there is line 144:
String result = cb.getServiceUtil().waitForTask(tmor);
where cb is
private static AppUtil cb
Can someone tell me where I can find AppUtil code or how wait for reconfigVM_Task completition?