VMware vMotion supports the live migration of running virtual machines from one physical server to another with no downtime. The source and destination physical servers may be in the same datacenter or in different datacenters.

When calling the VirtualMachine object’s MigrateVM_Task method, you can specify a host or resource pool to migrate to, and optionally the task priority and power state of the virtual machine. The VMotion example makes the following queries, and performs the migration if possible:

  • Uses QueryVMotionCompatibility_Task to check that two hosts are compatible.
  • Uses CheckMigrate_Task to check whether migration is feasible. If two hosts are not compatible, virtual machines cannot be migrated from one to the other.
  • Uses CheckRelocation_Task to check whether relocation is possible.

MigrateVM_Task was deprecated in vSphere 6.5 and can be replaced with RelocateVM_Task.