What is vSphere vMotion?

Reading Time: 6 minutes

“What is vSphere vMotion?” is an article that explains vSphere vMotion and provides some important details about this process.

About VM Migration

Migration means moving a Virtual Machine (VM) from one ESXi host, datastore, or vCenter Server instance to another ESXi host, datastore, or vCenter Server instance.

In this context, a migration can be “cold” or “hot”:

  • A cold migration moves a powered-off or suspended VM.
  • A hot migration moves a powered-on VM.

For every requested migration, the vCenter Server instance performs compatibility checks before migrating suspended or powered-on VMs to ensure that the VM is compatible with the target ESXi host.

VM Migration Types

So, the type of migration depends on the power state of the VM that you select in the inventory and the migration type that you select in the Migration wizard:

The migration wizard provides the following migration options:

Compute resource only:
— Move a VM, but not its storage, to another ESXi host.
— For a hot migration, vSphere vMotion moves the VM.
Note: Hot migrations mean moving a powered-on VM from one ESXi host to another ESXi host.

Storage only:
— Move a VM’s files or objects to a new datastore.
— For a hot migration, vSphere Storage vMotion moves the VM.
Note: vSphere Storage vMotion is a technology that moves the VM’s files in a datastore.

Both compute resource and storage:
— Move a VM to another host and datastore.
— For a hot migration, vSphere vMotion and vSphere Storage vMotion are used to move the VM.
Note: In simple words, “vSphere vMotion” only means moving the VM’s computing resources. When we talk about “vSphere Storage vMotion,” we mean only moving the VM’s files and objects.

Cross vCenter Server export:
— Move the VM to a host and datastore managed by a different vCenter Server instance that is not linked to the current SSO domain.

What is the best Migration to use?

The simple answer is “depends”!

In this case, the purpose of the migration determines which migration technique to use. For example, you might need to shut down an ESXi host for maintenance but keep the VMs running. For this case, use vSphere vMotion to migrate the VMs instead of performing a cold or suspended VM migration.

If you must move VM’s files to another datastore to better balance the disk load or transition to another storage array, you use vSphere Storage vMotion.

Important: Some migration techniques, such as vSphere vMotion migration, require special hardware to be met. Other techniques, such as cold migration, do not require special hardware. So, to remember, when you perform a hot migration, the vCenter Server instance will perform some validations to guarantee the vMotion compatibility between the source ESXi host and the target ESXi host (and some validations are related to the hardware compatibility).

About vSphere vMotion

A vSphere vMotion migration moves a powered-on VM from one ESXi host to another. So, a vSphere vMotion is a hot vMotion because the compute resources of VMs are migrated.

Important: With vSphere vMotion, the entire VM state is moved from one host to another, but the data storage remains in the same datastore.

The VM state information includes:
Current memory content: includes transaction data and whatever bits of the operating system and applications are in memory.
All the information that defines and identifies the VM: includes all the data that maps to the VM hardware elements, such as the BIOS or EFI, devices, CPU, and MAC addresses for the Ethernet cards.

Some capabilities of vSphere vMotion are:

  • Improvement in overall hardware use.
  • Continuous VM operation while accommodating scheduled ESXi host downtime.
  • vSphere DRS to balance VMs across hosts (vSphere DRS uses vSphere vMotion to migrate running VMs from one host to another to ensure the VMs have the required resources).

Network Requirements for vSphere vMotion

Each ESXi host must have at least one VMkernel interface configured for vMotion traffic. This means enabling at least one VMkernel with the “vMotion” service:

Additionally, the vMotion network must be secure. Generally, a Virtual LAN (VLAN) is used to logically segment the traffic for this network.

Another important factor to consider is the bandwidth available. High bandwidth will provide fast vMotion operations. To improve this performance, you can also enable the jumbo frames (MTU 9000).

Provision of at least one additional physical NIC as a failover NIC.

You can check the full details and requirements by accessing the following link:
https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vcenter-esxi-management/GUID-30FAA00F-D5F3-475D-820E-5D45517AC18E.html

vSphere vMotion Migration Workflow

When a VM migration is started, the vCenter Server instance will execute a long-running migration task to process the migration. The first step is to perform a compatibility check. Next is to tell the source and destination ESXi hosts what is happening.

The vCenter Server communicates with ESXi hosts using the Virtual Provisioning X Daemon (VPXD), which calls out the Virtual Provisioning X Agent (VPXA) running on the ESXi hosts. VPXA listens to messages from VPXD, receives the migration spec, and passes that on to the VMX process via hosted. The Host Daemon (hostd) maintains host-specific information and management access, including virtual machine telemetry like the VMstate. When a migration is started, hostd puts the virtual machine in an intermediate state so the virtual machine’s configuration cannot be changed during the migration:

The Virtual Machine Monitor (VMM) process manages the virtual machine memory and transfers virtual machine storage and network I/O requests to the VMkernel. VMM forwards all other non-critical performance I/O requests to VMX. The Virtual Machine Extension (VMX) process runs in the VMkernel and handles I/O to devices that are not critical to performance. Note that VMM is only used at the source ESXi hosts during the migration because that is where the virtual machine’s active memory resides.

After this, the VMkernel migrate module on the source ESXi will open sockets on the vMotion-enabled network to set up communication with the destination ESXi host.

The following workflow considers that the VM files are stored in a shared datastore accessible by both ESXi hosts (the source and the destination ESXi hosts). A vSphere vMotion migration consists of the following steps:

1- A shadow VM is created on the destination ESXi host;

2- The VM’s memory state is copied over the vSphere vMotion network from the source ESXi host to the target/destination ESXi host. During this moment, users continue to access the VM and, potentially, update pages in memory. A list of modified pages in memory is kept in a memory bitmap on the source ESXi host;

3- After the first pass of memory state copy completes, another pass of memory copy is performed to copy any pages that changed during the last iteration. This iterative memory copying continues until the number of changed pages is small enough to copy across within 500 milliseconds;

4- After most of the VM’s memory is copied from the source ESXi host to the target/destination ESXi host, the VM is quiesced (The operation of quiescing a VM ensures that a snapshot represents a consistent view of the guest file system state at a specific point in time). No additional activity occurs on the VM. In the quiesce period, vSphere vMotion transfers the VM device state and memory bitmap to the destination ESXi host;

5- Immediately after the VM is quiesced on the source ESXi host, the VM is initialized and starts running on the target/destination ESXi host. A Gratuitous Address Resolution Protocol (GARP) request notifies the subnet that the VM’s MAC address is now accessible through a different physical switch port. The VM’s files are unlocked by the source ESXi host and locked by the target/destination ESXi host;

6- Users access the VM on the target/destination ESXi host instead of the source host;

7- The memory pages of the VM used on the source ESXi host are marked free.

To Wrapping This Up

So, as we can see, vSphere vMotion is an important technology in a VMware Cluster, and it could help any administrator in various situations when it is necessary to keep a VM running while the host is undergoing maintenance. We highly recommend the following link to read deep details related to the vMotion process:

https://blogs.vmware.com/vsphere/2019/07/the-vmotion-process-under-the-hood.html

One response to “What is vSphere vMotion?”