Dear Eric,<div><br></div><div>Thanks for your tips and explanations.</div><div><br></div><div>I think there will be lots of works to do.</div><div><br></div><div>And I migrate VM with snapshot successfully by your tips.</div>
<div><br></div><div>Thank you so much. I am really appreciated.</div><div><br></div><div>Hubert</div><div><br></div><div><br></div><div><div class="gmail_quote">On Thu, Mar 21, 2013 at 11:40 AM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/20/2013 08:45 PM, Chiang Hubert wrote:<br>
> Hello,<br>
><br>
> I'd like to live migration with snapshots.<br>
><br>
> But it doesn't work. It comes out a message "cannot migrate domain with 1<br>
> snapshots"<br>
<br>
Unfortunately, figuring out how to migrate snapshot information at the<br>
libvirt API level requires some engineering work - the current RPC<br>
protocol for migration is not set up to migrate an arbitrary amount of<br>
snapshots in a single call.<br>
<br>
On the other hand, if you are allowed to make more than one API call,<br>
the solution is already available; maybe we should patch virsh to learn<br>
how to make the series of API calls, to automate what I will describe below.<br>
<br>
><br>
> Then I try to trace the code(Libvirt 0.9.8 to 1.0.3), I find out the code<br>
> in src/qemu/qemu_migration.c @ Line 1395 - 1440 (Libvirt 1.0.3)<br>
<br>
It's still unimplemented at the libvirt level, even in libvirt.git.<br>
<br>
><br>
> It will check the VM which has snapshots or not.<br>
><br>
> I just curious about this limitation, why the VM can't live migration with<br>
> snapshots?<br>
<br>
Doing it all in one RPC call would be a potential denial-of-service<br>
(RPCs are bounded in length to avoid consuming server resources, and<br>
taking lots of snapshots on the source could easily be made to exceed<br>
bounds).  If someone can design a way to set up a series of RPC<br>
handshakes, then we could do it at the libvirt level in a single API<br>
call, but I'm not sure it is worth it.<br>
<br>
><br>
> What happen if I skip this check?<br>
><br>
> Does it has any suggestion way or virsh command with options to do live<br>
> migration with snapshots?<br>
<br>
The existing solution at the management tool layer is to migrate the<br>
snapshot information first, and then to migrate the domain.  For each<br>
snapshot in 'virsh snapshot-list --name $dom', you will want to 'virsh<br>
snapshot-dumpxml $dom $name > file' on the source, then 'virsh<br>
snapshot-create --redefine $dom file' on the destination.  Next,<br>
determine 'virsh snapshot-current --name $dom' on the source, and use<br>
'virsh snapshot-current $dom $name' on the destination to set it as<br>
current (if there is a current snapshot).  After the destination has all<br>
the snapshots, you then loop over 'virsh snapshot-delete --metadata $dom<br>
$name' on the source, at which point, live migration will now work.<br>
<br>
Patches to teach virsh how to do all this work in a single 'virsh<br>
migrate' are welcome.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Eric Blake   eblake redhat com    <a href="tel:%2B1-919-301-3266" value="+19193013266">+1-919-301-3266</a><br>
Libvirt virtualization library <a href="http://libvirt.org" target="_blank">http://libvirt.org</a><br>
<br>
</font></span></blockquote></div><br></div>