ssbangal
Contributor
Contributor

Error in VM Migration across clusters

Jump to solution

Hi,

I have setup 2 clusters each having 2 ESX (vSphere 4.0) hosts configured. When I manually try to migrate the VM across the clusters using the vSphere client, the migration is successful. But when I try to do it programatically, I get "A specified parameter is not correct" error in the vSphere client.

The same code works fine when the target host is within the same cluster. But when the target host is in a different cluster, I get the above error message.

Below is the command that I am using:

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

Anyone faced this issue?

Regards,

Sudhir

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager

I'm guessing that you're probably not specifying the correct Cluster root resourcePool when trying to migrate between two clusters.

If you take a look at MigrateVM_Task(), you'll notice the required fields and one of which is the target pool. If you don't set it, it uses the current pool which probably works if it's in the same cluster, but when you move it to different cluster the pool will be different as each Cluster has it's own root pool.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
2 Replies
lamw
Community Manager
Community Manager

I'm guessing that you're probably not specifying the correct Cluster root resourcePool when trying to migrate between two clusters.

If you take a look at MigrateVM_Task(), you'll notice the required fields and one of which is the target pool. If you don't set it, it uses the current pool which probably works if it's in the same cluster, but when you move it to different cluster the pool will be different as each Cluster has it's own root pool.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
ssbangal
Contributor
Contributor

Thanks a lot for the reply William. I modified the code as per your suggestion and it is working fine now.

Regards,

Sudhir

0 Kudos