[libvirt] [PATCH]: Implement Qemu/KVM live migration

All, Attached is a patch to implement Qemu/KVM live migration in libvirt. Now that upstream Qemu has settled on an interface that is friendly to libvirt (i.e. one that doesn't block the monitor on -incoming), we can implement it here. Note that the bulk of this patch was written by Rich Jones quite a while ago. My hand in it has mostly been to forward port it to current libvirt CVS, tweak it for the new Qemu style, and test it out with a recent KVM (kvm-78, in particular). Note that there is a FIXME in the code. When testing this out with kvm-78, I found that if I let the source side kill the source VM immediately after the "migrate" monitor command completed, the migration to the destination would never complete. This seems to be a bug in Qemu; the migrate monitor command shouldn't return until the migrate is really, truly complete. I'm posting this now so I can get reviews, and start to address review comments while I try to figure out what's going on with Qemu. With my temporary hack of the sleep() call in there, though, I was able to successfully live migrate an F-9 guest between two machines. Signed-off-by: Chris Lalancette <clalance@redhat.com>

Chris Lalancette wrote:
Note that there is a FIXME in the code. When testing this out with kvm-78, I found that if I let the source side kill the source VM immediately after the "migrate" monitor command completed, the migration to the destination would never complete. This seems to be a bug in Qemu; the migrate monitor command shouldn't return until the migrate is really, truly complete. I'm posting this now so I can get reviews, and start to address review comments while I try to figure out what's going on with Qemu. With my temporary hack of the sleep() call in there, though, I was able to successfully live migrate an F-9 guest between two machines.
I reported this to upstream Qemu, and it seems that Anthony committed a fix for it. I removed the sleep and re-tested it with Anthony's fix in my copy of KVM, and it seems to have worked. I'll re-submit without the sleep (once I have a few further review comments). -- Chris Lalancette

On Thu, Nov 06, 2008 at 03:10:29PM +0100, Chris Lalancette wrote:
All, Attached is a patch to implement Qemu/KVM live migration in libvirt. Now that upstream Qemu has settled on an interface that is friendly to libvirt (i.e. one that doesn't block the monitor on -incoming), we can implement it here. Note that the bulk of this patch was written by Rich Jones quite a while ago. My hand in it has mostly been to forward port it to current libvirt CVS, tweak it for the new Qemu style, and test it out with a recent KVM (kvm-78, in particular). Note that there is a FIXME in the code. When testing this out with kvm-78, I found that if I let the source side kill the source VM immediately after the "migrate" monitor command completed, the migration to the destination would never complete. This seems to be a bug in Qemu; the migrate monitor command shouldn't return until the migrate is really, truly complete. I'm posting this now so I can get reviews, and start to address review comments while I try to figure out what's going on with Qemu. With my temporary hack of the sleep() call in there, though, I was able to successfully live migrate an F-9 guest between two machines.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Now that the QEMU bug is fixed, I'm inclined to say we should commit this migration support - minus the sleep(5) of course. It is well overdue to have migration in the QEMU driver, and oVirt guys have sanity checked its implementation in their developemnt, so shouldn't be any surprises. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Nov 11, 2008 at 10:11:40PM +0000, Daniel P. Berrange wrote:
On Thu, Nov 06, 2008 at 03:10:29PM +0100, Chris Lalancette wrote:
All, Attached is a patch to implement Qemu/KVM live migration in libvirt. Now that upstream Qemu has settled on an interface that is friendly to libvirt (i.e. one that doesn't block the monitor on -incoming), we can implement it here. Note that the bulk of this patch was written by Rich Jones quite a while ago. My hand in it has mostly been to forward port it to current libvirt CVS, tweak it for the new Qemu style, and test it out with a recent KVM (kvm-78, in particular). Note that there is a FIXME in the code. When testing this out with kvm-78, I found that if I let the source side kill the source VM immediately after the "migrate" monitor command completed, the migration to the destination would never complete. This seems to be a bug in Qemu; the migrate monitor command shouldn't return until the migrate is really, truly complete. I'm posting this now so I can get reviews, and start to address review comments while I try to figure out what's going on with Qemu. With my temporary hack of the sleep() call in there, though, I was able to successfully live migrate an F-9 guest between two machines.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Now that the QEMU bug is fixed, I'm inclined to say we should commit this migration support - minus the sleep(5) of course. It is well overdue to have migration in the QEMU driver, and oVirt guys have sanity checked its implementation in their developemnt, so shouldn't be any surprises.
Agreed, +1 Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Wed, Nov 12, 2008 at 09:29:12AM +0100, Daniel Veillard wrote:
On Tue, Nov 11, 2008 at 10:11:40PM +0000, Daniel P. Berrange wrote:
Now that the QEMU bug is fixed, I'm inclined to say we should commit this migration support - minus the sleep(5) of course. It is well overdue to have migration in the QEMU driver, and oVirt guys have sanity checked its implementation in their developemnt, so shouldn't be any surprises.
Agreed, +1
Done, I commited the patch, I removed the superfluous timeout and cleared a couple of things raised by syntax-check, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Chris Lalancette
-
Daniel P. Berrange
-
Daniel Veillard