There are two types of live migrations that can be performed in Hyper-V: live migration with shared storage and...
live migration without shared storage. Neither live migration technologies result in downtime when moving virtual machines to another location.
While moving virtual machines (VMs) without shared storage can only be initiated manually, moving VMs with shared storage requires the Windows failover clustering feature to be installed before the automatic or manual migration of a virtual machine can happen. When you talk about Hyper-V Live Migration in general, you are referring to live migration with shared storage. This tip explains how a virtual machine is moved to another Hyper-V server via live migration with shared storage.
Microsoft Hyper-V Live Migration involves TCP/IP networking to move virtual machine memory contents to another node in a Hyper-V cluster.
When you trigger a live migration manually or automatically, a TCP connection between a source and destination Hyper-V server is created. A skeleton VM is created on the destination Hyper-V server and memory allocation takes place based on memory configured for the source VM.
Next, memory pages of the source VM are transferred to a destination Hyper-V server. At this stage, there are two types of memory pages copied: initially utilized memory pages and modified memory pages.
The following actions are performed by the source Hyper-V server at this stage:
- The Hyper-V source server keeps track of modified memory pages while it's in the process of copying the initially utilized memory pages to the destination Hyper-V server.
- The source server repeats the memory pages copy operation, and each time, a chunk of the modified memory pages are also copied.
After that, the VM continues to run on the source server. Once the source server is finished copying the initially modified memory pages, it copies the remaining modified memory pages to the destination Hyper-V server. Once that process is complete, the source server registers the VM and its state with the destination Hyper-V server.
The source server then transfers the storage control to the destination server including VHD files and pass-through disks. Following that, the VM is brought online at the destination server.
At this stage, the VM is up and running at the destination server, but it gets a new MAC address on the destination server. To ensure the live migrated VM can communicate successfully with other network devices, the destination server sends a message to the physical network switch to learn the new MAC address of the VM.
The live migration process might take several seconds, or even minutes, to complete depending on the following factors:
- If memory pages are being used at the time of the migration, the process will take longer.
- If the VM is heavily accessing the network or VM memory pages are frequently modified, migration time will increase.
- The speed of the network used for live migration will also affect the migration time. It is recommended to use 1 GBps or faster Ethernet connection to speed up the live migration process.