KVM supports live migration, the ability to move a running VM between physical hosts with no service interruption. The VM remains powered-on, network connections remain active, and applications continue to run while the VM is relocated. KVM also saves a VM's current state so that it can be stored and resumed later.
KVM supports numerous storage options which are beyond the scope of this document, however by leveraging NFS as shared storage and load balancing the URL endpoint, we can test the live migration of VMs from one host to another. The command-line tool virsh is used in this instance for simplicity. The user interface virt-manager could also be leveraged, but it requires a separate package installation and a Linux desktop installed on the host.
By executing a continuous ping test to the url endpoint, we can monitor its availability during the live migration from primary to secondary KVM host.
The setup of this environment to gather execution results is beyond the scope of the document, but the testing process is identical as a continuous ping test to the url endpoint during the live migration, as shown in the following example.
# Live migrate the vms from Primary kvm-host1 to Secondary kvm-host2 using virsh
virsh migrate --live invia-vm1 qemu+ssh://kvm-user@kvm-host2/system
virsh migrate --live invia-vm2 qemu+ssh://kvm-user@kvm-host2/system
virsh migrate --live invia-vm3 qemu+ssh://kvm-user@kvm-host2/system
For more information, see the libvirt documentation regarding Guest migration.