[libvirt] [PATCH] qemu: Do not require hostuuid in migration cookie

Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases. --- src/qemu/qemu_migration.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a2402ce..487182e 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -576,22 +576,23 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, } if (!(tmp = virXPathString("string(./hostuuid[1])", ctxt))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing hostuuid element in migration data")); - goto error; - } - if (virUUIDParse(tmp, mig->remoteHostuuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed hostuuid element in migration data")); - goto error; - } - if (memcmp(mig->remoteHostuuid, mig->localHostuuid, VIR_UUID_BUFLEN) == 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to migrate guest to the same host %s"), - tmp); - goto error; + VIR_WARN("Missing hostuuid element in migration data; cannot " + "detect migration to the same host"); + } else { + if (virUUIDParse(tmp, mig->remoteHostuuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed hostuuid element in migration data")); + goto error; + } + if (memcmp(mig->remoteHostuuid, mig->localHostuuid, + VIR_UUID_BUFLEN) == 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Attempt to migrate guest to the same host %s"), + tmp); + goto error; + } + VIR_FREE(tmp); } - VIR_FREE(tmp); /* Check to ensure all mandatory features from XML are also * present in 'flags' */ -- 1.7.12.4

On 19.10.2012 16:31, Jiri Denemark wrote:
Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases. --- src/qemu/qemu_migration.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a2402ce..487182e 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -576,22 +576,23 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, }
if (!(tmp = virXPathString("string(./hostuuid[1])", ctxt))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing hostuuid element in migration data")); - goto error; - } - if (virUUIDParse(tmp, mig->remoteHostuuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed hostuuid element in migration data")); - goto error; - } - if (memcmp(mig->remoteHostuuid, mig->localHostuuid, VIR_UUID_BUFLEN) == 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to migrate guest to the same host %s"), - tmp); - goto error; + VIR_WARN("Missing hostuuid element in migration data; cannot " + "detect migration to the same host"); + } else { + if (virUUIDParse(tmp, mig->remoteHostuuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed hostuuid element in migration data")); + goto error; + } + if (memcmp(mig->remoteHostuuid, mig->localHostuuid, + VIR_UUID_BUFLEN) == 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Attempt to migrate guest to the same host %s"), + tmp); + goto error; + } + VIR_FREE(tmp); } - VIR_FREE(tmp);
/* Check to ensure all mandatory features from XML are also * present in 'flags' */
ACK Michal

On Fri, Oct 19, 2012 at 16:53:38 +0200, Michal Privoznik wrote:
On 19.10.2012 16:31, Jiri Denemark wrote:
Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases. --- src/qemu/qemu_migration.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
ACK
Pushed, thanks. Jirka

On Fri, Oct 19, 2012 at 04:31:44PM +0200, Jiri Denemark wrote:
Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases.
Really ? I think I had the hostuuid present in the cookie from the time we first added it to libvirt. 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 :|

On 10/23/2012 09:22 AM, Daniel P. Berrange wrote:
On Fri, Oct 19, 2012 at 04:31:44PM +0200, Jiri Denemark wrote:
Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases.
Really ? I think I had the hostuuid present in the cookie from the time we first added it to libvirt.
Indeed: cookies were added in v0.9.1-148-g8654175, and localHostuuid and remoteHostuuid were added to the cookie as part of v0.9.1-245-gb336710 (same release of 0.9.2). What version of libvirt are you migrating from or to where things broke for you? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Oct 23, 2012 at 09:54:50 -0600, Eric Blake wrote:
On 10/23/2012 09:22 AM, Daniel P. Berrange wrote:
On Fri, Oct 19, 2012 at 04:31:44PM +0200, Jiri Denemark wrote:
Having hostuuid in migration cookie is a nice bonus since it provides an easy way of detecting migration to the same host. However, requiring it breaks backward compatibility with older libvirt releases.
Really ? I think I had the hostuuid present in the cookie from the time we first added it to libvirt.
Indeed: cookies were added in v0.9.1-148-g8654175, and localHostuuid and remoteHostuuid were added to the cookie as part of v0.9.1-245-gb336710 (same release of 0.9.2). What version of libvirt are you migrating from or to where things broke for you?
Oops, this serves as a proof that I actually didn't try it with upstream libvirt :-( I only tried with old RHEL release, which had pre-upstream support for migration cookies... I'll send a revert. Jirka
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Jiri Denemark
-
Michal Privoznik