Virtual Machine Migration
Migration is the process of moving a virtual machine from one host or storage location to another. Copying a virtual machine creates a new virtual machine. It is not a form of migration. vSphere supports the following migration types:
Migration of a suspended virtual machine and migration with VMotion are both sometimes called hot migration, because they allow migration of a virtual machine without powering it off.
You can move virtual machines manually or set up a scheduled task to perform the cold migration.
Cold Migration
If a virtual machine is shut down, you can move it to a different cluster, resource pool, or host by copying all virtual machine files to a different directory. The ColdMigration example illustrates this.
Migration with VMotion
VMware VMotion support the live migration of running virtual machines from one physical server to another with no downtime. The source and destination physical servers can be in the same datacenter or in different datacenters.
When you call the VirtualMachine object’s MigrateVM_Task method, you can specify either a host or resource pool to migrate to. You can optionally specify the task priority and the power state of the virtual machine. The VMotion example performs the following tasks:
Uses QueryVMotionCompatibility_Task to check two hosts are compatible.
Uses CheckMigrate_Task to check whether migration is feasible. For example, 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.
The sample performs the migration if the hosts are compatible.
Using Storage VMotion
Storage VMotion allows you to move a running virtual machine from one VMFS volume to another. Taking the virtual machine or its associated storage offline is not required. All datastore types are supported, including local storage, VMFS, and NAS (network attached storage).
You can place the virtual machine and all its disks in a single location, or select separate locations for the virtual machine configuration file and each virtual disk. The virtual machine remains on the same host during Storage VMotion.
To perform storage VMotion, you use the VirtualMachine.RelocateVM_Task method. The RelocateVMSpec passed in to the method allows you to specify the target datastore and target host or resource pool.