These are notes on some live migration testing I did.
Prerequisites:
- set up identity keys so current host can ssh to target host
- entries for both hosts in /etc/hosts on the current host
Steps:
- create linked clone qcow2 file on target that has the same path and filename as on the current host
- qemu-img create -f qcow2 -b <backing file> <new file>
- use virsh dumpxml <domain> | grep -A 6 'disk type' | grep source on the current host to get the disk image for the domain
- use qemu-img info <filename> on the current host to get the backing file for the disk image
- migrate the domain
- virsh migrate --verbose --undefinesource --persistent --live --copy-storage-inc <domain> qemu+ssh://<target host>/system
- undefinesource causes it to get removed from the current host if successful
- persistent saves it in /etc/libvirt/qemu
- live keeps the domain running
- copy-storage-inc only copies the new parts (i.e. it knows the backing file is the same)
- set the domain to autostart on the new host
- remove the old linked clone from the original host
- rm <filename> (this is the same path found from the virsh dumpxml <domain> | grep -A 6 'disk type' | grep source command)
Notes:
- testing showed that the backing file does not need to be on a shared filesystem mounted on both the source and target hosts as long as they both have a copy of the same backing file
- using the --copy-storage-all option worked as well; the disk image on the target host was created without a backing file and was specified to be the same size as the original backing file; it took about 15 minutes to migrate a 32 GB image; one issue is that the migrated disk file is no longer thinly provisioned
- using --copy-storage-inc to copy from a non linked clone to a linked clone copies the full initial disk
- using virt-manager to migrate a Windows 7 VM caused it to blue screen and reboot; it came back up successfully after the reboot
- using virt-manager to migrate a CentOS 6.4 VM was successful