Hi All,

Sorry, I do not know to reply the previous message directly, so I have to manually copy them here.

I have two questions about the following issue?

1. I follow the instructions blew to migrate a vm with snapshots. When I perform 'virsh snapshot-create --redefine $dom file' on the destination.' I got an error saying that "no domain with matching name $dom". I'm wondering during the mgiration, what do we need to do in the destination? create a new base file?

2. What does the following instruction do?

"you then loop over 'virsh snapshot-delete --metadata $dom
$name' on the source, at which point, live migration will now work."
3. Also, could you explain a little about the high level techniques for this function.
suppose we have a vm with one base file and two snapshots. How does the following instructions do to migrate all of them?

Thanks!
Edward



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

Attachment: signature.asc
Description: OpenPGP digital signature