Re: [libvirt] [PATCH v2 06/12] graphics: introduce listen type=socket and use it for VNC
On Thu, May 12, 2016 at 01:06:41PM +0200, Christophe Fergeau wrote: > Hey, > > On Wed, May 11, 2016 at 05:08:25PM +0200, Pavel Hrdina 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> > --- > > docs/formatdomain.html.in | 16 +++ > > docs/schemas/domaincommon.rng | 10 ++ > > src/conf/domain_conf.c | 119 > > - > > src/conf/domain_conf.h | 8 +- > > src/libvirt_private.syms | 1 + > > src/qemu/qemu_command.c| 45 > > src/qemu/qemu_domain.c | 19 ++-- > > src/qemu/qemu_hotplug.c| 9 ++ > > src/qemu/qemu_parse_command.c | 2 +- > > src/qemu/qemu_process.c| 47 ++-- > > src/security/virt-aa-helper.c | 15 ++- > > .../generic-graphics-vnc-socket-listen.xml | 4 +- > > .../generic-graphics-vnc-socket.xml| 4 +- > > .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- > > .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 > > .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 ++ > > .../qemuxml2argv-graphics-vnc-socket.args | 4 +- > > .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- > > tests/qemuxml2argvtest.c | 2 + > > .../qemuxml2xmlout-graphics-vnc-auto-socket.xml| 35 ++ > > .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 4 +- > > .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ > > tests/qemuxml2xmltest.c| 2 + > > 23 files changed, 361 insertions(+), 84 deletions(-) > > create mode 100644 > > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args > > create mode 100644 > > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml > > create mode 100644 > > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml > > create mode 100644 > > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml > > > > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in > > index b0847b7..f67076d 100644 > > --- a/docs/formatdomain.html.in > > +++ b/docs/formatdomain.html.in > > @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null > >address. > > > > > > + socket since 1.3.5 > > + > > + > > + This listen type tells a graphics server to listen on unix > > socket. > > + Attribute socket contains a path to unix socket. If > > this > > + attribute is omitted libvirt will generate this path for you. > > + Supported by graphics type vnc. > > + > > + > > + For vnc graphics be backward compatible > > + the socket attribute of first listen > > element > > + is duplicated as socket attribute in > > graphics > > + element. If graphics element contains a > > socket > > + attribute all listen elements are ignored. > > + > > > If both a socket attribute and a listen type="socket" node are present, > shouldn't this check if they are using the same path? This is what is > done for 'listen' attribute and listen type="address", but I could not > find the same thing in this patch. I know, that I had that code somewhere but I cannot remember why I didn't use it. I can probably add this check in to the code. Right know I can think of only one case, where it could break things: if some application uses socket and tries to change it. But in that case it's probably OK to print an error. > > > + > > > > > > Video devices > > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng > > index e7eda77..e3dbcc6 100644 > > --- a/docs/schemas/domaincommon.rng > > +++ b/docs/schemas/domaincommon.rng > > @@ -3014,6 +3014,16 @@ > > > > > > > > + > > + > > + socket > > + > > + > > + > > + > > + > > + > > + > > Imo this would be better as > > > This would be more consistent with /disk/source/host > vhost-user also uses type="unix" but with a path attribute rather than > socket > There is also
Re: [libvirt] [PATCH v2 06/12] graphics: introduce listen type=socket and use it for VNC
Hey, On Wed, May 11, 2016 at 05:08:25PM +0200, Pavel Hrdina 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> --- > docs/formatdomain.html.in | 16 +++ > docs/schemas/domaincommon.rng | 10 ++ > src/conf/domain_conf.c | 119 > - > src/conf/domain_conf.h | 8 +- > src/libvirt_private.syms | 1 + > src/qemu/qemu_command.c| 45 > src/qemu/qemu_domain.c | 19 ++-- > src/qemu/qemu_hotplug.c| 9 ++ > src/qemu/qemu_parse_command.c | 2 +- > src/qemu/qemu_process.c| 47 ++-- > src/security/virt-aa-helper.c | 15 ++- > .../generic-graphics-vnc-socket-listen.xml | 4 +- > .../generic-graphics-vnc-socket.xml| 4 +- > .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- > .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 > .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 ++ > .../qemuxml2argv-graphics-vnc-socket.args | 4 +- > .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- > tests/qemuxml2argvtest.c | 2 + > .../qemuxml2xmlout-graphics-vnc-auto-socket.xml| 35 ++ > .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 4 +- > .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ > tests/qemuxml2xmltest.c| 2 + > 23 files changed, 361 insertions(+), 84 deletions(-) > create mode 100644 > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args > create mode 100644 > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml > create mode 100644 > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml > create mode 100644 > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml > > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in > index b0847b7..f67076d 100644 > --- a/docs/formatdomain.html.in > +++ b/docs/formatdomain.html.in > @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null >address. > > > + socket since 1.3.5 > + > + > + This listen type tells a graphics server to listen on unix socket. > + Attribute socket contains a path to unix socket. If > this > + attribute is omitted libvirt will generate this path for you. > + Supported by graphics type vnc. > + > + > + For vnc graphics be backward compatible > + the socket attribute of first listen > element > + is duplicated as socket attribute in > graphics > + element. If graphics element contains a > socket > + attribute all listen elements are ignored. > + If both a socket attribute and a listen type="socket" node are present, shouldn't this check if they are using the same path? This is what is done for 'listen' attribute and listen type="address", but I could not find the same thing in this patch. > + > > > Video devices > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng > index e7eda77..e3dbcc6 100644 > --- a/docs/schemas/domaincommon.rng > +++ b/docs/schemas/domaincommon.rng > @@ -3014,6 +3014,16 @@ > > > > + > + > + socket > + > + > + > + > + > + > + Imo this would be better as This would be more consistent with /disk/source/host vhost-user also uses type="unix" but with a path attribute rather than socket There is also (again with 'path' rather than 'socket'). Christophe signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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 Hrdinawrote: > > 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 > > --- [...] > > 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(>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 = >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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 06/12] graphics: introduce listen type=socket and use it for VNC
Hi On Wed, May 11, 2016 at 5:08 PM, Pavel Hrdinawrote: > 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 > --- > docs/formatdomain.html.in | 16 +++ > docs/schemas/domaincommon.rng | 10 ++ > src/conf/domain_conf.c | 119 > - > src/conf/domain_conf.h | 8 +- > src/libvirt_private.syms | 1 + > src/qemu/qemu_command.c| 45 > src/qemu/qemu_domain.c | 19 ++-- > src/qemu/qemu_hotplug.c| 9 ++ > src/qemu/qemu_parse_command.c | 2 +- > src/qemu/qemu_process.c| 47 ++-- > src/security/virt-aa-helper.c | 15 ++- > .../generic-graphics-vnc-socket-listen.xml | 4 +- > .../generic-graphics-vnc-socket.xml| 4 +- > .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- > .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 > .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 ++ > .../qemuxml2argv-graphics-vnc-socket.args | 4 +- > .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- > tests/qemuxml2argvtest.c | 2 + > .../qemuxml2xmlout-graphics-vnc-auto-socket.xml| 35 ++ > .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 4 +- > .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ > tests/qemuxml2xmltest.c| 2 + > 23 files changed, 361 insertions(+), 84 deletions(-) > create mode 100644 > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args > create mode 100644 > tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml > create mode 100644 > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml > create mode 100644 > tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml > > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in > index b0847b7..f67076d 100644 > --- a/docs/formatdomain.html.in > +++ b/docs/formatdomain.html.in > @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null >address. > > > + socket since 1.3.5 > + > + > + This listen type tells a graphics server to listen on unix socket. > + Attribute socket contains a path to unix socket. If > this > + attribute is omitted libvirt will generate this path for you. > + Supported by graphics type vnc. > + > + > + For vnc graphics be backward compatible > + the socket attribute of first listen > element > + is duplicated as socket attribute in > graphics > + element. If graphics element contains a > socket > + attribute all listen elements are ignored. > + > + > > > Video devices > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng > index e7eda77..e3dbcc6 100644 > --- a/docs/schemas/domaincommon.rng > +++ b/docs/schemas/domaincommon.rng > @@ -3014,6 +3014,16 @@ > > > > + > + > + socket > + > + > + > + > + > + > + > > > > 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); >
[libvirt] [PATCH v2 06/12] graphics: introduce listen type=socket and use it for VNC
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--- docs/formatdomain.html.in | 16 +++ docs/schemas/domaincommon.rng | 10 ++ src/conf/domain_conf.c | 119 - src/conf/domain_conf.h | 8 +- src/libvirt_private.syms | 1 + src/qemu/qemu_command.c| 45 src/qemu/qemu_domain.c | 19 ++-- src/qemu/qemu_hotplug.c| 9 ++ src/qemu/qemu_parse_command.c | 2 +- src/qemu/qemu_process.c| 47 ++-- src/security/virt-aa-helper.c | 15 ++- .../generic-graphics-vnc-socket-listen.xml | 4 +- .../generic-graphics-vnc-socket.xml| 4 +- .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 ++ .../qemuxml2argv-graphics-vnc-socket.args | 4 +- .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- tests/qemuxml2argvtest.c | 2 + .../qemuxml2xmlout-graphics-vnc-auto-socket.xml| 35 ++ .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 4 +- .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ tests/qemuxml2xmltest.c| 2 + 23 files changed, 361 insertions(+), 84 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b0847b7..f67076d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null address. + socket since 1.3.5 + + + This listen type tells a graphics server to listen on unix socket. + Attribute socket contains a path to unix socket. If this + attribute is omitted libvirt will generate this path for you. + Supported by graphics type vnc. + + + For vnc graphics be backward compatible + the socket attribute of first listen element + is duplicated as socket attribute in graphics + element. If graphics element contains a socket + attribute all listen elements are ignored. + + Video devices diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e7eda77..e3dbcc6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3014,6 +3014,16 @@ + + + socket + + + + + + + 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(>data.vnc.auth); break; @@ -10786,8 +10787,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, char *type = virXMLPropString(node, "type"); char *address = virXMLPropString(node, "address"); char *network =