Hello everyone,
I have a Scriptable Task that suppose to migrate VMs(datastore and host) to another cluster. When I'm testing it within the cluster, everything works perfectly. But when I'm trying to move a VM between clusters, I'm getting:
"specified parameter not correct"
I can move the VM manually via vSphere Web Client with no problem.
This is the code in the scriptable task:
//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.disk = new Array(); for (var i=0;i< diskIDArray.length;i++) { var disk = new VcVirtualMachineRelocateSpecDiskLocator(); disk.diskId = diskIDArray[i]; disk.datastore = destDatastore; spec.disk[i] = disk; } //vcTask = System.getModule("dk.atea.extra").XvMotion(vm,destHost,destDatastore); vcTask = vm.relocateVM_Task(spec, VcVirtualMachineMovePriority.defaultPriority); // VirtualMachine
Any ideas?
Dan.