VMware Cloud Community
NoTr3x
Contributor
Contributor

Migrate VM

Hi,

actually i am working for a project, which needs to migrate VMs between Hostsystem.

Of course we got clusters, as well DRS Groups, so i found the action "migrate_VM", which is usable for DRS Cluster, so good for the project.

I filled out these action, but the VM is not moving to another hostsystem.

vm.migrateVM_Task(null , null , VirtualMachineMovePriority.highPriority , VirtualMachinePowerState.poweredOn);

Input is a VC:VM Object, maybe some has got an answer or a workaround for this problem ...

Tags (3)
0 Kudos
6 Replies
iiliev
VMware Employee
VMware Employee

A couple of questions:

  1. Does it work if you provide a non-null value for one of the first 2 parameters (resource pool / host)?
  2. The method call returns task object. Did you wait for the task to complete/fail? Could you print the task object properties to see if there is some information?
0 Kudos
NoTr3x
Contributor
Contributor

i built a second workflow and the host object was static, that worked, but my problem is now, how i can handle it with the drs rules ...

Because i changed it to null and now the vm is not moving ...

0 Kudos
NoTr3x
Contributor
Contributor

I found a solution, but now i need the Task checkMigrate_Task.

vm.sdkConnection.checkMigrate_Task(null, null , null , null , null);

How can i get this action for executing.

0 Kudos
iiliev
VMware Employee
VMware Employee

It could be vm.sdkConnection.vmProvisioningChecker.checkMigrate_Task(.....);

But it won't help. According to documentation https://www.vmware.com/support/orchestrator/doc/vro-vsphere60-api/html/VcVirtualMachineProvisioningC..., checkMigrate_Task() only checks if the migration operation is feasible, not perform actual migration,

0 Kudos
NoTr3x
Contributor
Contributor

yes, in the static way the migration worked, in the actual situation with null, not.

But i can list my host in the cluster and check if migration will possible or not. I hope i'll get a feedback from this task, like "yes migration would be succesful" or "no migration won't".

So i could use the static way.

0 Kudos
NoTr3x
Contributor
Contributor

Ok, the dream way doesn't work, because its a task and no result ... 

He didn't check the DRS Group, i put the VM into a DRS Group with only one host, but the task would run on every host perfect, said my workflow.

But i changed it to the migrate task and this output came, that's correct. ,

'MigrateVM_Task' error: Virtual machine 'vm' on host 'hostsystem' would violate a virtual machine - host affinity rule.

Has someone worked with the VcClusterDRS ?

0 Kudos