
On 03/20/2013 08:45 PM, Chiang Hubert wrote:
Hello,
I'd like to live migration with snapshots.
But it doesn't work. It comes out a message "cannot migrate domain with 1 snapshots"
Unfortunately, figuring out how to migrate snapshot information at the libvirt API level requires some engineering work - the current RPC protocol for migration is not set up to migrate an arbitrary amount of snapshots in a single call. On the other hand, if you are allowed to make more than one API call, the solution is already available; maybe we should patch virsh to learn how to make the series of API calls, to automate what I will describe below.
Then I try to trace the code(Libvirt 0.9.8 to 1.0.3), I find out the code in src/qemu/qemu_migration.c @ Line 1395 - 1440 (Libvirt 1.0.3)
It's still unimplemented at the libvirt level, even in libvirt.git.
It will check the VM which has snapshots or not.
I just curious about this limitation, why the VM can't live migration with snapshots?
Doing it all in one RPC call would be a potential denial-of-service (RPCs are bounded in length to avoid consuming server resources, and taking lots of snapshots on the source could easily be made to exceed bounds). If someone can design a way to set up a series of RPC handshakes, then we could do it at the libvirt level in a single API call, but I'm not sure it is worth it.
What happen if I skip this check?
Does it has any suggestion way or virsh command with options to do live migration with snapshots?
The existing solution at the management tool layer is to migrate the snapshot information first, and then to migrate the domain. For each snapshot in 'virsh snapshot-list --name $dom', you will want to 'virsh snapshot-dumpxml $dom $name > file' on the source, then 'virsh snapshot-create --redefine $dom file' on the destination. Next, determine 'virsh snapshot-current --name $dom' on the source, and use 'virsh snapshot-current $dom $name' on the destination to set it as current (if there is a current snapshot). After the destination has all the snapshots, you then loop over 'virsh snapshot-delete --metadata $dom $name' on the source, at which point, live migration will now work. Patches to teach virsh how to do all this work in a single 'virsh migrate' are welcome. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org