assert(morFolder != null);
assert(morResourcePool != null);
assert(morDs != null);
VirtualDisk[] independentDisks = getAllIndependentDiskDevice();
VirtualMachineRelocateSpec rSpec = new VirtualMachineRelocateSpec();
if(independentDisks.length > 0) {
List<VirtualMachineRelocateSpecDiskLocator> diskLocator = new ArrayList<VirtualMachineRelocateSpecDiskLocator>(independentDisks.length);
for(int i = 0; i < independentDisks.length; i++) {
VirtualMachineRelocateSpecDiskLocator loc = new VirtualMachineRelocateSpecDiskLocator();
loc.setDatastore(morDs);
loc.setDiskId(independentDisks[i].getKey());
loc.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.MOVE_ALL_DISK_BACKINGS_AND_DISALLOW_SHARING.value());
diskLocator.add(loc);
}
rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
rSpec.getDisk().addAll(diskLocator);
} else {
rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
}
rSpec.setPool(morResourcePool);
VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
cloneSpec.setPowerOn(false);
cloneSpec.setTemplate(false);
cloneSpec.setLocation(rSpec);