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

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



2011/5/24 Daniel P. Berrange <berrange redhat com>:
> ---
>  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


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