[libvirt] [PATCH] Don't generate cookies with v2 migration protocol.

The v2 migration protocol had a limit on cookie length that was too small to be useful for QEMU. Avoid generating cookies with v2 protocol, so that old libvirtd can still reliably migrate a guest to new libvirtd uses v2 protocol. * src/qemu/qemu_driver.c: Avoid migration cookies with v2 migration --- src/qemu/qemu_driver.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f9c8e7..44acc6a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5867,8 +5867,8 @@ cleanup: */ static int ATTRIBUTE_NONNULL (5) qemudDomainMigratePrepare2 (virConnectPtr dconn, - char **cookie, - int *cookielen, + char **cookie ATTRIBUTE_UNUSED, + int *cookielen ATTRIBUTE_UNUSED, const char *uri_in, char **uri_out, unsigned long flags, @@ -5906,9 +5906,12 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, goto cleanup; } + /* Do not use cookies in v2 protocol, since the cookie + * length was not sufficiently large, causing failures + * migrating between old & new libvirtd + */ ret = qemuMigrationPrepareDirect(driver, dconn, - NULL, 0, /* No input cookies in v2 */ - cookie, cookielen, + NULL, 0, NULL, NULL, /* No cookies */ uri_in, uri_out, dname, dom_xml); @@ -5921,8 +5924,8 @@ cleanup: /* Perform is the second step, and it runs on the source host. */ static int qemudDomainMigratePerform (virDomainPtr dom, - const char *cookie ATTRIBUTE_UNUSED, - int cookielen ATTRIBUTE_UNUSED, + const char *cookie, + int cookielen, const char *uri, unsigned long flags, const char *dname, @@ -5951,6 +5954,12 @@ qemudDomainMigratePerform (virDomainPtr dom, goto cleanup; } + /* Do not output cookies in v2 protocol, since the cookie + * length was not sufficiently large, causing failures + * migrating between old & new libvirtd. + * + * Consume any cookie we were able to decode though + */ ret = qemuMigrationPerform(driver, dom->conn, vm, uri, cookie, cookielen, NULL, NULL, /* No output cookies in v2 */ @@ -5997,8 +6006,12 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn, goto cleanup; } + /* Do not use cookies in v2 protocol, since the cookie + * length was not sufficiently large, causing failures + * migrating between old & new libvirtd + */ dom = qemuMigrationFinish(driver, dconn, vm, - NULL, 0, NULL, NULL, /* No cookies in v2 */ + NULL, 0, NULL, NULL, /* No cookies */ flags, retcode); cleanup: -- 1.7.4.4

On 05/18/2011 11:08 AM, Daniel P. Berrange wrote:
The v2 migration protocol had a limit on cookie length that was too small to be useful for QEMU. Avoid generating cookies with v2 protocol, so that old libvirtd can still reliably migrate a guest to new libvirtd uses v2 protocol.
* src/qemu/qemu_driver.c: Avoid migration cookies with v2 migration --- src/qemu/qemu_driver.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-)
Is it any better to try generating the cookie, and only discard it if it was too long, than to blindly skip the cookie? Or are we pretty sure that the cookie will always be longer than the old limit (256, if I'm reading REMOTE_MIGRATE_COOKIE_MAX correctly in remote_protocol.x)? If the latter, then ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Wed, May 18, 2011 at 11:47:25AM -0600, Eric Blake wrote:
On 05/18/2011 11:08 AM, Daniel P. Berrange wrote:
The v2 migration protocol had a limit on cookie length that was too small to be useful for QEMU. Avoid generating cookies with v2 protocol, so that old libvirtd can still reliably migrate a guest to new libvirtd uses v2 protocol.
* src/qemu/qemu_driver.c: Avoid migration cookies with v2 migration --- src/qemu/qemu_driver.c | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-)
Is it any better to try generating the cookie, and only discard it if it was too long, than to blindly skip the cookie? Or are we pretty sure that the cookie will always be longer than the old limit (256, if I'm reading REMOTE_MIGRATE_COOKIE_MAX correctly in remote_protocol.x)?
If the latter, then ACK.
Yep, it is always going to be longer. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake