How LIVE MIGRATION works in Hyper-V R2

The live migration process moves a running VM from the source physical host to a destination physical host as quickly as possible. A live migration is initiated by an administrator through one of the methods listed below. The speed of the process is partially dependent on the hardware used for the source and destination physical computers, as well as the network capacity.

Three methods can initiate a live migration:

  1. Using the Failover Cluster Management console, an administrator can initiate a live migration.
  2. If Virtual Machine Manager is managing physical hosts that are configured to support live migration, the Virtual Machine Manager administration-console can be used to initiate a live migration.
  3. A WMI or PowerShell script can be used to initiate a live migration.

Any guest operating system supported by Hyper-V will work with the live migration process.

After initiating a live migration, the following process occurs:

1. Live migration setup

During the live migration setup stage , the source physical host creates a TCP connection with the destination physical host. This connection transfers the VM configuration data to the destination physical host. A skeleton VM is set up on the destination physical host and memory is allocated to the destination VM.

image Stage 1: Live Migration Setup

2. Memory pages are transferred from the source node to the destination node

In the second stage of a live migration, the memory assigned to the migrating VM is copied over the network to the destination physical host. This memory is referred to as the working set of the migrating VM. A page of memory is 4 kilobytes.

For example, suppose that a VM named SERVER2 configured with 1024MB of RAM is migrating to another Hyper-V physical host. The entire 1024MB of RAM assigned to this VM is the working set of SERVER2. The utilized pages within the SERVER2 working set are copied to the destination Hyper-V physical computer.

In addition to copying the working set of SERVER2 to the destination physical host, Hyper-V on the source physical host monitors the pages in the working set for SERVER2. As memory pages are modified by SERVER2, they are tracked and marked as being modified. The list of modified pages is simply the list of memory pages SERVER2 has modified after the copy of its working set has begun.

During this phase of the migration, the migrating VM continues to run. Hyper-V iterates the memory copy process several times, each time a smaller number of modified pages will need to be copied to the destination physical computer.

After the working set is copied to the destination physical host, the next stage of the live migration begins.

imageStage 2:  Memory pages are transferred from the source node to the destination node

3. Memory pages transferred

Stage three is a memory copy process that duplicates the remaining modified memory pages for SERVER2 to the destination physical host. The source physical host transfers the register and device state of the VM to the destination physical host.

During this stage, the network bandwidth available between the source and destination physical hosts is critical to the speed of the live migration and using a 1 Gigabit Ethernet or faster is important. The faster the source physical host transfers the modified pages from the migrating VMs working set, the more quickly the live migration will complete.

The number of pages transferred in this stage is dictated by how actively the VM is accessing and modifying memory pages. The more modified pages, the longer the VM migration process takes for all pages to be transferred to the destination physical host.

After the modified memory pages are copied completely to the destination physical host, the destination physical host has an up-to-date working set for SERVER2. The working set for SERVER2 is present on the destination physical host in the exact state it was in when SERVER2 began the migration process.

Note: You can cancel the live migration process at any point before this stage of the migration.

image Stage 3: Memory pages transferred

4. Move the storage handle from source to destination

During the fourth stage of a live migration, control of the storage associated with SERVER2, such as any VHD files or pass-through disks, is transferred to the destination physical host.

image Stage 4: Storage Handle Moved

5. The VM is brought online on the destination server

In stage five of a live migration, the destination server now has the up-to-date working set for SERVER2 as well as access to any storage used by SERVER2. At this point SERVER2 is resumed.

imageStage 5: VM Resumed

6. Network cleanup occurs

The migrated VM is running on the destination server in the final stage of a live migration. At this point a message is sent to the physical network switch causes it to re-learn the MAC addresses of the migrated VM so that network traffic to and from SERVER2 can use the correct switch port.

 

 

 

Technorati Tags: Windows Server 2008 R2,Hyper-V,virtualization,Live migration,VHD