Is there any possible way to perform live migration using KVM/QEMU/libvirt without stopping source VM after migration?
I want to make full consistent backup of VM under KVM hypervisor without stopping of this VM.
So idea is to perform live migration without stopping source VM, than after successful migration stop VM on destination host using completely correct stopping procedure, and make full offline copy of it without interruption of source VM working.
But in default setup, source VM stops working after successful migration, so I have to start it again. Is there any possible way to change this behaviour?
Any suggestions are welcomed.
This isn’t possible with live migration – there’s no way to prevent libvirt switching execution to the target VM & tearing down the source VM once migration completes.
Fortunately you don’t need migration in order to do full disk backups on running VMs. Libvirt / QEMU has support for live disk snapshotting.
Essentially you tell QEMU to add a temporary qcow2 overlay to the existing disk, so writes start going to the overlay disk. Now you can safely take a backup of the original base disk image, using cp, rsync, $whatever. Once you’ve taken a backup you can tell QEMU to merge the overlay back into the base image, pivot writes to the base image, and throw away the temporary overlay. Example commands are shown here:
If you have multiple disks on the VM and want the snapshot to be at a consistent point in time across all disks, then you can use the QEMU guest agent to quiesce guest I/O while adding the overlays. The guest agent is not required if you only have a single disk, as QEMU can do the disk pivots atomically in that case.
Source : Link , Question Author : Ivan Olshansky , Answer Author : DanielB