Hello everyone,
I'm trying to migrate a vm to another cluster, and also change its disk format.
The VM is been migrated successfully but the backing info i specified for the virtual disks was ignored.
This is the code:
//Get VM's number of VMDKs diskIDArray = new Array(); var devices = vm.config.hardware.device; for (var j in devices) { if (devices[j] instanceof VcVirtualDisk) { diskIDArray.push(devices[j].key); System.log("VM Disk ID:" + devices[j].key); } } //Migrate var spec = new VcVirtualMachineRelocateSpec(); spec.datastore = destDatastore; spec.host = destHost; spec.pool = resPool; spec.disk = new Array(); for (var i=0;i< diskIDArray.length;i++) { var myVcVirtualDiskFlatVer2BackingInfo = new VcVirtualDiskFlatVer2BackingInfo() ; myVcVirtualDiskFlatVer2BackingInfo.fileName = "buga"; myVcVirtualDiskFlatVer2BackingInfo.DiskMode = "independent_persistent"; myVcVirtualDiskFlatVer2BackingInfo.split = false; myVcVirtualDiskFlatVer2BackingInfo.eagerlyScrub = true; myVcVirtualDiskFlatVer2BackingInfo.thinProvisioned = false; myVcVirtualDiskFlatVer2BackingInfo.writeThrough = false; var disk = new VcVirtualMachineRelocateSpecDiskLocator(); disk.diskId = diskIDArray[i]; disk.datastore = destDatastore; disk.diskBackingInfo = myVcVirtualDiskFlatVer2BackingInfo; spec.disk[i] = disk; backingInfoTest = disk.diskBackingInfo; System.log("backing filelane:" + backingInfoTest.fileName); } vcTask = vm.relocateVM_Task(spec, VcVirtualMachineMovePriority.defaultPriority); // VirtualMachine
As you see i'm trying to chagne the disks format to eager zero
Any ideas?
Dan.