ssbangal
Contributor
Contributor

Migrate VM Task not starting

Hi,

I have setup a cluster with DRS enabled (Set to fully automated - conservative setting) having 2 hosts. In my sample code I am trying to migrate the VM from one host to another host. I am not using any resource pools in my infrastructure. When I make a call to the MigrateVM_Task API, I see a corresponding task in the vSphere client window. But, surprisingly the actually migration is not happening at all. The task that shows up in the vSphere client has the start and completed time stamp of same value. But the actual migration never happened.

Anybody has come across this situation earlier? Below code snippet shows the call. I get a reference to the VM to be migrated and also the destination host. The code for "WaitForTask" is taken out of the SDK that VMware shipped with.

ManagedObjectReference taskObjRef = VIM_SERVICE.MigrateVM_Task(vmObjRef, null, destHostObj.objRef, VirtualMachineMovePriority.defaultPriority, VirtualMachinePowerState.poweredOn, false);

String result = WaitForTask(taskObjRef);

Regards,

Sudhir

Tags (5)
0 Kudos
4 Replies
storm27
Enthusiast
Enthusiast

Hi,

You can refer to the sample VMotion.java that is shipped with the vSphere SDK package.

Also, check that the VM you are trying to migrate is on the shared storage( this is necessary as you have mentioned the VM power state as poweredOn and for hot migration, shared storage is necessary).

Thanks.

Angela

0 Kudos
ssbangal
Contributor
Contributor

Hi Angela,

Thanks for your reply. Actually I did take the code from the sample and modified. Also, I have all the requirements satisfied for the hot migration. I can do the same VM migration manually but when i do it through the code, it just creates a task with the same start and stop time and the migration does not actually happen.

Regards,

Sudhir

0 Kudos
storm27
Enthusiast
Enthusiast

Hi,

In the migrateVM_task API call, you have passed the last parameter as false. If you refer to the API reference documentation, this API requires only 5 parameters, not six.

Also, try passing the resource pool parameter as well instead of null. You can retreive the resource pool by fetching the resourcePool property of ComputeResource. (Refer to managed object browrer).

Hope this helps!

0 Kudos
rkamal
VMware Employee
VMware Employee

Since the DRS is enabled in full auto mode. I think the DRS is selecting the target host from the cluster.

Try setting DRS to manual mode and migrating VM's. Keep us updated.

Rajesh Kamal.

0 Kudos