Re: [PATCH 5/9] Fix SPICE seemless migration hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/5/24 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> ---
> Âsrc/qemu/qemu_migration.c | Â 34 ++++++++++++++++++++--------------
> Â1 files changed, 20 insertions(+), 14 deletions(-)

> @@ -434,26 +437,29 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
> Â Â VIR_FREE(tmp);
>
> Â Â /* Check & forbid "localhost" migration */
> - Â Âif (!(tmp = virXPathString("string(./hostname[1])", ctxt))) {
> + Â Âif (!(mig->remoteHostname = virXPathString("string(./hostname[1])", ctxt))) {
> Â Â Â Â qemuReportError(VIR_ERR_INTERNAL_ERROR,
> Â Â Â Â Â Â Â Â Â Â Â Â "%s", _("missing hostname element in migration data"));
> Â Â Â Â goto error;
> Â Â }
> - Â Âif (STREQ(tmp, mig->hostname)) {
> + Â Âif (STREQ(mig->remoteHostname, mig->localHostname)) {
> Â Â Â Â qemuReportError(VIR_ERR_INTERNAL_ERROR,
> Â Â Â Â Â Â Â Â Â Â Â Â _("Attempt to migrate guest to the same host %s"),
> - Â Â Â Â Â Â Â Â Â Â Â Âtmp);
> + Â Â Â Â Â Â Â Â Â Â Â Âmig->remoteHostname);
> Â Â Â Â goto error;
> Â Â }
> - Â ÂVIR_FREE(tmp);
>
> Â Â if (!(tmp = virXPathString("string(./hostuuid[1])", ctxt))) {
> Â Â Â Â qemuReportError(VIR_ERR_INTERNAL_ERROR,
> Â Â Â Â Â Â Â Â Â Â Â Â "%s", _("missing hostuuid element in migration data"));
> Â Â Â Â goto error;
> Â Â }
> - Â ÂvirUUIDFormat(mig->hostuuid, uuidstr);
> - Â Âif (STREQ(tmp, uuidstr)) {
> + Â Âif (virUUIDParse(tmp, mig->remoteHostuuid) < 0) {
> + Â Â Â ÂqemuReportError(VIR_ERR_INTERNAL_ERROR,
> + Â Â Â Â Â Â Â Â Â Â Â Â"%s", _("malformed hostuuid element in migration data"));
> + Â Â Â Âgoto error;
> + Â Â}
> + Â Âif (memcmp(mig->remoteHostuuid, mig->localHostuuid, VIR_UUID_BUFLEN) == 0) {
> Â Â Â Â qemuReportError(VIR_ERR_INTERNAL_ERROR,
> Â Â Â Â Â Â Â Â Â Â Â Â _("Attempt to migrate guest to the same host %s"),
> Â Â Â Â Â Â Â Â Â Â Â Â tmp);

It took me a moment to figure out what the problem here is and how
this patch fixes it. So I suggest you add some explanation to the
commit message.

The problem is that qemuMigrationCookieXMLParse doesn't really parse
the XML formatted cookie into the qemuMigrationCookiePtr pointer but
just compares and validates the XML against the local cookie. But in
qemuDomainMigrateGraphicsRelocate this local cookie is expected to
contain the remote hostname that was never inserted in this cookie.

> @@ -851,7 +857,7 @@ qemuDomainMigrateGraphicsRelocate(struct qemud_driver *driver,
> Â Â qemuDomainObjEnterMonitorWithDriver(driver, vm);
> Â Â ret = qemuMonitorGraphicsRelocate(priv->mon,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â cookie->graphics->type,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcookie->hostname,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcookie->remoteHostname,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â cookie->graphics->port,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â cookie->graphics->tlsPort,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â cookie->graphics->tlsSubject);

This patch fixes that problem by making qemuMigrationCookieXMLParse
storing the remote hostname in the local cookie.

ACK, with an extended commit message.

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]