[libvirt] [PATCH v2 01/12] graphics: don't parse listens if socket attribute is present

Marc-André Lureau marcandre.lureau at gmail.com
Wed May 11 18:12:48 UTC 2016


Hi

On Wed, May 11, 2016 at 5:08 PM, Pavel Hrdina <phrdina at redhat.com> wrote:
> If socket attribute is present we start VNC that listens only on that
> unix socket.  This makes the parser behave the same way as we actually
> use the socket attribute.
>
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/conf/domain_conf.c                                            | 8 ++++++++
>  .../genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml  | 4 +---
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 571b7bf..df2258a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -10721,11 +10721,18 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
>      xmlNodePtr save = ctxt->node;
>      virDomainGraphicsListenDefPtr address = NULL;
>      char *listenAddr = NULL;
> +    char *socketPath = NULL;
>      int nListens;
>      int ret = -1;
>
>      ctxt->node = node;
>
> +    if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
> +        (socketPath = virXMLPropString(node, "socket"))) {
> +        ret = 0;
> +        goto error;
> +    }

Even if we keep the <listen> for compatibility purposes, perhaps there
is a log/warning to give that it is ignored.

Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>



> +
>      /* parse the <listen> subelements for graphics types that support it */
>      nListens = virXPathNodeSet("./listen", ctxt, &listenNodes);
>      if (nListens < 0)
> @@ -10778,6 +10785,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def,
>   error:
>      VIR_FREE(listenNodes);
>      VIR_FREE(listenAddr);
> +    VIR_FREE(socketPath);
>      ctxt->node = save;
>      return ret;
>  }
> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml
> index a3b82fe..d8742c6 100644
> --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml
> +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml
> @@ -19,9 +19,7 @@
>      <controller type='pci' index='0' model='pci-root'/>
>      <input type='mouse' bus='ps2'/>
>      <input type='keyboard' bus='ps2'/>
> -    <graphics type='vnc' socket='/tmp/QEMUGuest1-vnc.sock'>
> -      <listen type='address' address='127.0.0.1'/>
> -    </graphics>
> +    <graphics type='vnc' socket='/tmp/QEMUGuest1-vnc.sock'/>
>      <video>
>        <model type='cirrus' vram='16384' heads='1' primary='yes'/>
>      </video>
> --
> 2.8.2
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list



-- 
Marc-André Lureau




More information about the libvir-list mailing list