[libvirt] [PATCH 04/16] Pass graphics setup from dst back to src via migration cookies

Wen Congyang wency at cn.fujitsu.com
Tue May 17 07:54:32 UTC 2011


At 05/13/2011 12:04 AM, Daniel P. Berrange Write:
> Extend the QEMU migration cookie structure to allow information
> about the destination host graphics setup to be passed by to
> the source host. This will enable seamless migration of any
> connected graphics clients
> 
> * src/qemu/qemu_migration.c: Add graphics info to migration
>   cookies
> * daemon/libvirtd.c: Always initialize gnutls to enable
>   x509 cert parsing in QEMU

snip

> +static qemuMigrationCookieGraphicsPtr
> +qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt)
> +{
> +    qemuMigrationCookieGraphicsPtr grap;
> +    char *tmp;
> +
> +    if (VIR_ALLOC(grap) < 0)
> +        goto no_memory;
> +
> +    if (!(tmp = virXPathString("string(./graphics/@type)", ctxt))) {
> +        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                        "%s", _("missing type attribute in migration data"));
> +        goto error;
> +    }
> +    if ((grap->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
> +        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                        _("unknown graphics type %s"), tmp);
> +        VIR_FREE(tmp);
> +        goto error;
> +    }
> +    if (virXPathInt("string(./graphics/@port)", ctxt, &grap->port) < 0) {
> +        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                        "%s", _("missing port attribute in migration data"));
> +        goto error;
> +    }
> +    if (grap->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
> +        if (virXPathInt("string(./graphics/@tlsPort)", ctxt, &grap->tlsPort) < 0) {
> +            qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                            "%s", _("missing tlsPort attribute in migration data"));
> +            goto error;
> +        }
> +    }
> +    if (!(grap->listen = virXPathString("string(./graphics/@listen)", ctxt))) {

If we specify graphics like this:
    <graphics type='vnc' autoport='yes' listen=''/>

virXPathString() will return NULL, and migration will fail.

> +        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                        "%s", _("missing listen attribute in migration data"));
> +        goto error;
> +    }
> +    /* Optional */
> +    grap->tlsSubject = virXPathString("string(./graphics/cert[ info='subject']/@value)", ctxt);
> +
> +




More information about the libvir-list mailing list