This chapter covers migrating guests running on a KVM hypervisor to another KVM host.
Migration is the term for the process of moving a virtualized guest from one host to another. Migration is a key feature of virtualization as software is completely separated from hardware. Migration is useful for:
Load balancing - guests can be moved to hosts with lower usage when a host becomes overloaded.
Hardware failover - when hardware devices on the host start to fail, guests can be safely relocated so the host can be powered down and repaired.
Energy saving - guests can be redistributed to other hosts and host systems powered off to save energy and cut costs in low usage periods.
Geographic migration - guests can be moved to another location for lower latency or in serious circumstances.
Migrations can be performed live or offline. To migrate guests the storage must be shared. Migration works by sending the guests memory to the destination host. The shared storage stores the guest's default file system. The file system image is not sent over the network from the source host to the destination host.
An offline migration suspends the guest then moves an image of the guests memory to the destination host. The guest is resumed on the destination host and the memory the guest used on the source host is freed.
The time an offline migration takes depends on network bandwidth and latency. If the network is experiencing heavy use or low bandwidth the migration will take much longer.
A live migration keeps the guest running on the source host and begins moving the memory without stopping the guest. All modified memory pages are monitored for changes and sent to the destination while the image is sent. The memory is updated with the changed pages. The process continues until the amount of pause time allowed for the guest equals the predicted time for the final few pages to be transferred. KVM estimates the time remaining and attempts to transfer the maximum amount of page files from the source to the destination until KVM predicts the amount of remaining pages can be transferred during a very brief time while the virtualized guest is paused. The registers are loaded on the new host and the guest is then resumed on the destination host. If the guest cannot be merged (which happens when guests are under extreme loads) the guest is paused and then an offline migration is started instead.
18.1. Live migration requirements
Migrating guests requires the following:
A virtualized guest installed on shared networked storage using one of the following protocols:
Two or more Red Hat Enterprise Linux systems of the same version with the same updates.
Both systems must have the appropriate ports open.
Both systems must have identical network configurations. All bridging and network configurations must be exactly the same on both hosts.
Shared storage must mount at the same location on source and destination systems. The mounted directory name must be identical.