}
}
private VcTask relocateDisksWork(DeviceId[] deviceIds,
ManagedObjectReference dsMoRef, final IVcTaskCallback callback) throws Exception {
final RelocateSpec relocSpec = new RelocateSpecImpl();
List<RelocateSpec.DiskLocator> diskList = new ArrayList<RelocateSpec.DiskLocator>();
for(DeviceId deviceId : deviceIds) {
VirtualDevice device = getVirtualDevice(deviceId);
RelocateSpec.DiskLocator disk = new RelocateSpecImpl.DiskLocatorImpl();
disk.setDatastore(dsMoRef);
disk.setDiskId(device.getKey());
diskList.add(disk);
}
relocSpec.setDisk(diskList.toArray(new RelocateSpec.DiskLocator[diskList.size()]));
VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
public VcTask body() throws Exception {
VirtualMachine vm = getManagedObject();
return new VcTask(TaskType.RelocateVm,
vm.relocate(relocSpec, VirtualMachine.MovePriority.defaultPriority), callback);