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:
Moves a powered-off virtual machine to a new host. Optionally, you can relocate configuration and disk files to new storage locations. Cold migration can be used to migrate virtual machines from one datacenter to another.
Migration of a suspended virtual machine
Moves a suspended virtual machine to a new host. Optionally, you can relocate configuration and disk files to new storage location. You can migrate suspended virtual machines from one datacenter to another.
Moves a powered-on virtual machine to a new host. Migration with VMotion allows you to move a virtual machine to a new host without interruption in the availability of the virtual machine. Migration with VMotion cannot be used to move virtual machines from one datacenter to another.
Migration with Storage VMotion
Moves the virtual disks or configuration file of a powered-on virtual machine to a new datastore. Migration with Storage VMotion allows you to move a virtual machine’s storage without interruption in the availability of the virtual machine.
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. You can perform this migration only between hosts in the same datacenter that are managed by a vCenter Server system. You must power off a virtual machine to move it to a different datacenter.
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.