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

Re: [libvirt] [PATCH v2 06/12] graphics: introduce listen type=socket and use it for VNC



On Wed, May 11, 2016 at 08:13:37PM +0200, Marc-André Lureau wrote:
>  Hi
> 
> On Wed, May 11, 2016 at 5:08 PM, Pavel Hrdina <phrdina redhat com> wrote:
> > Introduce a new listen type that will be used to tell a graphics device
> > to listen on unix socket and use it for VNC graphics instead of socket
> > attribute.  The socket attribute will remain in the XML for backward
> > compatibility.
> >
> > Since old libvirt supports 'socket' attribute inside 'graphics' element
> > for socket path provided by user libvirt will generate migratable XML
> > without that listen type='socket' but only with 'socket' attribute in
> > order to be able to migrate back to old libvirt.
> >
> > Signed-off-by: Pavel Hrdina <phrdina redhat com>
> > ---

[...]

> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 990cab0..fd071e1 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -561,7 +561,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
> >  VIR_ENUM_IMPL(virDomainGraphicsListen, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST,
> >                "none",
> >                "address",
> > -              "network")
> > +              "network",
> > +              "socket")
> >
> >  VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
> >                VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
> > @@ -1229,6 +1230,7 @@ virDomainGraphicsListenDefClear(virDomainGraphicsListenDefPtr def)
> >
> >      VIR_FREE(def->address);
> >      VIR_FREE(def->network);
> > +    VIR_FREE(def->socket);
> >      return;
> >  }
> >
> > @@ -1242,7 +1244,6 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
> >
> >      switch (def->type) {
> >      case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
> > -        VIR_FREE(def->data.vnc.socket);
> >          VIR_FREE(def->data.vnc.keymap);
> >          virDomainGraphicsAuthDefClear(&def->data.vnc.auth);
> >          break;
> > @@ -10786,8 +10787,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
> >      char *type = virXMLPropString(node, "type");
> >      char *address = virXMLPropString(node, "address");
> >      char *network = virXMLPropString(node, "network");
> > +    char *socket = virXMLPropString(node, "socket");
> 
> Missing corresponding VIR_FREE(socket) under error:

I'll fix it.

[...]

> > @@ -4460,12 +4461,39 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
> >          for (j = 0; j < graphics->nListens; j++) {
> >              virDomainGraphicsListenDefPtr glisten = &graphics->listens[j];
> >
> > -            if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS &&
> > -                !glisten->address && listenAddr) {
> > -                if (VIR_STRDUP(glisten->address, listenAddr) < 0)
> > -                    goto cleanup;
> > -
> > -                glisten->fromConfig = true;
> > +            switch (glisten->type) {
> > +            case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
> > +                if (!glisten->address) {
> > +                    /* If there is no address specified and qemu.conf has
> > +                     * vnc_auto_unix_socket set we should use unix socket as
> > +                     * default instead of tcp listen. */
> > +                    if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
> > +                        cfg->vncAutoUnixSocket) {
> > +                        memset(glisten, 0, sizeof(virDomainGraphicsListenDef));
> 
> Why not calling virDomainGraphicsListenDefClear() ?

Because it doesn't do what I want to clear with the memset.  That function frees
the address, network and socket strings but doesn't clear ports.  In this
particular case those strings are NULL and there is no need to free them, I need
to only set all ports to 0.

Thanks, Pavel


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