[libvirt] [PATCH v3 00/14] improve graphics listen configuration

This patch series improves the way how different listen types can be specified and also introduce a new listen types for graphics devices. First improvement is to move ports out of graphics element into listen element with type address or network. This is a first step to make the code listen-driven. Second step is to create a new listen type socket to improve the current vnc configuration and to print only socket path witout any other listen types. With the new socket type now we can add support also to spice graphics. The last improvement is to introduce new listen type none for spice and vnc graphics to specify that the spice graphics shouldn't listen anywhere by default. In case of spice graphics the new listen types socket or none are required to start a guest with OpenGL support. Changes in v3: - add listen type none support for vnc - fix issues pointed out in v2 Changes in v2: - don't remove vnc_auto_unix_socket from qemu.conf - add spice_auto_unix_socket Pavel Hrdina (14): graphics: don't parse listens if socket attribute is present domain_conf: parse listen attribute while parsing listen elements graphics: make address attribute for listen type='address' optional domain_conf: cleanup virDomainGraphicsListenDefParseXML graphics: move port definition to listen element graphics: introduce listen type=socket and use it for VNC qemu_capabilites: add QEMU_CAPS_SPICE_UNIX qemu_command: refactor spice channel code spice: add support for listen type socket qemu_process: separate graphics socket and address generation tests: cleanup vnc auto socket test spice: introduce spice_auto_unix_socket config option spice: introduce listen type none vnc: add support for listen type none docs/formatdomain.html.in | 141 +++-- docs/schemas/domaincommon.rng | 63 +- src/conf/domain_conf.c | 637 ++++++++++++++------- src/conf/domain_conf.h | 31 +- src/libvirt_private.syms | 1 + src/libxl/libxl_conf.c | 53 +- src/libxl/libxl_domain.c | 17 +- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 17 +- src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 273 +++++---- src/qemu/qemu_conf.c | 1 + src/qemu/qemu_conf.h | 1 + src/qemu/qemu_domain.c | 19 +- src/qemu/qemu_hotplug.c | 40 +- src/qemu/qemu_migration.c | 50 +- src/qemu/qemu_parse_command.c | 41 +- src/qemu/qemu_process.c | 351 ++++++++---- src/qemu/test_libvirtd_qemu.aug.in | 1 + src/security/virt-aa-helper.c | 15 +- src/vbox/vbox_common.c | 30 +- src/vbox/vbox_tmpl.c | 34 +- src/vbox/vbox_uniformed_api.h | 4 +- src/vmx/vmx.c | 54 +- src/vz/vz_sdk.c | 30 +- src/xenconfig/xen_common.c | 75 ++- src/xenconfig/xen_sxpr.c | 71 +-- src/xenconfig/xen_xl.c | 45 +- .../generic-graphics-listen-back-compat-ports.xml | 30 + ...generic-graphics-vnc-listen-element-minimal.xml | 2 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 + ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 + ...hics-vnc-socket-attr-listen-socket-mismatch.xml | 30 + ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 + .../generic-graphics-listen-back-compat-ports.xml | 30 + .../generic-graphics-listen-back-compat.xml | 2 +- .../generic-graphics-vnc-listen-attr-only.xml | 2 +- ...generic-graphics-vnc-listen-element-minimal.xml | 4 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 + ...ic-graphics-vnc-listen-element-with-address.xml | 2 +- .../generic-graphics-vnc-manual-port.xml | 4 +- .../generic-graphics-vnc-minimal.xml | 4 +- ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 + ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 + .../generic-graphics-vnc-socket-listen.xml | 2 +- .../generic-graphics-vnc-socket.xml | 4 +- tests/genericxml2xmltest.c | 7 + .../qemuargv2xml-graphics-vnc-policy.xml | 2 +- .../qemuargv2xml-graphics-vnc-sasl.xml | 2 +- .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- .../qemuargv2xml-graphics-vnc-tls.xml | 2 +- .../qemuargv2xml-graphics-vnc-websocket.xml | 2 +- .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml | 2 +- ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- ...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 + ...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 + .../qemuxml2argv-graphics-spice-auto-socket.args | 20 + .../qemuxml2argv-graphics-spice-auto-socket.xml | 30 + .../qemuxml2argv-graphics-spice-socket.args | 20 + .../qemuxml2argv-graphics-spice-socket.xml | 30 + .../qemuxml2argv-graphics-vnc-auto-socket-cfg.args | 22 + .../qemuxml2argv-graphics-vnc-auto-socket-cfg.xml | 34 ++ .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 + .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 + .../qemuxml2argv-graphics-vnc-autosocket.args | 22 - .../qemuxml2argv-graphics-vnc-autosocket.xml | 34 -- .../qemuxml2argv-graphics-vnc-socket.args | 4 +- .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +- tests/qemuxml2argvtest.c | 16 + .../qemuxml2xmlout-graphics-listen-network.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 4 +- ...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-auto-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-compression.xml | 2 +- .../qemuxml2xmlout-graphics-spice-qxl-vga.xml | 2 +- .../qemuxml2xmlout-graphics-spice-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-timeout.xml | 4 +- .../qemuxml2xmlout-graphics-spice.xml | 2 +- ...qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml | 41 ++ .../qemuxml2xmlout-graphics-vnc-auto-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 39 -- .../qemuxml2xmlout-graphics-vnc-no-listen-attr.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-sasl.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-vnc-tls.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-websocket.xml | 2 +- .../qemuxml2xmlout-graphics-vnc.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 4 +- .../qemuxml2xmlout-net-bandwidth.xml | 4 +- .../qemuxml2xmlout-net-bandwidth2.xml | 4 +- .../qemuxml2xmlout-pci-bridge.xml | 2 +- ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 3 +- tests/qemuxml2xmltest.c | 19 +- tests/sexpr2xmldata/sexpr2xml-curmem.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 4 +- .../sexpr2xml-fv-serial-dev-2-ports.xml | 4 +- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 4 +- .../sexpr2xml-fv-serial-tcp-telnet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 4 +- .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 2 +- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-vif-rate.xml | 4 +- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 4 +- .../test-disk-positional-parms-full.xml | 2 +- .../test-disk-positional-parms-partial.xml | 2 +- ...est-fullvirt-direct-kernel-boot-bogus-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot.xml | 2 +- tests/xlconfigdata/test-fullvirt-multiusb.xml | 2 +- tests/xlconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xlconfigdata/test-new-disk.xml | 2 +- tests/xlconfigdata/test-rbd-multihost-noauth.xml | 2 +- tests/xlconfigdata/test-spice-features.xml | 2 +- tests/xlconfigdata/test-spice.xml | 2 +- tests/xlconfigdata/test-vif-rate.xml | 2 +- tests/xmconfigdata/test-escape-paths.xml | 2 +- .../xmconfigdata/test-fullvirt-default-feature.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-hpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-localtime.xml | 2 +- tests/xmconfigdata/test-fullvirt-net-netfront.xml | 2 +- tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 2 +- tests/xmconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 2 +- .../test-fullvirt-serial-dev-2-ports.xml | 2 +- .../test-fullvirt-serial-dev-2nd-port.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-file.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-null.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pty.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 2 +- .../test-fullvirt-serial-tcp-telnet.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-udp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-unix.xml | 2 +- tests/xmconfigdata/test-fullvirt-sound.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbtablet.xml | 2 +- tests/xmconfigdata/test-fullvirt-utc.xml | 2 +- tests/xmconfigdata/test-no-source-cdrom.xml | 4 +- tests/xmconfigdata/test-paravirt-net-e1000.xml | 2 +- tests/xmconfigdata/test-paravirt-net-vifname.xml | 2 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 2 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 2 +- tests/xmconfigdata/test-pci-devs.xml | 4 +- 172 files changed, 2310 insertions(+), 987 deletions(-) create mode 100644 tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml -- 2.8.2

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@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 ed0c471..0ae8e4d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10737,11 +10737,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; + } + /* parse the <listen> subelements for graphics types that support it */ nListens = virXPathNodeSet("./listen", ctxt, &listenNodes); if (nListens < 0) @@ -10794,6 +10801,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

Move the compatibility code out of virDomainGraphicsListensParseXML() into virDomainGraphicsListenDefParseXML(). This also fixes a small inconsistency between the code and error message itself. Before this patch we would search first listen element that is type='address' to validate listen and address attributes. After this patch we always take the first listen element regardless of the type. This shouldn't break anything since all drivers supports only one listen. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 85 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0ae8e4d..1d44fb6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10656,18 +10656,36 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, return 0; } + +/** + * virDomainGraphicsListenDefParseXML: + * @def: listen def pointer to be filled + * @node: xml node of <listen/> element + * @parent: xml node of <graphics/> element + * @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_* + * + * Parses current <listen/> element from @node to @def. For backward + * compatibility the @parent element should contain node of <graphics/> element + * for the first <listen/> element in order to validate attributes from both + * elements. + */ static int virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, xmlNodePtr node, + xmlNodePtr parent, unsigned int flags) { int ret = -1; - char *type = virXMLPropString(node, "type"); - char *address = virXMLPropString(node, "address"); - char *network = virXMLPropString(node, "network"); + char *type = virXMLPropString(node, "type"); + char *address = virXMLPropString(node, "address"); + char *network = virXMLPropString(node, "network"); char *fromConfig = virXMLPropString(node, "fromConfig"); + char *addressCompat = NULL; int tmp, typeVal; + if (parent) + addressCompat = virXMLPropString(parent, "listen"); + if (!type) { virReportError(VIR_ERR_XML_ERROR, "%s", _("graphics listen type must be specified")); @@ -10681,9 +10699,21 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } def->type = typeVal; - /* address is recognized if either type='address', or if - * type='network' and we're looking at live XML (i.e. *not* - * inactive). It is otherwise ignored. */ + if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { + if (address && addressCompat && STRNEQ(address, addressCompat)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("graphics 'listen' attribute '%s' must match " + "'address' attribute of first listen element " + "(found '%s')"), addressCompat, address); + goto error; + } + + if (!address) { + address = addressCompat; + addressCompat = NULL; + } + } + if (address && address[0] && (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK && @@ -10723,6 +10753,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, VIR_FREE(address); VIR_FREE(network); VIR_FREE(fromConfig); + VIR_FREE(addressCompat); return ret; } @@ -10735,8 +10766,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, { xmlNodePtr *listenNodes = NULL; xmlNodePtr save = ctxt->node; - virDomainGraphicsListenDefPtr address = NULL; - char *listenAddr = NULL; + virDomainGraphicsListenDef newListen = {0}; char *socketPath = NULL; int nListens; int ret = -1; @@ -10763,44 +10793,31 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, for (i = 0; i < nListens; i++) { if (virDomainGraphicsListenDefParseXML(&def->listens[i], listenNodes[i], + i == 0 ? node : NULL, flags) < 0) goto error; - if (!address && - def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) - address = &def->listens[i]; - def->nListens++; } VIR_FREE(listenNodes); - } - - /* listen attribute of <graphics> is also supported by these, - * but must match the 'address' attribute of the first listen - * that is type='address' (if present) */ - listenAddr = virXMLPropString(node, "listen"); - if (STREQ_NULLABLE(listenAddr, "")) - VIR_FREE(listenAddr); + } else { + /* If no <listen/> element was found in XML for backward compatibility + * we should try to parse 'listen' attribute from <graphics/> element. */ + newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; + newListen.address = virXMLPropString(node, "listen"); + if (STREQ_NULLABLE(newListen.address, "")) + VIR_FREE(newListen.address); - if (address && listenAddr && - STRNEQ_NULLABLE(address->address, listenAddr)) { - virReportError(VIR_ERR_XML_ERROR, - _("graphics listen attribute %s must match address " - "attribute of first listen element (found %s)"), - listenAddr, address->address); - goto error; + if (newListen.address && + VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) + goto error; } - /* There were no <listen> elements, so we can just - * directly set listenAddr as listens[0]->address */ - if (listenAddr && def->nListens == 0 && - virDomainGraphicsListenAppendAddress(def, listenAddr) < 0) - goto error; - ret = 0; error: + if (ret < 0) + virDomainGraphicsListenDefClear(&newListen); VIR_FREE(listenNodes); - VIR_FREE(listenAddr); VIR_FREE(socketPath); ctxt->node = save; return ret; -- 2.8.2

We support omitting listen attribute of graphics element so we should also support omitting address attribute of listen element. This patch also updates libvirt to always add a listen element into domain XML except for VNC graphics if socket attribute is specified. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 32 +++++++++++++--------- docs/schemas/domaincommon.rng | 8 ++++-- src/conf/domain_conf.c | 3 +- src/qemu/qemu_process.c | 16 +++++++---- src/vbox/vbox_common.c | 6 ++-- src/vmx/vmx.c | 8 ++---- src/xenconfig/xen_common.c | 12 +++++--- src/xenconfig/xen_sxpr.c | 6 ++-- src/xenconfig/xen_xl.c | 3 +- .../generic-graphics-vnc-manual-port.xml | 4 ++- .../generic-graphics-vnc-minimal.xml | 4 ++- .../qemuxml2xmlout-graphics-spice-timeout.xml | 4 ++- .../qemuxml2xmlout-interface-server.xml | 4 ++- .../qemuxml2xmlout-net-bandwidth.xml | 4 ++- .../qemuxml2xmlout-net-bandwidth2.xml | 4 ++- .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 1 + tests/sexpr2xmldata/sexpr2xml-curmem.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 4 ++- .../sexpr2xml-fv-serial-dev-2-ports.xml | 4 ++- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 4 ++- .../sexpr2xml-fv-serial-tcp-telnet.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-fv.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 4 ++- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 4 ++- tests/sexpr2xmldata/sexpr2xml-vif-rate.xml | 4 ++- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 4 ++- tests/xmconfigdata/test-no-source-cdrom.xml | 4 ++- tests/xmconfigdata/test-pci-devs.xml | 4 ++- 48 files changed, 168 insertions(+), 79 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 58b8cb6..fd2dd33 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5126,11 +5126,10 @@ qemu-kvm -net nic,model=? /dev/null the TCP port number (with -1 as legacy syntax indicating that it should be auto-allocated). The <code>autoport</code> attribute is the new preferred syntax for indicating auto-allocation of the TCP - port to use. The <code>listen</code> attribute is an IP address - for the server to listen on. The <code>passwd</code> attribute - provides a VNC password in clear text. The <code>keymap</code> - attribute specifies the keymap to use. It is possible to set - a limit on the validity of the password by giving an timestamp + port to use. The <code>passwd</code> attribute provides a VNC + password in clear text. The <code>keymap</code> attribute specifies + the keymap to use. It is possible to set a limit on the validity of + the password by giving an timestamp <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be in UTC. The <code>connected</code> attribute allows control of connected client during password changes. VNC accepts @@ -5168,14 +5167,12 @@ qemu-kvm -net nic,model=? /dev/null should be auto-allocated), while <code>tlsPort</code> gives an alternative secure port number. The <code>autoport</code> attribute is the new preferred syntax for indicating - auto-allocation of needed port numbers. The <code>listen</code> - attribute is an IP address for the server to listen on. - The <code>passwd</code> attribute provides a SPICE password in - clear text. The <code>keymap</code> attribute specifies the keymap - to use. It is possible to set a limit on the validity of - the password by giving an timestamp - <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be in - UTC. + auto-allocation of needed port numbers. The <code>passwd</code> + attribute provides a SPICE password in clear text. The + <code>keymap</code> attribute specifies the keymap to use. It is + possible to set a limit on the validity of the password by giving + an timestamp <code>passwdValidTo='2010-04-09T15:51:00'</code> + assumed to be in UTC. </p> <p> The <code>connected</code> attribute allows control of connected @@ -5312,6 +5309,15 @@ qemu-kvm -net nic,model=? /dev/null or hostname (which will be resolved to an IP address via a DNS query) to listen on. </p> + <p> + It is possible to omit the <code>address</code> attribute in order to + use an address from config files <span class="since">Since 1.3.5</span>. + </p> + <p> + The <code>address</code> attribute is duplicated as <code>listen</code> + attribute in <code>graphics</code> element for backward compatibility. + If both are provided they must be equal. + </p> </dd> <dt><code>network</code></dt> <dd> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 8798001..903fd7e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2952,9 +2952,11 @@ <attribute name="type"> <value>address</value> </attribute> - <attribute name="address"> - <ref name="addrIPorName"/> - </attribute> + <optional> + <attribute name="address"> + <ref name="addrIPorName"/> + </attribute> + </optional> </group> <group> <attribute name="type"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1d44fb6..1f202dc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10808,8 +10808,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, if (STREQ_NULLABLE(newListen.address, "")) VIR_FREE(newListen.address); - if (newListen.address && - VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) + if (VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) goto error; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index eddf3a7..f4bf6c1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4394,7 +4394,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); bool allocate = !(flags & VIR_QEMU_PROCESS_START_PRETEND); - size_t i; + size_t i, j; int ret = -1; if (allocate && qemuProcessGraphicsReservePorts(driver, vm) < 0) @@ -4426,12 +4426,16 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, break; } - if (graphics->nListens == 0 && listenAddr) { - if (virDomainGraphicsListenAppendAddress(graphics, - listenAddr) < 0) - goto cleanup; + for (j = 0; j < graphics->nListens; j++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; - graphics->listens[0].fromConfig = true; + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS && + !glisten->address && listenAddr) { + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + goto cleanup; + + glisten->fromConfig = true; + } } } diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index ed22724..13c3fec 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3385,8 +3385,10 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VBOX_UTF16_FREE(netAddressUtf16); } - if (STRNEQ_NULLABLE(netAddressUtf8, "") && - virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8) < 0) + if (netAddressUtf8 && STREQ(netAddressUtf8, "")) + VBOX_UTF8_FREE(netAddressUtf8); + + if (virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8) < 0) goto cleanup; gVBoxAPI.UIVRDxServer.GetAllowMultiConnection(VRDxServer, &allowMultiConnection); diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 5e57c39..6505dd7 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1875,11 +1875,9 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) goto failure; } - if (listenAddr) { - if (virDomainGraphicsListenAppendAddress(*def, listenAddr) < 0) - goto failure; - VIR_FREE(listenAddr); - } + if (virDomainGraphicsListenAppendAddress(*def, listenAddr) < 0) + goto failure; + VIR_FREE(listenAddr); if (port < 0) { VIR_WARN("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' " diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index c6aee69..c753fa8 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -594,8 +594,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (xenConfigCopyStringOpt(conf, "vnclisten", &listenAddr) < 0) goto cleanup; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto cleanup; VIR_FREE(listenAddr); @@ -664,8 +663,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (STREQ(key + 10, "1")) graphics->data.vnc.autoport = true; } else if (STRPREFIX(key, "vnclisten=")) { - if (virDomainGraphicsListenAppendAddress(graphics, - key+10) < 0) + if (VIR_STRDUP(listenAddr, key+10) < 0) goto cleanup; } else if (STRPREFIX(key, "vncpasswd=")) { if (VIR_STRDUP(graphics->data.vnc.auth.passwd, key + 10) < 0) @@ -699,6 +697,12 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) nextkey++; key = nextkey; } + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + if (virDomainGraphicsListenAppendAddress(graphics, + listenAddr) < 0) + goto cleanup; + VIR_FREE(listenAddr); + } if (VIR_ALLOC_N(def->graphics, 1) < 0) goto cleanup; def->graphics[0] = graphics; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index d4aa5e9..8b5e063 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -867,8 +867,7 @@ xenParseSxprGraphicsOld(virDomainDefPtr def, graphics->data.vnc.autoport = true; graphics->data.vnc.port = port; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) @@ -988,8 +987,7 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, port += 5900; graphics->data.vnc.port = port; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 889dd40..7d41e05 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -186,8 +186,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE; if (xenConfigCopyStringOpt(conf, "spicehost", &listenAddr) < 0) goto cleanup; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto cleanup; VIR_FREE(listenAddr); diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml index ac8c279..7301057 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml @@ -19,7 +19,9 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml index ac8c279..7301057 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml @@ -19,7 +19,9 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 33b5465..912b542 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -77,7 +77,9 @@ <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'/> + <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'> + <listen type='address'/> + </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml index 9bc610b..95b6e2d 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -119,7 +119,9 @@ </channel> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index b9c9015..1fb740b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml @@ -63,7 +63,9 @@ <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml index 411b409..6464890 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml @@ -52,7 +52,9 @@ <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml index 4b06e48..a6dddab 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml @@ -30,6 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' autoport='no'> + <listen type='address'/> <gl enable='yes'/> </graphics> <video> diff --git a/tests/sexpr2xmldata/sexpr2xml-curmem.xml b/tests/sexpr2xmldata/sexpr2xml-curmem.xml index 6932e33..601749e 100644 --- a/tests/sexpr2xmldata/sexpr2xml-curmem.xml +++ b/tests/sexpr2xmldata/sexpr2xml-curmem.xml @@ -33,7 +33,9 @@ </console> <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml index fdd7c7d..e8ae46c 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml @@ -49,7 +49,9 @@ <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='5925' autoport='yes' keymap='en-us'/> + <graphics type='vnc' port='5925' autoport='yes' keymap='en-us'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml index 42d529c..0adac34 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml index 5e26804..4f02e80 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml @@ -45,7 +45,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml index f6af578..caa10d9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml @@ -45,7 +45,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml index aba6045..189215a 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml b/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml index 22e2035..386726a 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml @@ -43,7 +43,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml index aa5122b..9fdc16f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml @@ -47,7 +47,9 @@ </parallel> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml index bcccb94..50dac3b 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml @@ -54,7 +54,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml index 82c41a6..f0c9c4f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml @@ -50,7 +50,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml index 062f349..127de7d 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml @@ -50,7 +50,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml index 38a2fb3..2b4c0c9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml @@ -48,7 +48,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml index 4d76e34..2080a4d 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml @@ -50,7 +50,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml index e0f90ef..c51a79a 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml @@ -48,7 +48,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml index 7de5731..6226a28 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml @@ -48,7 +48,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml index c22e2a5..071645f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml @@ -52,7 +52,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml index 439a66e..3eda513 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml @@ -52,7 +52,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml index b4bdc8a..35b6f84 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml @@ -52,7 +52,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml index af9f928..fe5bf11 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml @@ -50,7 +50,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml index d0240c4..65ba506 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <sound model='sb16'/> <sound model='es1370'/> <video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml index d0240c4..65ba506 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <sound model='sb16'/> <sound model='es1370'/> <video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml index e84e172..f034bc1 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml @@ -43,7 +43,9 @@ <input type='mouse' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml index 187d867..ab350c0 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml @@ -43,7 +43,9 @@ <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml index 2816f4a..e49854f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml index 2816f4a..e49854f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv.xml b/tests/sexpr2xmldata/sexpr2xml-fv.xml index 2816f4a..e49854f 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv.xml @@ -42,7 +42,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml b/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml index 41fb3b7..1701895 100644 --- a/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml +++ b/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml @@ -47,7 +47,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml index ee24536..06e7280 100644 --- a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml @@ -31,7 +31,9 @@ </console> <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> </video> diff --git a/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml b/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml index 1ebd5f0..bfcd7c3 100644 --- a/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml +++ b/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml @@ -46,7 +46,9 @@ </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/> + <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml index 8501907..3c57579 100644 --- a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml +++ b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml @@ -11,7 +11,9 @@ <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> - <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'/> + <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'> + <listen type='address'/> + </graphics> <video> <model type='vmvga' vram='4096' primary='yes'/> </video> diff --git a/tests/xmconfigdata/test-no-source-cdrom.xml b/tests/xmconfigdata/test-no-source-cdrom.xml index 246123c..c0b2d43 100644 --- a/tests/xmconfigdata/test-no-source-cdrom.xml +++ b/tests/xmconfigdata/test-no-source-cdrom.xml @@ -47,7 +47,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/xmconfigdata/test-pci-devs.xml b/tests/xmconfigdata/test-pci-devs.xml index a88853d..0faae43 100644 --- a/tests/xmconfigdata/test-pci-devs.xml +++ b/tests/xmconfigdata/test-pci-devs.xml @@ -47,7 +47,9 @@ </console> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> -- 2.8.2

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1f202dc..a1048a7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10724,10 +10724,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, if (network && network[0]) { if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { - /* network='xxx' never makes sense with anything except - * type='network' */ virReportError(VIR_ERR_XML_ERROR, "%s", - _("network attribute not allowed when listen type is not network")); + _("'network' attribute is valid only for listen " + "type 'network'")); goto error; } def->network = network; -- 2.8.2

So far we have only two listen types that supports only address:port method, but in the future we may want to add a new different listen type, for example socket. This patch moves the ports values out of graphics unions into listen element. The domain XML will now duplicate the ports from first listen element into the graphics element as we do also for address. This allows us to make part of the graphics code as listen-driven and prepare the code for new listen types. To support migration back to older versions the new attributes from listen elements are not written into migratable XML. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 89 ++++-- docs/schemas/domaincommon.rng | 40 +++ src/conf/domain_conf.c | 350 ++++++++++++--------- src/conf/domain_conf.h | 23 +- src/libxl/libxl_conf.c | 53 ++-- src/libxl/libxl_domain.c | 17 +- src/qemu/qemu_command.c | 167 +++++----- src/qemu/qemu_hotplug.c | 31 +- src/qemu/qemu_migration.c | 14 +- src/qemu/qemu_parse_command.c | 39 ++- src/qemu/qemu_process.c | 257 ++++++++------- src/vbox/vbox_common.c | 26 +- src/vbox/vbox_tmpl.c | 34 +- src/vbox/vbox_uniformed_api.h | 4 +- src/vmx/vmx.c | 52 +-- src/vz/vz_sdk.c | 30 +- src/xenconfig/xen_common.c | 67 ++-- src/xenconfig/xen_sxpr.c | 69 ++-- src/xenconfig/xen_xl.c | 44 +-- .../generic-graphics-listen-back-compat-ports.xml | 30 ++ ...generic-graphics-vnc-listen-element-minimal.xml | 2 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 ++ .../generic-graphics-listen-back-compat-ports.xml | 30 ++ .../generic-graphics-listen-back-compat.xml | 2 +- .../generic-graphics-vnc-listen-attr-only.xml | 2 +- ...generic-graphics-vnc-listen-element-minimal.xml | 4 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 ++ ...ic-graphics-vnc-listen-element-with-address.xml | 2 +- .../generic-graphics-vnc-manual-port.xml | 2 +- .../generic-graphics-vnc-minimal.xml | 2 +- tests/genericxml2xmltest.c | 3 + .../qemuargv2xml-graphics-vnc-policy.xml | 2 +- .../qemuargv2xml-graphics-vnc-sasl.xml | 2 +- .../qemuargv2xml-graphics-vnc-tls.xml | 2 +- .../qemuargv2xml-graphics-vnc-websocket.xml | 2 +- .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml | 2 +- ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 4 +- .../qemuxml2xmlout-graphics-spice-compression.xml | 2 +- .../qemuxml2xmlout-graphics-spice-qxl-vga.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-graphics-spice.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-no-listen-attr.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-sasl.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-tls.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-websocket.xml | 2 +- .../qemuxml2xmlout-graphics-vnc.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 2 +- .../qemuxml2xmlout-net-bandwidth.xml | 2 +- .../qemuxml2xmlout-net-bandwidth2.xml | 2 +- .../qemuxml2xmlout-pci-bridge.xml | 2 +- ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-curmem.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 2 +- .../sexpr2xml-fv-serial-dev-2-ports.xml | 2 +- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 2 +- .../sexpr2xml-fv-serial-tcp-telnet.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-fv.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 2 +- .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 2 +- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-vif-rate.xml | 2 +- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 2 +- .../test-disk-positional-parms-full.xml | 2 +- .../test-disk-positional-parms-partial.xml | 2 +- ...est-fullvirt-direct-kernel-boot-bogus-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot.xml | 2 +- tests/xlconfigdata/test-fullvirt-multiusb.xml | 2 +- tests/xlconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xlconfigdata/test-new-disk.xml | 2 +- tests/xlconfigdata/test-rbd-multihost-noauth.xml | 2 +- tests/xlconfigdata/test-spice-features.xml | 2 +- tests/xlconfigdata/test-spice.xml | 2 +- tests/xlconfigdata/test-vif-rate.xml | 2 +- tests/xmconfigdata/test-escape-paths.xml | 2 +- .../xmconfigdata/test-fullvirt-default-feature.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-hpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-localtime.xml | 2 +- tests/xmconfigdata/test-fullvirt-net-netfront.xml | 2 +- tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 2 +- tests/xmconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 2 +- .../test-fullvirt-serial-dev-2-ports.xml | 2 +- .../test-fullvirt-serial-dev-2nd-port.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-file.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-null.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pty.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 2 +- .../test-fullvirt-serial-tcp-telnet.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-udp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-unix.xml | 2 +- tests/xmconfigdata/test-fullvirt-sound.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbtablet.xml | 2 +- tests/xmconfigdata/test-fullvirt-utc.xml | 2 +- tests/xmconfigdata/test-no-source-cdrom.xml | 2 +- tests/xmconfigdata/test-paravirt-net-e1000.xml | 2 +- tests/xmconfigdata/test-paravirt-net-vifname.xml | 2 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 2 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 2 +- tests/xmconfigdata/test-pci-devs.xml | 2 +- 131 files changed, 1031 insertions(+), 716 deletions(-) create mode 100644 tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fd2dd33..10a9e8d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5090,7 +5090,7 @@ qemu-kvm -net nic,model=? /dev/null <devices> <graphics type='sdl' display=':0.0'/> <graphics type='vnc' port='5904' sharePolicy='allow-exclusive'> - <listen type='address' address='1.2.3.4'/> + <listen type='address' address='1.2.3.4' port='5904'/> </graphics> <graphics type='rdp' autoport='yes' multiUser='yes' /> <graphics type='desktop' fullscreen='yes'/> @@ -5122,16 +5122,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>vnc</code></dt> <dd> <p> - Starts a VNC server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated). The <code>autoport</code> attribute is - the new preferred syntax for indicating auto-allocation of the TCP - port to use. The <code>passwd</code> attribute provides a VNC - password in clear text. The <code>keymap</code> attribute specifies - the keymap to use. It is possible to set a limit on the validity of + Starts a VNC server. To set port or address use <code>listen</code> + element. The <code>passwd</code> attribute provides a VNC password + in clear text. The <code>keymap</code> attribute specifies the + keymap to use. It is possible to set a limit on the validity of the password by giving an timestamp - <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be - in UTC. The <code>connected</code> attribute allows control of + <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be in + UTC. The <code>connected</code> attribute allows control of connected client during password changes. VNC accepts <code>keep</code> value only <span class="since">since 0.9.3</span>. NB, this may not be supported by all hypervisors. @@ -5148,26 +5145,16 @@ qemu-kvm -net nic,model=? /dev/null unconditionally <span class="since">since 1.0.6</span>. </p> <p> - Rather than using listen/port, QEMU supports a <code>socket</code> + Rather than using listen element, QEMU supports a <code>socket</code> attribute for listening on a unix domain socket path <span class="since">Since 0.8.8</span>. </p> - <p> - For VNC WebSocket functionality, <code>websocket</code> attribute - may be used to specify port to listen on (with -1 meaning - auto-allocation and <code>autoport</code> having no effect due to - security reasons) <span class="since">Since 1.0.6</span>. - </p> </dd> <dt><code>spice</code> <span class="since">Since 0.8.6</span></dt> <dd> <p> - Starts a SPICE server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated), while <code>tlsPort</code> gives - an alternative secure port number. The <code>autoport</code> - attribute is the new preferred syntax for indicating - auto-allocation of needed port numbers. The <code>passwd</code> + Starts a SPICE server. To set port or address use + <code>listen</code> element. The <code>passwd</code> attribute provides a SPICE password in clear text. The <code>keymap</code> attribute specifies the keymap to use. It is possible to set a limit on the validity of the password by giving @@ -5209,6 +5196,7 @@ qemu-kvm -net nic,model=? /dev/null </p> <pre> <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> + <listen type='address' autoport='yes'/> <channel name='main' mode='secure'/> <channel name='record' mode='insecure'/> <image compression='auto_glz'/> @@ -5266,16 +5254,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>rdp</code></dt> <dd> <p> - Starts a RDP server. The <code>port</code> attribute specifies the - TCP port number (with -1 as legacy syntax indicating that it should - be auto-allocated). The <code>autoport</code> attribute is the new - preferred syntax for indicating auto-allocation of the TCP port to - use. The <code>replaceUser</code> attribute is a boolean deciding - whether multiple simultaneous connections to the VM are permitted. - The <code>multiUser</code> attribute is a boolean deciding whether - the existing connection must be dropped and a new connection must - be established by the VRDP server, when a new client connects in - single connection mode. + Starts a RDP server. To set port or address use <code>listen</code> + element. The <code>replaceUser</code> attribute is + a boolean deciding whether multiple simultaneous connections to + the VM are permitted. The <code>multiUser</code> attribute is + a boolean deciding whether the existing connection must be dropped + and a new connection must be established by the VRDP server, when + a new client connects in single connection mode. </p> </dd> <dt><code>desktop</code></dt> @@ -5318,6 +5303,40 @@ qemu-kvm -net nic,model=? /dev/null attribute in <code>graphics</code> element for backward compatibility. If both are provided they must be equal. </p> + <p> + With address it's also possible to specify ports to listen on and + whether those ports should be auto-generated or not + <span class="since">Since 1.3.5</span>. Depending on graphics type + those attributes are available: + </p> + <ul> + <li> + <code>port</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>), + </li> + <li> + <code>tlsPort</code> secure TCP port number (<code>spice</code>), + </li> + <li> + <code>websocket</code> TCP port number (<code>vnc</code>), + </li> + <li> + <code>autoport</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>). + </li> + </ul> + <p> + If <code>autoport='yes'</code> the <code>port</code> and + <code>tlsPort</code> are auto-generated. It's also possible to use + <code>-1</code> as legacy syntax to tell that the port should be + auto-generated. The <code>websocket</code> has an exception for + security reasons that it can be only auto-generated using the legacy + syntax <code>websocket='-1'</code>. + </p> + <p> + This ports configuration is duplicated into <code>graphics</code> + element for backwards compatibility. + </p> </dd> <dt><code>network</code></dt> <dd> @@ -5335,6 +5354,10 @@ qemu-kvm -net nic,model=? /dev/null describing one of the 'direct' (macvtap) modes, the first IPv4 address of the first forward dev will be used. </p> + <p> + Specifying ports uses the same rules and syntax as listen type + <code>address</code>. + </p> </dd> </dl> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 903fd7e..e916cc1 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2957,6 +2957,26 @@ <ref name="addrIPorName"/> </attribute> </optional> + <optional> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="tlsPort"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="websocket"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="autoport"> + <ref name="virYesNo"/> + </attribute> + </optional> </group> <group> <attribute name="type"> @@ -2970,6 +2990,26 @@ <ref name="addrIPorName"/> </attribute> </optional> + <optional> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="tlsPort"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="websocket"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="autoport"> + <ref name="virYesNo"/> + </attribute> + </optional> </group> </choice> </element> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a1048a7..c546997 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10658,9 +10658,132 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, /** + * virDomainGraphicsListenDefParsePorts: + * @def: listen def pointer to be filled + * @node: xml node of <listen/> element + * @graphics: graphics def pointer + * @parent: xml node of <graphics/> element + * @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_* + * + * Parses current <listen/> element from @node to @def. For backward + * compatibility the @parent element should contain node of <graphics/> element + * for the first <listen/> element in order to validate attributes from both + * elements. + */ +static int +virDomainGraphicsListenDefParsePorts(virDomainGraphicsListenDefPtr def, + xmlNodePtr node, + virDomainGraphicsDefPtr graphics, + xmlNodePtr parent, + unsigned int flags) +{ + char *port = virXMLPropString(node, "port"); + char *tlsPort = virXMLPropString(node, "tlsPort"); + char *websocket = virXMLPropString(node, "websocket"); + char *autoport = virXMLPropString(node, "autoport"); + char *portCompat = NULL; + char *tlsPortCompat = NULL; + char *websocketCompat = NULL; + char *autoportCompat = NULL; + int ret = -1; + + if (parent) { + portCompat = virXMLPropString(parent, "port"); + tlsPortCompat = virXMLPropString(parent, "tlsPort"); + websocketCompat = virXMLPropString(parent, "websocket"); + autoportCompat = virXMLPropString(parent, "autoport"); + } + +#define GRAPHICS_CHECK_PORT_COMPAT(PORT, PORT_COMPAT) \ + if (PORT && PORT_COMPAT && STRNEQ(PORT, PORT_COMPAT)) { \ + virReportError(VIR_ERR_XML_ERROR, \ + _("graphics '" #PORT "' attribute '%s' must match " \ + "'" #PORT "' attribute of first listen element " \ + "(found '%s')"), PORT_COMPAT, PORT); \ + goto error; \ + } \ + if (!PORT) { \ + PORT = PORT_COMPAT; \ + PORT_COMPAT = NULL; \ + } + + GRAPHICS_CHECK_PORT_COMPAT(port, portCompat); + GRAPHICS_CHECK_PORT_COMPAT(tlsPort, tlsPortCompat); + GRAPHICS_CHECK_PORT_COMPAT(websocket, websocketCompat); + GRAPHICS_CHECK_PORT_COMPAT(autoport, autoportCompat); + +#undef GRAPHICS_CHECK_PORT_COMPAT + +#define GRAPHICS_PARSE_PORT(PORT) \ + if (PORT) { \ + if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS && \ + def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { \ + virReportError(VIR_ERR_XML_ERROR, "%s", \ + _("'" #PORT "' attribute is valid only for listen " \ + "type 'address' and 'network'")); \ + goto error; \ + } \ + if (virStrToLong_i(PORT, NULL, 10, &def->PORT) < 0) { \ + virReportError(VIR_ERR_XML_ERROR, \ + _("cannot parse " #PORT " '%s'"), PORT); \ + goto error; \ + } \ + } + + GRAPHICS_PARSE_PORT(port); + GRAPHICS_PARSE_PORT(tlsPort); + GRAPHICS_PARSE_PORT(websocket); + +#undef GRAPHICS_PARSE_PORT + + if (autoport) { + if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS && + def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'autoport' attribute is valid only for listen " + "type 'address' and 'network'")); + goto error; + } + if (STREQ(autoport, "yes")) + def->autoport = true; + } + + if (!port && !tlsPort && !autoport && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) + def->autoport = true; + + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + if (def->port == -1 && def->tlsPort == -1) { + def->autoport = true; + def->port = def->tlsPort = 0; + } + } else { + if (def->port == -1) { + def->autoport = true; + def->port = 0; + } + } + + if (def->autoport && (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) { + def->port = 0; + def->tlsPort = 0; + } + + ret = 0; + error: + VIR_FREE(port); + VIR_FREE(tlsPort); + VIR_FREE(websocket); + VIR_FREE(autoport); + return ret; +} + + +/** * virDomainGraphicsListenDefParseXML: * @def: listen def pointer to be filled * @node: xml node of <listen/> element + * @graphics: graphics def pointer * @parent: xml node of <graphics/> element * @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_* * @@ -10672,6 +10795,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, static int virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, xmlNodePtr node, + virDomainGraphicsDefPtr graphics, xmlNodePtr parent, unsigned int flags) { @@ -10744,6 +10868,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, def->fromConfig = tmp != 0; } + if (virDomainGraphicsListenDefParsePorts(def, node, graphics, + parent, flags) < 0) + goto error; + ret = 0; error: if (ret < 0) @@ -10792,6 +10920,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, for (i = 0; i < nListens; i++) { if (virDomainGraphicsListenDefParseXML(&def->listens[i], listenNodes[i], + def, i == 0 ? node : NULL, flags) < 0) goto error; @@ -10807,6 +10936,10 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, if (STREQ_NULLABLE(newListen.address, "")) VIR_FREE(newListen.address); + if (virDomainGraphicsListenDefParsePorts(&newListen, node, def, + NULL, flags) < 0) + goto error; + if (VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) goto error; } @@ -10828,50 +10961,12 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def, xmlXPathContextPtr ctxt, unsigned int flags) { - char *port = virXMLPropString(node, "port"); - char *websocket = virXMLPropString(node, "websocket"); char *sharePolicy = virXMLPropString(node, "sharePolicy"); - char *autoport = virXMLPropString(node, "autoport"); int ret = -1; if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) goto error; - if (port) { - if (virStrToLong_i(port, NULL, 10, &def->data.vnc.port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vnc port %s"), port); - goto error; - } - /* Legacy compat syntax, used -1 for auto-port */ - if (def->data.vnc.port == -1) { - if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) - def->data.vnc.port = 0; - def->data.vnc.autoport = true; - } - } else { - def->data.vnc.port = 0; - def->data.vnc.autoport = true; - } - - if (autoport) { - if (STREQ(autoport, "yes")) { - if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) - def->data.vnc.port = 0; - def->data.vnc.autoport = true; - } - } - - if (websocket) { - if (virStrToLong_i(websocket, - NULL, 10, - &def->data.vnc.websocket) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vnc WebSocket port %s"), websocket); - goto error; - } - } - if (sharePolicy) { int policy = virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); @@ -10895,9 +10990,6 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def, ret = 0; error: - VIR_FREE(port); - VIR_FREE(autoport); - VIR_FREE(websocket); VIR_FREE(sharePolicy); return ret; } @@ -10940,8 +11032,6 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDefPtr def, xmlXPathContextPtr ctxt, unsigned int flags) { - char *port = virXMLPropString(node, "port"); - char *autoport = virXMLPropString(node, "autoport"); char *replaceUser = virXMLPropString(node, "replaceUser"); char *multiUser = virXMLPropString(node, "multiUser"); int ret = -1; @@ -10949,27 +11039,6 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDefPtr def, if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) goto error; - if (port) { - if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse rdp port %s"), port); - goto error; - } - /* Legacy compat syntax, used -1 for auto-port */ - if (def->data.rdp.port == -1) - def->data.rdp.autoport = true; - - } else { - def->data.rdp.port = 0; - def->data.rdp.autoport = true; - } - - if (STREQ_NULLABLE(autoport, "yes")) - def->data.rdp.autoport = true; - - if (def->data.rdp.autoport && (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) - def->data.rdp.port = 0; - if (STREQ_NULLABLE(replaceUser, "yes")) def->data.rdp.replaceUser = true; @@ -10978,8 +11047,6 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDefPtr def, ret = 0; error: - VIR_FREE(port); - VIR_FREE(autoport); VIR_FREE(replaceUser); VIR_FREE(multiUser); return ret; @@ -11023,9 +11090,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def, unsigned int flags) { xmlNodePtr cur; - char *port = virXMLPropString(node, "port"); - char *tlsPort = virXMLPropString(node, "tlsPort"); - char *autoport = virXMLPropString(node, "autoport"); char *defaultMode = virXMLPropString(node, "defaultMode"); int defaultModeVal; int ret = -1; @@ -11033,29 +11097,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def, if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) goto error; - if (port) { - if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice port %s"), port); - goto error; - } - } else { - def->data.spice.port = 0; - } - - if (tlsPort) { - if (virStrToLong_i(tlsPort, NULL, 10, &def->data.spice.tlsPort) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice tlsPort %s"), tlsPort); - goto error; - } - } else { - def->data.spice.tlsPort = 0; - } - - if (STREQ_NULLABLE(autoport, "yes")) - def->data.spice.autoport = true; - def->data.spice.defaultMode = VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY; if (defaultMode) { @@ -11068,16 +11109,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def, def->data.spice.defaultMode = defaultModeVal; } - if (def->data.spice.port == -1 && def->data.spice.tlsPort == -1) { - /* Legacy compat syntax, used -1 for auto-port */ - def->data.spice.autoport = true; - } - - if (def->data.spice.autoport && (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) { - def->data.spice.port = 0; - def->data.spice.tlsPort = 0; - } - def->data.spice.keymap = virXMLPropString(node, "keymap"); if (virDomainGraphicsAuthDefParseXML(node, &def->data.spice.auth, @@ -11312,9 +11343,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def, ret = 0; error: - VIR_FREE(port); - VIR_FREE(tlsPort); - VIR_FREE(autoport); VIR_FREE(defaultMode); return ret; } @@ -21403,6 +21431,26 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " network='%s'", def->network); } + /* Don't print the new port attributes into migratable XML in order to be + * able to migrate to old libvirt. */ + if (!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) { + if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || + def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { + if (!def->autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) { + if (def->port) + virBufferAsprintf(buf, " port='%d'", def->port); + + if (def->tlsPort) + virBufferAsprintf(buf, " tlsPort='%d'", def->tlsPort); + + if (def->websocket) + virBufferAsprintf(buf, " websocket='%d'", def->websocket); + } + + virBufferAsprintf(buf, " autoport='%s'", def->autoport ? "yes" : "no"); + } + } + if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS) virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig); @@ -21415,8 +21463,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainGraphicsDefPtr def, unsigned int flags) { + virDomainGraphicsListenDefPtr glisten = NULL; const char *type = virDomainGraphicsTypeToString(def->type); - const char *listenAddr = NULL; bool children = false; size_t i; @@ -21426,23 +21474,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf, return -1; } - /* find the first listen subelement with a valid address and - * duplicate its address attribute as the listen attribute of - * <graphics>. This is done to improve backward compatibility. - */ - for (i = 0; i < def->nListens; i++) { - if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE && - def->listens[i].fromConfig) - continue; - - if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK && - flags & (VIR_DOMAIN_DEF_FORMAT_INACTIVE | - VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) - continue; - - if ((listenAddr = def->listens[i].address)) - break; - } + glisten = virDomainGraphicsGetListen(def, 0); virBufferAsprintf(buf, "<graphics type='%s'", type); @@ -21454,22 +21486,21 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " socket='%s'", def->data.vnc.socket); } - } else { - if (def->data.vnc.port && - (!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) - virBufferAsprintf(buf, " port='%d'", - def->data.vnc.port); - else if (def->data.vnc.autoport) + } else if (glisten) { + if (glisten->port && + (!glisten->autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) + virBufferAsprintf(buf, " port='%d'", glisten->port); + else if (glisten->autoport) virBufferAddLit(buf, " port='-1'"); virBufferAsprintf(buf, " autoport='%s'", - def->data.vnc.autoport ? "yes" : "no"); + glisten->autoport ? "yes" : "no"); - if (def->data.vnc.websocket) - virBufferAsprintf(buf, " websocket='%d'", def->data.vnc.websocket); + if (glisten->websocket) + virBufferAsprintf(buf, " websocket='%d'", glisten->websocket); - if (listenAddr) - virBufferAsprintf(buf, " listen='%s'", listenAddr); + if (glisten->address && !glisten->fromConfig) + virBufferAsprintf(buf, " listen='%s'", glisten->address); } if (def->data.vnc.keymap) @@ -21498,24 +21529,24 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; case VIR_DOMAIN_GRAPHICS_TYPE_RDP: - if (def->data.rdp.port) + if (glisten->port) virBufferAsprintf(buf, " port='%d'", - def->data.rdp.port); - else if (def->data.rdp.autoport) + glisten->port); + else if (glisten->autoport) virBufferAddLit(buf, " port='0'"); - if (def->data.rdp.autoport) + if (glisten->autoport) virBufferAddLit(buf, " autoport='yes'"); + if (glisten->address && !glisten->fromConfig) + virBufferAsprintf(buf, " listen='%s'", glisten->address); + if (def->data.rdp.replaceUser) virBufferAddLit(buf, " replaceUser='yes'"); if (def->data.rdp.multiUser) virBufferAddLit(buf, " multiUser='yes'"); - if (listenAddr) - virBufferAsprintf(buf, " listen='%s'", listenAddr); - break; case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: @@ -21529,19 +21560,19 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: - if (def->data.spice.port) + if (glisten->port) virBufferAsprintf(buf, " port='%d'", - def->data.spice.port); + glisten->port); - if (def->data.spice.tlsPort) + if (glisten->tlsPort) virBufferAsprintf(buf, " tlsPort='%d'", - def->data.spice.tlsPort); + glisten->tlsPort); virBufferAsprintf(buf, " autoport='%s'", - def->data.spice.autoport ? "yes" : "no"); + glisten->autoport ? "yes" : "no"); - if (listenAddr) - virBufferAsprintf(buf, " listen='%s'", listenAddr); + if (glisten->address && !glisten->fromConfig) + virBufferAsprintf(buf, " listen='%s'", glisten->address); if (def->data.spice.keymap) virBufferEscapeString(buf, " keymap='%s'", @@ -23856,23 +23887,32 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i) int virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def, - const char *address) + const char *address, + const int port, + const int tlsPort, + const int websocket, + const bool autoport) { - virDomainGraphicsListenDef gListen; + virDomainGraphicsListenDef glisten; + + memset(&glisten, 0, sizeof(glisten)); - memset(&gListen, 0, sizeof(gListen)); + glisten.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; - gListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; + glisten.port = port; + glisten.tlsPort = tlsPort; + glisten.websocket = websocket; + glisten.autoport = autoport; - if (VIR_STRDUP(gListen.address, address) < 0) + if (VIR_STRDUP(glisten.address, address) < 0) goto error; - if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, gListen) < 0) + if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, glisten) < 0) goto error; return 0; error: - VIR_FREE(gListen.address); + VIR_FREE(glisten.address); return -1; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b9e696d..3247177 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1556,6 +1556,12 @@ struct _virDomainGraphicsListenDef { char *address; char *network; bool fromConfig; /* true if the @address is config file originated */ + int port; + int tlsPort; + int websocket; + bool autoport; + bool portReserved; + bool tlsPortReserved; }; struct _virDomainGraphicsDef { @@ -1567,10 +1573,6 @@ struct _virDomainGraphicsDef { virDomainGraphicsType type; union { struct { - int port; - bool portReserved; - int websocket; - bool autoport; char *keymap; char *socket; bool socketAutogenerated; @@ -1583,8 +1585,6 @@ struct _virDomainGraphicsDef { bool fullscreen; } sdl; struct { - int port; - bool autoport; bool replaceUser; bool multiUser; } rdp; @@ -1593,14 +1593,9 @@ struct _virDomainGraphicsDef { bool fullscreen; } desktop; struct { - int port; - int tlsPort; - bool portReserved; - bool tlsPortReserved; virDomainGraphicsSpiceMouseMode mousemode; char *keymap; virDomainGraphicsAuthDef auth; - bool autoport; int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST]; virDomainGraphicsSpiceChannelMode defaultMode; int image; @@ -2839,7 +2834,11 @@ int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match, virDomainGraphicsListenDefPtr virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i); int virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def, - const char *address) + const char *address, + const int port, + const int tlsPort, + const int websocket, + const bool autoport) ATTRIBUTE_NONNULL(1); int virDomainNetGetActualType(virDomainNetDefPtr iface); diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index d927b37..0144f87 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1424,7 +1424,7 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports, libxl_device_vfb *x_vfb) { unsigned short port; - virDomainGraphicsListenDefPtr gListen = NULL; + virDomainGraphicsListenDefPtr glisten = NULL; libxl_device_vfb_init(x_vfb); @@ -1443,20 +1443,24 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports, libxl_defbool_set(&x_vfb->sdl.enable, 0); /* driver handles selection of free port */ libxl_defbool_set(&x_vfb->vnc.findunused, 0); - if (l_vfb->data.vnc.autoport) { - if (virPortAllocatorAcquire(graphicsports, &port) < 0) - return -1; - l_vfb->data.vnc.port = port; - } - x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN; + glisten = virDomainGraphicsGetListen(l_vfb, 0); - if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) && - gListen->address) { - /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ - VIR_FREE(x_vfb->vnc.listen); - if (VIR_STRDUP(x_vfb->vnc.listen, gListen->address) < 0) - return -1; + if (glisten) { + if (glisten->autoport) { + + if (virPortAllocatorAcquire(graphicsports, &port) < 0) + return -1; + glisten->port = port; + } + x_vfb->vnc.display = glisten->port - LIBXL_VNC_PORT_MIN; + + if (glisten->address) { + /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ + VIR_FREE(x_vfb->vnc.listen); + if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0) + return -1; + } } if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0) return -1; @@ -1545,24 +1549,27 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports, for (i = 0; i < def->ngraphics; i++) { virDomainGraphicsDefPtr l_vfb = def->graphics[i]; unsigned short port; - virDomainGraphicsListenDefPtr gListen = NULL; + virDomainGraphicsListenDefPtr glisten = NULL; if (l_vfb->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) continue; + glisten = virDomainGraphicsGetListen(l_vfb, 0); + libxl_defbool_set(&b_info->u.hvm.spice.enable, true); - if (l_vfb->data.spice.autoport) { - if (virPortAllocatorAcquire(graphicsports, &port) < 0) + if (glisten) { + if (glisten->autoport) { + if (virPortAllocatorAcquire(graphicsports, &port) < 0) + return -1; + glisten->port = port; + } + b_info->u.hvm.spice.port = glisten->port; + + if (glisten->address && + VIR_STRDUP(b_info->u.hvm.spice.host, glisten->address) < 0) return -1; - l_vfb->data.spice.port = port; } - b_info->u.hvm.spice.port = l_vfb->data.spice.port; - - if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) && - gListen->address && - VIR_STRDUP(b_info->u.hvm.spice.host, gListen->address) < 0) - return -1; if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0) return -1; diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 5fa1bd9..30ee6cb 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -746,13 +746,16 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver, driver->inhibitCallback(false, driver->inhibitOpaque); if ((vm->def->ngraphics == 1) && - vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && - vm->def->graphics[0]->data.vnc.autoport) { - vnc_port = vm->def->graphics[0]->data.vnc.port; - if (vnc_port >= LIBXL_VNC_PORT_MIN) { - if (virPortAllocatorRelease(driver->reservedGraphicsPorts, - vnc_port) < 0) - VIR_DEBUG("Could not mark port %d as unused", vnc_port); + vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + virDomainGraphicsListenDefPtr glisten = + virDomainGraphicsGetListen(vm->def->graphics[0], 0); + if (glisten && glisten->autoport) { + vnc_port = glisten->port; + if (vnc_port >= LIBXL_VNC_PORT_MIN) { + if (virPortAllocatorRelease(driver->reservedGraphicsPorts, + vnc_port) < 0) + VIR_DEBUG("Could not mark port %d as unused", vnc_port); + } } } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0d6d5f8..6b7ce0f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7377,7 +7377,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, const char *domainLibDir) { virBuffer opt = VIR_BUFFER_INITIALIZER; - virDomainGraphicsListenDefPtr gListen = NULL; + virDomainGraphicsListenDefPtr glisten = NULL; const char *listenAddr = NULL; char *netAddr = NULL; bool escapeAddr; @@ -7401,46 +7401,49 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket); } else { - if (!graphics->data.vnc.autoport && - (graphics->data.vnc.port < 5900 || - graphics->data.vnc.port > 65535)) { + if (!(glisten = virDomainGraphicsGetListen(graphics, 0))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + goto error; + } + + if (!glisten->autoport && + (glisten->port < 5900 || + glisten->port > 65535)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vnc port must be in range [5900,65535]")); goto error; } - if ((gListen = virDomainGraphicsGetListen(graphics, 0))) { + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + listenAddr = glisten->address; + break; - switch (gListen->type) { - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: - listenAddr = gListen->address; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (!glisten->network) break; - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: - if (!gListen->network) - break; - - ret = networkGetNetworkAddress(gListen->network, &netAddr); - if (ret <= -2) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("network-based listen not possible, " - "network driver not present")); - goto error; - } - if (ret < 0) - goto error; + ret = networkGetNetworkAddress(glisten->network, &netAddr); + if (ret <= -2) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("network-based listen not possible, " + "network driver not present")); + goto error; + } + if (ret < 0) + goto error; - listenAddr = netAddr; - /* store the address we found in the <graphics> element so it - * will show up in status. */ - if (VIR_STRDUP(gListen->address, netAddr) < 0) - goto error; - break; + listenAddr = netAddr; + /* store the address we found in the <graphics> element so it + * will show up in status. */ + if (VIR_STRDUP(glisten->address, netAddr) < 0) + goto error; + break; - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: - break; - } + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (!listenAddr) @@ -7451,21 +7454,19 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, virBufferAsprintf(&opt, "[%s]", listenAddr); else virBufferAdd(&opt, listenAddr, -1); - virBufferAsprintf(&opt, ":%d", - graphics->data.vnc.port - 5900); + virBufferAsprintf(&opt, ":%d", glisten->port - 5900); VIR_FREE(netAddr); - } - if (!graphics->data.vnc.socket && - graphics->data.vnc.websocket) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("VNC WebSockets are not supported " - "with this QEMU binary")); - goto error; + if (glisten->websocket) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VNC WebSockets are not supported " + "with this QEMU binary")); + goto error; + } + virBufferAsprintf(&opt, ",websocket=%d", glisten->websocket); } - virBufferAsprintf(&opt, ",websocket=%d", graphics->data.vnc.websocket); } if (graphics->data.vnc.sharePolicy) { @@ -7531,13 +7532,11 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, virDomainGraphicsDefPtr graphics) { virBuffer opt = VIR_BUFFER_INITIALIZER; - virDomainGraphicsListenDefPtr gListen = NULL; + virDomainGraphicsListenDefPtr glisten = NULL; const char *listenAddr = NULL; char *netAddr = NULL; int ret; int defaultMode = graphics->data.spice.defaultMode; - int port = graphics->data.spice.port; - int tlsPort = graphics->data.spice.tlsPort; size_t i; if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) { @@ -7546,17 +7545,23 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, goto error; } - if (port > 0) - virBufferAsprintf(&opt, "port=%u,", port); + if (!(glisten = virDomainGraphicsGetListen(graphics, 0))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + goto error; + } + + if (glisten->port > 0) + virBufferAsprintf(&opt, "port=%u,", glisten->port); - if (tlsPort > 0) { + if (glisten->tlsPort > 0) { if (!cfg->spiceTLS) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice TLS port set in XML configuration," " but TLS is disabled in qemu.conf")); goto error; } - virBufferAsprintf(&opt, "tls-port=%u,", tlsPort); + virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort); } if (cfg->spiceSASL) { @@ -7569,39 +7574,37 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, /* TODO: Support ACLs later */ } - if (port > 0 || tlsPort > 0) { - if ((gListen = virDomainGraphicsGetListen(graphics, 0))) { + if (glisten->port > 0 || glisten->tlsPort > 0) { - switch (gListen->type) { - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: - listenAddr = gListen->address; - break; - - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: - if (!gListen->network) - break; - - ret = networkGetNetworkAddress(gListen->network, &netAddr); - if (ret <= -2) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("network-based listen not possible, " - "network driver not present")); - goto error; - } - if (ret < 0) - goto error; + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + listenAddr = glisten->address; + break; - listenAddr = netAddr; - /* store the address we found in the <graphics> element so it will - * show up in status. */ - if (VIR_STRDUP(gListen->address, listenAddr) < 0) - goto error; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (!glisten->network) break; - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: - break; + ret = networkGetNetworkAddress(glisten->network, &netAddr); + if (ret <= -2) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("network-based listen not possible, " + "network driver not present")); + goto error; } + if (ret < 0) + goto error; + + listenAddr = netAddr; + /* store the address we found in the <graphics> element so it will + * show up in status. */ + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + goto error; + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (!listenAddr) @@ -7632,7 +7635,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, !cfg->spicePassword) virBufferAddLit(&opt, "disable-ticketing,"); - if (tlsPort > 0) + if (glisten->tlsPort > 0) virBufferAsprintf(&opt, "x509-dir=%s,", cfg->spiceTLSx509certdir); switch (defaultMode) { @@ -7650,7 +7653,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, for (i = 0; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST; i++) { switch (graphics->data.spice.channels[i]) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - if (tlsPort <= 0) { + if (glisten->tlsPort <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice secure channels set in XML configuration, " "but TLS port is not provided")); @@ -7661,7 +7664,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - if (port <= 0) { + if (glisten->port <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice insecure channels set in XML " "configuration, but plain port is not provided")); @@ -7674,7 +7677,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: switch (defaultMode) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - if (tlsPort <= 0) { + if (glisten->tlsPort <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice defaultMode secure requested in XML " "configuration but TLS port not provided")); @@ -7683,7 +7686,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - if (port <= 0) { + if (glisten->port <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice defaultMode insecure requested in XML " "configuration but plain port not provided")); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f40b34d..06033df 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2645,6 +2645,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, goto cleanup; } + if (oldlisten->autoport != newlisten->autoport || + oldlisten->port != newlisten->port || + oldlisten->websocket != newlisten->websocket || + oldlisten->tlsPort != newlisten->tlsPort) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot change listen port settings " + "on '%s' graphics"), type); + goto cleanup; + } break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: @@ -2655,6 +2664,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, goto cleanup; } + if (oldlisten->autoport != newlisten->autoport || + oldlisten->port != newlisten->port || + oldlisten->websocket != newlisten->websocket || + oldlisten->tlsPort != newlisten->tlsPort) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot change listen port settings " + "on '%s' graphics"), type); + goto cleanup; + } break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: @@ -2666,12 +2684,6 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, switch (dev->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: - if (olddev->data.vnc.autoport != dev->data.vnc.autoport || - olddev->data.vnc.port != dev->data.vnc.port) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot change port settings on vnc graphics")); - goto cleanup; - } if (STRNEQ_NULLABLE(olddev->data.vnc.keymap, dev->data.vnc.keymap)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot change keymap setting on vnc graphics")); @@ -2709,13 +2721,6 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: - if (olddev->data.spice.autoport != dev->data.spice.autoport || - olddev->data.spice.port != dev->data.spice.port || - olddev->data.spice.tlsPort != dev->data.spice.tlsPort) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot change port settings on spice graphics")); - goto cleanup; - } if (STRNEQ_NULLABLE(olddev->data.spice.keymap, dev->data.spice.keymap)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 680c9ba..6440cf1 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -319,20 +319,26 @@ qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver, { qemuMigrationCookieGraphicsPtr mig = NULL; const char *listenAddr; - virDomainGraphicsListenDefPtr gListen = virDomainGraphicsGetListen(def, 0); + virDomainGraphicsListenDefPtr glisten = virDomainGraphicsGetListen(def, 0); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); if (VIR_ALLOC(mig) < 0) goto error; + if (!glisten) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + goto error; + } + mig->type = def->type; - mig->port = def->data.spice.port; + mig->port = glisten->port; if (cfg->spiceTLS) - mig->tlsPort = def->data.spice.tlsPort; + mig->tlsPort = glisten->tlsPort; else mig->tlsPort = -1; - if (!gListen || !(listenAddr = gListen->address)) + if (!glisten || !(listenAddr = glisten->address)) listenAddr = cfg->spiceListen; #ifdef WITH_GNUTLS diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index e30586f..d73e834 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -518,8 +518,11 @@ qemuParseCommandLineVnc(virDomainDefPtr def, * -vnc some.host.name:4 */ char *opts; - char *port; + char *portStr; const char *sep = ":"; + int port = 0; + int websocket = 0; + if (val[0] == '[') sep = "]:"; tmp = strstr(val, sep); @@ -528,17 +531,17 @@ qemuParseCommandLineVnc(virDomainDefPtr def, _("missing VNC port number in '%s'"), val); goto cleanup; } - port = tmp + strlen(sep); - if (virStrToLong_i(port, &opts, 10, - &vnc->data.vnc.port) < 0) { + + portStr = tmp + strlen(sep); + if (virStrToLong_i(portStr, &opts, 10, &port) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse VNC port '%s'"), port); + _("cannot parse VNC port '%s'"), portStr); goto cleanup; } + if (val[0] == '[') val++; - if (VIR_STRNDUP(listenAddr, val, tmp-val) < 0 || - virDomainGraphicsListenAppendAddress(vnc, listenAddr) < 0) + if (VIR_STRNDUP(listenAddr, val, tmp-val) < 0) goto cleanup; if (*opts == ',') { @@ -554,18 +557,18 @@ qemuParseCommandLineVnc(virDomainDefPtr def, *(nextopt++) = '\0'; if (STRPREFIX(opts, "websocket")) { - char *websocket = opts + strlen("websocket"); - if (*(websocket++) == '=' && - *websocket) { + char *websocketStr = opts + strlen("websocket"); + if (*(websocketStr++) == '=' && + *websocketStr) { /* If the websocket continues with * '=<something>', we'll parse it */ - if (virStrToLong_i(websocket, + if (virStrToLong_i(websocketStr, NULL, 0, - &vnc->data.vnc.websocket) < 0) { + &websocket) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse VNC " "WebSocket port '%s'"), - websocket); + websocketStr); VIR_FREE(orig_opts); goto cleanup; } @@ -573,8 +576,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def, /* Otherwise, we'll compute the port the same * way QEMU does, by adding a 5700 to the * display value. */ - vnc->data.vnc.websocket = - vnc->data.vnc.port + 5700; + websocket = port + 5700; } } else if (STRPREFIX(opts, "share=")) { char *sharePolicy = opts + strlen("share="); @@ -603,8 +605,11 @@ qemuParseCommandLineVnc(virDomainDefPtr def, } VIR_FREE(orig_opts); } - vnc->data.vnc.port += 5900; - vnc->data.vnc.autoport = false; + port += 5900; + + if (virDomainGraphicsListenAppendAddress(vnc, listenAddr, port, 0, + websocket, false) < 0) + goto cleanup; } if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, vnc) < 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f4bf6c1..9f96545 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3862,27 +3862,39 @@ qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver, bool allocate) { unsigned short port; + size_t i; if (graphics->data.vnc.socket) return 0; - if (!allocate) { - if (graphics->data.vnc.autoport) - graphics->data.vnc.port = 5900; + for (i = 0; i < graphics->nListens; i++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[i]; - return 0; - } + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (!allocate) { + if (glisten->autoport) + glisten->port = 5900; + continue; + } + if (glisten->autoport) { + if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) + return -1; + glisten->port = port; + } - if (graphics->data.vnc.autoport) { - if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) - return -1; - graphics->data.vnc.port = port; - } + if (glisten->websocket == -1) { + if (virPortAllocatorAcquire(driver->webSocketPorts, &port) < 0) + return -1; + glisten->websocket = port; + } + break; - if (graphics->data.vnc.websocket == -1) { - if (virPortAllocatorAcquire(driver->webSocketPorts, &port) < 0) - return -1; - graphics->data.vnc.websocket = port; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } } return 0; @@ -3902,24 +3914,8 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, bool needTLSPort = false; bool needPort = false; - if (graphics->data.spice.autoport) { - /* check if tlsPort or port need allocation */ - for (i = 0; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST; i++) { - switch (graphics->data.spice.channels[i]) { - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - needTLSPort = true; - break; - - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - needPort = true; - break; - - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - /* default mode will be used */ - break; - } - } - switch (defaultMode) { + for (i = 0; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST; i++) { + switch (graphics->data.spice.channels[i]) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: needTLSPort = true; break; @@ -3929,48 +3925,74 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - if (cfg->spiceTLS) - needTLSPort = true; - needPort = true; + /* default mode will be used */ break; } } + switch (defaultMode) { + case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: + needTLSPort = true; + break; - if (!allocate) { - if (needPort || graphics->data.spice.port == -1) - graphics->data.spice.port = 5901; - - if (needTLSPort || graphics->data.spice.tlsPort == -1) - graphics->data.spice.tlsPort = 5902; + case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: + needPort = true; + break; - return 0; + case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: + if (cfg->spiceTLS) + needTLSPort = true; + needPort = true; + break; } - if (needPort || graphics->data.spice.port == -1) { - if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) - goto error; + for (i = 0; i < graphics->nListens; i++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[i]; - graphics->data.spice.port = port; + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (!allocate) { + if ((glisten->autoport && needPort) || glisten->port == -1) + glisten->port = 5901; - if (!graphics->data.spice.autoport) - graphics->data.spice.portReserved = true; - } + if ((glisten->autoport && needTLSPort) || glisten->tlsPort == -1) + glisten->tlsPort = 5902; - if (needTLSPort || graphics->data.spice.tlsPort == -1) { - if (!cfg->spiceTLS) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Auto allocation of spice TLS port requested " - "but spice TLS is disabled in qemu.conf")); - goto error; - } + continue; + } - if (virPortAllocatorAcquire(driver->remotePorts, &tlsPort) < 0) - goto error; + if ((glisten->autoport && needPort) || glisten->port == -1) { + if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) + goto error; + + glisten->port = port; + + if (!glisten->autoport) + glisten->portReserved = true; + } + + if ((glisten->autoport && needTLSPort) || glisten->tlsPort == -1) { + if (!cfg->spiceTLS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Auto allocation of spice TLS port requested " + "but spice TLS is disabled in qemu.conf")); + goto error; + } - graphics->data.spice.tlsPort = tlsPort; + if (virPortAllocatorAcquire(driver->remotePorts, &tlsPort) < 0) + goto error; + + glisten->tlsPort = tlsPort; - if (!graphics->data.spice.autoport) - graphics->data.spice.tlsPortReserved = true; + if (!glisten->autoport) + glisten->tlsPortReserved = true; + } + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } } return 0; @@ -4351,35 +4373,44 @@ static int qemuProcessGraphicsReservePorts(virQEMUDriverPtr driver, virDomainObjPtr vm) { - size_t i; + size_t i, j; for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = vm->def->graphics[i]; - if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && - !graphics->data.vnc.autoport) { - if (virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.vnc.port, - true) < 0) - return -1; - graphics->data.vnc.portReserved = true; - - } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE && - !graphics->data.spice.autoport) { - if (graphics->data.spice.port > 0) { - if (virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.spice.port, - true) < 0) - return -1; - graphics->data.spice.portReserved = true; - } - if (graphics->data.spice.tlsPort > 0) { - if (virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.spice.tlsPort, - true) < 0) - return -1; - graphics->data.spice.tlsPortReserved = true; + switch (graphics->type) { + case VIR_DOMAIN_GRAPHICS_TYPE_VNC: + case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + for (j = 0; j < graphics->nListens; j++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || + glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { + if (!glisten->autoport) { + if (glisten->port > 0) { + if (virPortAllocatorSetUsed(driver->remotePorts, + glisten->port, + true) < 0) + return -1; + glisten->portReserved = true; + } + if (glisten->tlsPort > 0 && + graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + if (virPortAllocatorSetUsed(driver->remotePorts, + glisten->tlsPort, + true) < 0) + return -1; + glisten->tlsPortReserved = true; + } + } + } } + break; + + case VIR_DOMAIN_GRAPHICS_TYPE_SDL: + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: + case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: + case VIR_DOMAIN_GRAPHICS_TYPE_LAST: + break; } } @@ -6172,39 +6203,37 @@ void qemuProcessStop(virQEMUDriverPtr driver, */ for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = vm->def->graphics[i]; - if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - if (graphics->data.vnc.autoport) { - virPortAllocatorRelease(driver->remotePorts, - graphics->data.vnc.port); - } else if (graphics->data.vnc.portReserved) { - virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.spice.port, - false); - graphics->data.vnc.portReserved = false; - } - virPortAllocatorRelease(driver->webSocketPorts, - graphics->data.vnc.websocket); - } - if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - if (graphics->data.spice.autoport) { - virPortAllocatorRelease(driver->remotePorts, - graphics->data.spice.port); - virPortAllocatorRelease(driver->remotePorts, - graphics->data.spice.tlsPort); - } else { - if (graphics->data.spice.portReserved) { + size_t j; + + for (j = 0; j < graphics->nListens; j++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; + + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (glisten->autoport) { + virPortAllocatorRelease(driver->remotePorts, + glisten->port); + virPortAllocatorRelease(driver->remotePorts, + glisten->tlsPort); + } + if (glisten->portReserved) { virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.spice.port, - false); - graphics->data.spice.portReserved = false; + glisten->port, false); + glisten->portReserved = false; } - - if (graphics->data.spice.tlsPortReserved) { + if (glisten->tlsPortReserved) { virPortAllocatorSetUsed(driver->remotePorts, - graphics->data.spice.tlsPort, - false); - graphics->data.spice.tlsPortReserved = false; + glisten->tlsPort, false); + glisten->tlsPortReserved = false; } + virPortAllocatorRelease(driver->webSocketPorts, + glisten->websocket); + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } } } diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 13c3fec..6261c09 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -1579,7 +1579,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) char *guiDisplay = NULL; char *sdlDisplay = NULL; size_t i = 0; - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; for (i = 0; i < def->ngraphics; i++) { IVRDxServer *VRDxServer = NULL; @@ -1593,7 +1593,15 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) gVBoxAPI.UIVRDxServer.SetEnabled(VRDxServer, PR_TRUE); VIR_DEBUG("VRDP Support turned ON."); - gVBoxAPI.UIVRDxServer.SetPorts(data, VRDxServer, def->graphics[i]); + if (!(glisten = virDomainGraphicsGetListen(def->graphics[i], 0))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + return; + } + + gVBoxAPI.UIVRDxServer.SetPorts(data, VRDxServer, + glisten->port, + glisten->autoport); if (def->graphics[i]->data.rdp.replaceUser) { gVBoxAPI.UIVRDxServer.SetReuseSingleConnection(VRDxServer, @@ -1607,15 +1615,14 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VIR_DEBUG("VRDP set to allow multiple connection"); } - if ((gListen = virDomainGraphicsGetListen(def->graphics[i], 0)) && - gListen->address) { + if (glisten->address) { PRUnichar *netAddressUtf16 = NULL; - VBOX_UTF8_TO_UTF16(gListen->address, &netAddressUtf16); + VBOX_UTF8_TO_UTF16(glisten->address, &netAddressUtf16); gVBoxAPI.UIVRDxServer.SetNetAddress(data, VRDxServer, netAddressUtf16); VIR_DEBUG("VRDP listen address is set to: %s", - gListen->address); + glisten->address); VBOX_UTF16_FREE(netAddressUtf16); } @@ -3371,11 +3378,13 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) PRUnichar *netAddressUtf16 = NULL; PRBool allowMultiConnection = PR_FALSE; PRBool reuseSingleConnection = PR_FALSE; + int port = 0; + bool autoport = false; if (VIR_ALLOC(graphics) < 0) goto cleanup; - gVBoxAPI.UIVRDxServer.GetPorts(data, VRDxServer, graphics); + gVBoxAPI.UIVRDxServer.GetPorts(data, VRDxServer, &port, &autoport); graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_RDP; @@ -3388,7 +3397,8 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) if (netAddressUtf8 && STREQ(netAddressUtf8, "")) VBOX_UTF8_FREE(netAddressUtf8); - if (virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8, + port, 0, 0, autoport) < 0) goto cleanup; gVBoxAPI.UIVRDxServer.GetAllowMultiConnection(VRDxServer, &allowMultiConnection); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 7a8205d..267367a 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3865,26 +3865,28 @@ _vrdxServerSetEnabled(IVRDxServer *VRDxServer, PRBool enabled) static nsresult _vrdxServerGetPorts(vboxGlobalData *data ATTRIBUTE_UNUSED, - IVRDxServer *VRDxServer, virDomainGraphicsDefPtr graphics) + IVRDxServer *VRDxServer, + int *port, + bool *autoport) { nsresult rc; #if VBOX_API_VERSION < 3001000 PRUint32 VRDPport = 0; rc = VRDxServer->vtbl->GetPort(VRDxServer, &VRDPport); if (VRDPport) { - graphics->data.rdp.port = VRDPport; + *port = VRDPport; } else { - graphics->data.rdp.autoport = true; + *autoport = true; } #elif VBOX_API_VERSION < 4000000 /* 3001000 <= VBOX_API_VERSION < 4000000 */ PRUnichar *VRDPport = NULL; rc = VRDxServer->vtbl->GetPorts(VRDxServer, &VRDPport); if (VRDPport) { /* even if vbox supports mutilpe ports, single port for now here */ - graphics->data.rdp.port = PRUnicharToInt(VRDPport); + *port = PRUnicharToInt(VRDPport); VBOX_UTF16_FREE(VRDPport); } else { - graphics->data.rdp.autoport = true; + *autoport = true; } #else /* VBOX_API_VERSION >= 4000000 */ PRUnichar *VRDEPortsKey = NULL; @@ -3894,10 +3896,10 @@ _vrdxServerGetPorts(vboxGlobalData *data ATTRIBUTE_UNUSED, VBOX_UTF16_FREE(VRDEPortsKey); if (VRDEPortsValue) { /* even if vbox supports mutilpe ports, single port for now here */ - graphics->data.rdp.port = PRUnicharToInt(VRDEPortsValue); + *port = PRUnicharToInt(VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsValue); } else { - graphics->data.rdp.autoport = true; + *autoport = true; } #endif /* VBOX_API_VERSION >= 4000000 */ return rc; @@ -3905,16 +3907,16 @@ _vrdxServerGetPorts(vboxGlobalData *data ATTRIBUTE_UNUSED, static nsresult _vrdxServerSetPorts(vboxGlobalData *data ATTRIBUTE_UNUSED, - IVRDxServer *VRDxServer, virDomainGraphicsDefPtr graphics) + IVRDxServer *VRDxServer, + const int port, + const bool autoport ATTRIBUTE_UNUSED) { nsresult rc = 0; #if VBOX_API_VERSION < 3001000 - if (graphics->data.rdp.port) { - rc = VRDxServer->vtbl->SetPort(VRDxServer, - graphics->data.rdp.port); - VIR_DEBUG("VRDP Port changed to: %d", - graphics->data.rdp.port); - } else if (graphics->data.rdp.autoport) { + if (port) { + rc = VRDxServer->vtbl->SetPort(VRDxServer, port); + VIR_DEBUG("VRDP Port changed to: %d", port); + } else if (autoport) { /* Setting the port to 0 will reset its value to * the default one which is 3389 currently */ @@ -3923,14 +3925,14 @@ _vrdxServerSetPorts(vboxGlobalData *data ATTRIBUTE_UNUSED, } #elif VBOX_API_VERSION < 4000000 /* 3001000 <= VBOX_API_VERSION < 4000000 */ PRUnichar *portUtf16 = NULL; - portUtf16 = PRUnicharFromInt(graphics->data.rdp.port); + portUtf16 = PRUnicharFromInt(port); rc = VRDxServer->vtbl->SetPorts(VRDxServer, portUtf16); VBOX_UTF16_FREE(portUtf16); #else /* VBOX_API_VERSION >= 4000000 */ PRUnichar *VRDEPortsKey = NULL; PRUnichar *VRDEPortsValue = NULL; VBOX_UTF8_TO_UTF16("TCP/Ports", &VRDEPortsKey); - VRDEPortsValue = PRUnicharFromInt(graphics->data.rdp.port); + VRDEPortsValue = PRUnicharFromInt(port); rc = VRDxServer->vtbl->SetVRDEProperty(VRDxServer, VRDEPortsKey, VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsKey); diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index a469968..eb4c9c8 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -379,9 +379,9 @@ typedef struct { nsresult (*GetEnabled)(IVRDxServer *VRDxServer, PRBool *enabled); nsresult (*SetEnabled)(IVRDxServer *VRDxServer, PRBool enabled); nsresult (*GetPorts)(vboxGlobalData *data, IVRDxServer *VRDxServer, - virDomainGraphicsDefPtr graphics); + int *port, bool *autoport); nsresult (*SetPorts)(vboxGlobalData *data, IVRDxServer *VRDxServer, - virDomainGraphicsDefPtr graphics); + const int port, const bool autoport); nsresult (*GetReuseSingleConnection)(IVRDxServer *VRDxServer, PRBool *enabled); nsresult (*SetReuseSingleConnection)(IVRDxServer *VRDxServer, PRBool enabled); nsresult (*GetAllowMultiConnection)(IVRDxServer *VRDxServer, PRBool *enabled); diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 6505dd7..8084a86 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1843,6 +1843,7 @@ int virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) { bool enabled = false; + bool autoport = false; long long port = 0; char *listenAddr = NULL; @@ -1875,24 +1876,22 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) goto failure; } - if (virDomainGraphicsListenAppendAddress(*def, listenAddr) < 0) - goto failure; - VIR_FREE(listenAddr); - if (port < 0) { VIR_WARN("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' " "is missing, the VNC port is unknown"); - (*def)->data.vnc.port = 0; - (*def)->data.vnc.autoport = true; + port = 0; + autoport = true; } else { if (port < 5900 || port > 5964) VIR_WARN("VNC port %lld it out of [5900..5964] range", port); - - (*def)->data.vnc.port = port; - (*def)->data.vnc.autoport = false; } + if (virDomainGraphicsListenAppendAddress(*def, listenAddr, port, 0, 0, + autoport) < 0) + goto failure; + VIR_FREE(listenAddr); + return 0; failure: @@ -3402,7 +3401,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) { - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); @@ -3411,23 +3410,26 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) virBufferAddLit(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n"); - if (def->data.vnc.autoport) { - VIR_WARN("VNC autoport is enabled, but the automatically assigned " - "VNC port cannot be read back"); - } else { - if (def->data.vnc.port < 5900 || def->data.vnc.port > 5964) { - VIR_WARN("VNC port %d it out of [5900..5964] range", - def->data.vnc.port); - } + glisten = virDomainGraphicsGetListen(def, 0); - virBufferAsprintf(buffer, "RemoteDisplay.vnc.port = \"%d\"\n", - def->data.vnc.port); - } + if (glisten) { + if (glisten->autoport) { + VIR_WARN("VNC autoport is enabled, but the automatically assigned " + "VNC port cannot be read back"); + } else { + if (glisten->port < 5900 || glisten->port > 5964) { + VIR_WARN("VNC port %d it out of [5900..5964] range", + glisten->port); + } - if ((gListen = virDomainGraphicsGetListen(def, 0)) && - gListen->address) { - virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n", - gListen->address); + virBufferAsprintf(buffer, "RemoteDisplay.vnc.port = \"%d\"\n", + glisten->port); + } + + if (glisten->address) { + virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n", + glisten->address); + } } if (def->data.vnc.keymap != NULL) { diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index b321d39..d0f2516 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -993,9 +993,7 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) pret = PrlVmCfg_GetVNCPort(sdkdom, &port); prlsdkCheckRetGoto(pret, error); - gr->data.vnc.autoport = (vncMode == PRD_AUTO); gr->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC; - gr->data.vnc.port = port; gr->data.vnc.keymap = NULL; gr->data.vnc.socket = NULL; gr->data.vnc.auth.passwd = NULL; @@ -1007,12 +1005,13 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) gr->nListens = 1; + gr->listens[0].type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; + gr->listens[0].autoport = (vncMode == PRD_AUTO); + gr->listens[0].port = port; if (!(gr->listens[0].address = prlsdkGetStringParamVar(PrlVmCfg_GetVNCHostName, sdkdom))) goto error; - gr->listens[0].type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; - if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, gr) < 0) goto error; @@ -2683,7 +2682,7 @@ static int prlsdkCheckFSUnsupportedParams(virDomainFSDefPtr fs) static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) { virDomainGraphicsDefPtr gr; - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; PRL_RESULT pret; int ret = -1; @@ -2695,23 +2694,28 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) gr = def->graphics[0]; - if (gr->data.vnc.autoport) { + if (!(glisten = virDomainGraphicsGetListen(gr, 0))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + goto cleanup; + } + + if (glisten->autoport) { pret = PrlVmCfg_SetVNCMode(sdkdom, PRD_AUTO); prlsdkCheckRetGoto(pret, cleanup); } else { pret = PrlVmCfg_SetVNCMode(sdkdom, PRD_MANUAL); prlsdkCheckRetGoto(pret, cleanup); - pret = PrlVmCfg_SetVNCPort(sdkdom, gr->data.vnc.port); + pret = PrlVmCfg_SetVNCPort(sdkdom, glisten->port); prlsdkCheckRetGoto(pret, cleanup); } - if ((gListen = virDomainGraphicsGetListen(gr, 0))) { - if (!gListen->address) - goto cleanup; - pret = PrlVmCfg_SetVNCHostName(sdkdom, gListen->address); - prlsdkCheckRetGoto(pret, cleanup); - } + if (!glisten->address) + goto cleanup; + + pret = PrlVmCfg_SetVNCHostName(sdkdom, glisten->address); + prlsdkCheckRetGoto(pret, cleanup); ret = 0; cleanup: diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index c753fa8..d76905e 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -570,6 +570,8 @@ static int xenParseVfb(virConfPtr conf, virDomainDefPtr def) { int val; + int port = 0; + bool autoport = false; char *listenAddr = NULL; int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM; virConfValuePtr list; @@ -584,17 +586,18 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC; if (xenConfigGetBool(conf, "vncunused", &val, 1) < 0) goto cleanup; - graphics->data.vnc.autoport = val ? 1 : 0; - if (!graphics->data.vnc.autoport) { + autoport = val ? 1 : 0; + if (!autoport) { unsigned long vncdisplay; if (xenConfigGetULong(conf, "vncdisplay", &vncdisplay, 0) < 0) goto cleanup; - graphics->data.vnc.port = (int)vncdisplay + 5900; + port = (int)vncdisplay + 5900; } if (xenConfigCopyStringOpt(conf, "vnclisten", &listenAddr) < 0) goto cleanup; - if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr, + port, 0, 0, autoport) < 0) goto cleanup; VIR_FREE(listenAddr); @@ -661,7 +664,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (STRPREFIX(key, "vncunused=")) { if (STREQ(key + 10, "1")) - graphics->data.vnc.autoport = true; + autoport = true; } else if (STRPREFIX(key, "vnclisten=")) { if (VIR_STRDUP(listenAddr, key+10) < 0) goto cleanup; @@ -672,14 +675,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (VIR_STRDUP(graphics->data.vnc.keymap, key + 7) < 0) goto cleanup; } else if (STRPREFIX(key, "vncdisplay=")) { - if (virStrToLong_i(key + 11, NULL, 10, - &graphics->data.vnc.port) < 0) { + if (virStrToLong_i(key + 11, NULL, 10, &port) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid vncdisplay value '%s'"), key + 11); goto cleanup; } - graphics->data.vnc.port += 5900; + port += 5900; } } else { if (STRPREFIX(key, "display=")) { @@ -699,10 +701,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) } if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (virDomainGraphicsListenAppendAddress(graphics, - listenAddr) < 0) + listenAddr, + port, 0, 0, + autoport) < 0) goto cleanup; VIR_FREE(listenAddr); } + if (VIR_ALLOC_N(def->graphics, 1) < 0) goto cleanup; def->graphics[0] = graphics; @@ -1632,7 +1637,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def) def->graphics[0]->data.sdl.xauth) < 0) return -1; } else { - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; if (xenConfigSetInt(conf, "sdl", 0) < 0) return -1; @@ -1640,19 +1645,20 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def) if (xenConfigSetInt(conf, "vnc", 1) < 0) return -1; - if (xenConfigSetInt(conf, "vncunused", - def->graphics[0]->data.vnc.autoport ? 1 : 0) < 0) - return -1; + if ((glisten = virDomainGraphicsGetListen(def->graphics[0], 0))) { + if (xenConfigSetInt(conf, "vncunused", + glisten->autoport ? 1 : 0) < 0) + return -1; - if (!def->graphics[0]->data.vnc.autoport && - xenConfigSetInt(conf, "vncdisplay", - def->graphics[0]->data.vnc.port - 5900) < 0) - return -1; + if (!glisten->autoport && + xenConfigSetInt(conf, "vncdisplay", + glisten->port - 5900) < 0) + return -1; - if ((gListen = virDomainGraphicsGetListen(def->graphics[0], 0)) && - gListen->address && - xenConfigSetString(conf, "vnclisten", gListen->address) < 0) - return -1; + if (glisten->address && + xenConfigSetString(conf, "vnclisten", glisten->address) < 0) + return -1; + } if (def->graphics[0]->data.vnc.auth.passwd && xenConfigSetString(conf, "vncpasswd", @@ -1678,17 +1684,20 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def) virBufferAsprintf(&buf, ",xauthority=%s", def->graphics[0]->data.sdl.xauth); } else { - virDomainGraphicsListenDefPtr gListen + virDomainGraphicsListenDefPtr glisten = virDomainGraphicsGetListen(def->graphics[0], 0); virBufferAddLit(&buf, "type=vnc"); - virBufferAsprintf(&buf, ",vncunused=%d", - def->graphics[0]->data.vnc.autoport ? 1 : 0); - if (!def->graphics[0]->data.vnc.autoport) - virBufferAsprintf(&buf, ",vncdisplay=%d", - def->graphics[0]->data.vnc.port - 5900); - if (gListen && gListen->address) - virBufferAsprintf(&buf, ",vnclisten=%s", gListen->address); + + if (glisten) { + virBufferAsprintf(&buf, ",vncunused=%d", + glisten->autoport ? 1 : 0); + if (!glisten->autoport) + virBufferAsprintf(&buf, ",vncdisplay=%d", + glisten->port - 5900); + if (glisten->address) + virBufferAsprintf(&buf, ",vnclisten=%s", glisten->address); + } if (def->graphics[0]->data.vnc.auth.passwd) virBufferAsprintf(&buf, ",vncpasswd=%s", def->graphics[0]->data.vnc.auth.passwd); diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 8b5e063..43356f7 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -851,23 +851,21 @@ xenParseSxprGraphicsOld(virDomainDefPtr def, if ((tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux")) && tmp[0] == '1') { /* Graphics device (HVM, or old (pre-3.0.4) style PV VNC config) */ - int port; + bool autoport = false; const char *listenAddr = sexpr_fmt_node(root, "domain/image/%s/vnclisten", hvm ? "hvm" : "linux"); const char *vncPasswd = sexpr_fmt_node(root, "domain/image/%s/vncpasswd", hvm ? "hvm" : "linux"); const char *keymap = sexpr_fmt_node(root, "domain/image/%s/keymap", hvm ? "hvm" : "linux"); const char *unused = sexpr_fmt_node(root, "domain/image/%s/vncunused", hvm ? "hvm" : "linux"); - port = vncport; - if (VIR_ALLOC(graphics) < 0) goto error; graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC; - if ((unused && STREQ(unused, "1")) || port == -1) - graphics->data.vnc.autoport = true; - graphics->data.vnc.port = port; + if ((unused && STREQ(unused, "1")) || vncport == -1) + autoport = true; - if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr, + vncport, 0, 0, autoport) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) @@ -964,14 +962,13 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, if (VIR_STRDUP(graphics->data.sdl.xauth, xauth) < 0) goto error; } else { - int port; + int port = vncport; + bool autoport = false; const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten"); const char *vncPasswd = sexpr_node(node, "device/vfb/vncpasswd"); const char *keymap = sexpr_node(node, "device/vfb/keymap"); const char *unused = sexpr_node(node, "device/vfb/vncunused"); - port = vncport; - /* Didn't find port entry in xenstore */ if (port == -1) { const char *str = sexpr_node(node, "device/vfb/vncdisplay"); @@ -981,13 +978,13 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, } if ((unused && STREQ(unused, "1")) || port == -1) - graphics->data.vnc.autoport = true; + autoport = true; if (port >= 0 && port < 5900) port += 5900; - graphics->data.vnc.port = port; - if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr, + port, 0, 0, autoport) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) @@ -1523,7 +1520,7 @@ static int xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, virBufferPtr buf) { - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { @@ -1544,16 +1541,20 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, virBufferAsprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBufferAddLit(buf, "(type vnc)"); - if (def->data.vnc.autoport) { - virBufferAddLit(buf, "(vncunused 1)"); - } else { - virBufferAddLit(buf, "(vncunused 0)"); - virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); - } - if ((gListen = virDomainGraphicsGetListen(def, 0)) && - gListen->address) - virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address); + glisten = virDomainGraphicsGetListen(def, 0); + + if (glisten) { + if (glisten->autoport) { + virBufferAddLit(buf, "(vncunused 1)"); + } else { + virBufferAddLit(buf, "(vncunused 0)"); + virBufferAsprintf(buf, "(vncdisplay %d)", glisten->port-5900); + } + + if (glisten->address) + virBufferAsprintf(buf, "(vnclisten '%s')", glisten->address); + } if (def->data.vnc.auth.passwd) virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); if (def->data.vnc.keymap) @@ -1579,7 +1580,7 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, static int xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf) { - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { @@ -1597,16 +1598,18 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf) virBufferAsprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBufferAddLit(buf, "(vnc 1)"); - if (def->data.vnc.autoport) { - virBufferAddLit(buf, "(vncunused 1)"); - } else { - virBufferAddLit(buf, "(vncunused 0)"); - virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); - } - if ((gListen = virDomainGraphicsGetListen(def, 0)) && - gListen->address) - virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address); + if ((glisten = virDomainGraphicsGetListen(def, 0))) { + if (glisten->autoport) { + virBufferAddLit(buf, "(vncunused 1)"); + } else { + virBufferAddLit(buf, "(vncunused 0)"); + virBufferAsprintf(buf, "(vncdisplay %d)", glisten->port-5900); + } + + if (glisten->address) + virBufferAsprintf(buf, "(vnclisten '%s')", glisten->address); + } if (def->data.vnc.auth.passwd) virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); if (def->data.vnc.keymap) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 7d41e05..8acc48c 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -172,6 +172,8 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) { virDomainGraphicsDefPtr graphics = NULL; unsigned long port; + unsigned long tlsPort; + bool autoport = false; char *listenAddr = NULL; int val; @@ -186,22 +188,20 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE; if (xenConfigCopyStringOpt(conf, "spicehost", &listenAddr) < 0) goto cleanup; - if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) - goto cleanup; - VIR_FREE(listenAddr); - if (xenConfigGetULong(conf, "spicetls_port", &port, 0) < 0) + if (xenConfigGetULong(conf, "spiceport", &port, 0) < 0) goto cleanup; - graphics->data.spice.tlsPort = (int)port; - if (xenConfigGetULong(conf, "spiceport", &port, 0) < 0) + if (xenConfigGetULong(conf, "spicetls_port", &tlsPort, 0) < 0) goto cleanup; - graphics->data.spice.port = (int)port; + if (!tlsPort && !port) + autoport = true; - if (!graphics->data.spice.tlsPort && - !graphics->data.spice.port) - graphics->data.spice.autoport = 1; + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr, + (int)port, (int)tlsPort, + 0, autoport) < 0) + goto cleanup; if (xenConfigGetBool(conf, "spicedisable_ticketing", &val, 0) < 0) goto cleanup; @@ -236,6 +236,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) } } + VIR_FREE(listenAddr); return 0; cleanup: @@ -837,7 +838,7 @@ xenFormatXLDomainDisks(virConfPtr conf, virDomainDefPtr def) static int xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def) { - virDomainGraphicsListenDefPtr gListen; + virDomainGraphicsListenDefPtr glisten; virDomainGraphicsDefPtr graphics; if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) { @@ -854,18 +855,19 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def) if (xenConfigSetInt(conf, "spice", 1) < 0) return -1; - if ((gListen = virDomainGraphicsGetListen(graphics, 0)) && - gListen->address && - xenConfigSetString(conf, "spicehost", gListen->address) < 0) - return -1; + if ((glisten = virDomainGraphicsGetListen(graphics, 0))) { + if (glisten->address && + xenConfigSetString(conf, "spicehost", glisten->address) < 0) + return -1; - if (xenConfigSetInt(conf, "spiceport", - graphics->data.spice.port) < 0) - return -1; + if (xenConfigSetInt(conf, "spiceport", + glisten->port) < 0) + return -1; - if (xenConfigSetInt(conf, "spicetls_port", - graphics->data.spice.tlsPort) < 0) - return -1; + if (xenConfigSetInt(conf, "spicetls_port", + glisten->tlsPort) < 0) + return -1; + } if (graphics->data.spice.auth.passwd) { if (xenConfigSetInt(conf, "spicedisable_ticketing", 0) < 0) diff --git a/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml new file mode 100644 index 0000000..0ba6f9e --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address' address='127.0.0.1' port='5900' autoport='no'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-minimal.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-minimal.xml index 8bbf5df..ef8426e 100644 --- a/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-minimal.xml +++ b/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-minimal.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc'> - <listen type='address' address='127.0.0.1'/> + <listen type='address'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1'/> diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml new file mode 100644 index 0000000..d638358 --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc'> + <listen type='address' address='127.0.0.1' port='5900' autoport='no'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml new file mode 100644 index 0000000..b0333c3 --- /dev/null +++ b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='5900' autoport='no' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1' port='5900' autoport='no'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml index aa00d34..2d61b41 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='192.168.123.123'> - <listen type='address' address='192.168.123.123'/> + <listen type='address' address='192.168.123.123' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-attr-only.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-attr-only.xml index ee4909b..e0eb61e 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-attr-only.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-attr-only.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-minimal.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-minimal.xml index ee4909b..6309cf8 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-minimal.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-minimal.xml @@ -19,8 +19,8 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <graphics type='vnc' port='-1' autoport='yes'> + <listen type='address' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml new file mode 100644 index 0000000..b0333c3 --- /dev/null +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' port='5900' autoport='no' listen='127.0.0.1'> + <listen type='address' address='127.0.0.1' port='5900' autoport='no'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address.xml index ee4909b..e0eb61e 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml index 7301057..6309cf8 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-manual-port.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml index 7301057..6309cf8 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-minimal.xml @@ -20,7 +20,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 70ecd2d..76c18e5 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -84,9 +84,12 @@ mymain(void) DO_TEST_DIFFERENT("graphics-listen-back-compat"); DO_TEST_FULL("graphics-listen-back-compat-mismatch", 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + DO_TEST_FULL("graphics-listen-back-compat-ports", 0, false, + TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); DO_TEST_DIFFERENT("graphics-vnc-listen-attr-only"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-minimal"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address"); + DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address-port"); DO_TEST_FULL("name-slash-parse", 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml index 3ebb375..be722ed 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml @@ -26,7 +26,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='65530' autoport='no' listen='::' sharePolicy='allow-exclusive'> - <listen type='address' address='::'/> + <listen type='address' address='::' port='65530' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml index 5b7d560..298ffcd 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml @@ -26,7 +26,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml index 5b7d560..298ffcd 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml @@ -26,7 +26,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml index 260ad1c..0db910a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml @@ -19,7 +19,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5900' websocket='5700' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml index 374345b..d5603c3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml @@ -26,7 +26,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'> - <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> + <listen type='address' address='2001:1:2:3:4:5:1234:1234' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index a2796ec..b6d645b 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -85,7 +85,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'> - <listen type='address' address='0.0.0.0'/> + <listen type='address' address='0.0.0.0' autoport='yes'/> </graphics> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml index 2ae104e..cc6e3b8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml @@ -82,7 +82,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'> - <listen type='address' address='0.0.0.0'/> + <listen type='address' address='0.0.0.0' autoport='yes'/> </graphics> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml index 79f990c..3d80f33 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no'> - <listen type='network' network='Bobsnetwork'/> + <listen type='network' network='Bobsnetwork' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml index a0831aa..aac899f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml @@ -29,8 +29,8 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='1.2.3.4'> - <listen type='address' address='1.2.3.4'/> - <listen type='network' network='Bobsnetwork'/> + <listen type='address' address='1.2.3.4' autoport='yes'/> + <listen type='network' network='Bobsnetwork' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml index dea1347..c421e1c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' tlsPort='5904' autoport='no'/> <image compression='auto_glz'/> <jpeg compression='auto'/> <zlib compression='auto'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml index a17fab2..0bf6bf4 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' tlsPort='5904' autoport='no'/> <channel name='main' mode='secure'/> <channel name='inputs' mode='insecure'/> </graphics> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 912b542..f0dc9c1 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -78,7 +78,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'> - <listen type='address'/> + <listen type='address' port='5900' autoport='no'/> </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml index 59ed507..934e1d2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' tlsPort='5904' autoport='no'/> <channel name='main' mode='secure'/> <channel name='inputs' mode='insecure'/> <image compression='auto_glz'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml index 7440533..7450566 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml @@ -29,7 +29,7 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' port='-1' autoport='yes'/> + <graphics type='vnc'/> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml index 0627bbd..5772fe2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'> - <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> + <listen type='address' address='2001:1:2:3:4:5:1234:1234' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml index f29abe2..dcefb98 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml index f29abe2..dcefb98 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml index 6e879eb..35260ec 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml @@ -21,7 +21,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5900' websocket='5700' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml index 0627bbd..5772fe2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'> - <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> + <listen type='address' address='2001:1:2:3:4:5:1234:1234' port='5903' autoport='no'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml index 95b6e2d..4fc9f08 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -120,7 +120,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index 1fb740b..7243800 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml @@ -64,7 +64,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml index 6464890..b93e714 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml index 61de009..3feea02 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml @@ -238,7 +238,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml index 050967b..d6e40af 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml @@ -39,7 +39,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' autoport='yes' listen='0.0.0.0'> - <listen type='address' address='0.0.0.0'/> + <listen type='address' address='0.0.0.0' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml index 5b18cac..208529e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml @@ -38,7 +38,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5903' tlsPort='5904' autoport='no'/> </graphics> <video> <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml index a6dddab..fd260ea 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' autoport='no'> - <listen type='address'/> + <listen type='address' autoport='no'/> <gl enable='yes'/> </graphics> <video> diff --git a/tests/sexpr2xmldata/sexpr2xml-curmem.xml b/tests/sexpr2xmldata/sexpr2xml-curmem.xml index 601749e..da92c58 100644 --- a/tests/sexpr2xmldata/sexpr2xml-curmem.xml +++ b/tests/sexpr2xmldata/sexpr2xml-curmem.xml @@ -34,7 +34,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml index e8ae46c..80b34a2 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml @@ -50,7 +50,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5925' autoport='yes' keymap='en-us'> - <listen type='address'/> + <listen type='address' port='5925' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml index 0adac34..e11f9b4 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml index 4f02e80..62b12d9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml index caa10d9..e8f1857 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml index 189215a..aa0395b 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml b/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml index 386726a..b6f83b0 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml index 9fdc16f..b1c3312 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml @@ -48,7 +48,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml index 50dac3b..727ef3b 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2-ports.xml @@ -55,7 +55,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml index f0c9c4f..ec537e4 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-dev-2nd-port.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml index 127de7d..c7d8808 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml index 2b4c0c9..65cc3cd 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml index 2080a4d..efe3fc7 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml index c51a79a..e6983eb 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml index 6226a28..0d701fb 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml index 071645f..2c9e885 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml index 3eda513..61bcfbc 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml index 35b6f84..92ff3dc 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml index fe5bf11..0268213 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml index 65ba506..473672a 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <sound model='sb16'/> <sound model='es1370'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml index 65ba506..473672a 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <sound model='sb16'/> <sound model='es1370'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml index f034bc1..28b4242 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml index ab350c0..9fba9c4 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml index e49854f..ef7ffc9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml index e49854f..ef7ffc9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-fv.xml b/tests/sexpr2xmldata/sexpr2xml-fv.xml index e49854f..ef7ffc9 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml b/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml index 1701895..60fe617 100644 --- a/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml +++ b/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml @@ -48,7 +48,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml index 72fec25..1c89de3 100644 --- a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml @@ -27,7 +27,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='5925' autoport='no' listen='0.0.0.0' keymap='ja'> - <listen type='address' address='0.0.0.0'/> + <listen type='address' address='0.0.0.0' port='5925' autoport='no'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml index 0fd7a88..84eac6d 100644 --- a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml @@ -27,7 +27,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='ja'> - <listen type='address' address='0.0.0.0'/> + <listen type='address' address='0.0.0.0' port='-1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml index 06e7280..8e94069 100644 --- a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml @@ -32,7 +32,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml b/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml index bfcd7c3..12bde0e 100644 --- a/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml +++ b/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml @@ -47,7 +47,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='ja'> - <listen type='address'/> + <listen type='address' port='-1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml index 3c57579..9a9c9a8 100644 --- a/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml +++ b/tests/vmx2xmldata/vmx2xml-graphics-vnc.xml @@ -12,7 +12,7 @@ <on_crash>destroy</on_crash> <devices> <graphics type='vnc' port='5903' autoport='no' keymap='de' passwd='password'> - <listen type='address'/> + <listen type='address' port='5903' autoport='no'/> </graphics> <video> <model type='vmvga' vram='4096' primary='yes'/> diff --git a/tests/xlconfigdata/test-disk-positional-parms-full.xml b/tests/xlconfigdata/test-disk-positional-parms-full.xml index 41e8804..38b7b4a 100644 --- a/tests/xlconfigdata/test-disk-positional-parms-full.xml +++ b/tests/xlconfigdata/test-disk-positional-parms-full.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-disk-positional-parms-partial.xml b/tests/xlconfigdata/test-disk-positional-parms-partial.xml index 6578e59..9de28a8 100644 --- a/tests/xlconfigdata/test-disk-positional-parms-partial.xml +++ b/tests/xlconfigdata/test-disk-positional-parms-partial.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-bogus-extra.xml b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-bogus-extra.xml index 3738c8e..1b9ffee 100644 --- a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-bogus-extra.xml +++ b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-bogus-extra.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-extra.xml b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-extra.xml index 3738c8e..1b9ffee 100644 --- a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-extra.xml +++ b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot-extra.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot.xml b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot.xml index 3738c8e..1b9ffee 100644 --- a/tests/xlconfigdata/test-fullvirt-direct-kernel-boot.xml +++ b/tests/xlconfigdata/test-fullvirt-direct-kernel-boot.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-fullvirt-multiusb.xml b/tests/xlconfigdata/test-fullvirt-multiusb.xml index d7df23a..ab60fd9 100644 --- a/tests/xlconfigdata/test-fullvirt-multiusb.xml +++ b/tests/xlconfigdata/test-fullvirt-multiusb.xml @@ -45,7 +45,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-fullvirt-nohap.xml b/tests/xlconfigdata/test-fullvirt-nohap.xml index 9cd7b0b..b56c5fd 100644 --- a/tests/xlconfigdata/test-fullvirt-nohap.xml +++ b/tests/xlconfigdata/test-fullvirt-nohap.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-new-disk.xml b/tests/xlconfigdata/test-new-disk.xml index 41e8804..38b7b4a 100644 --- a/tests/xlconfigdata/test-new-disk.xml +++ b/tests/xlconfigdata/test-new-disk.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-rbd-multihost-noauth.xml b/tests/xlconfigdata/test-rbd-multihost-noauth.xml index 728aa1e..78edca1 100644 --- a/tests/xlconfigdata/test-rbd-multihost-noauth.xml +++ b/tests/xlconfigdata/test-rbd-multihost-noauth.xml @@ -46,7 +46,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xlconfigdata/test-spice-features.xml b/tests/xlconfigdata/test-spice-features.xml index 3820732..7d3f65d 100644 --- a/tests/xlconfigdata/test-spice-features.xml +++ b/tests/xlconfigdata/test-spice-features.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='590' tlsPort='500' autoport='no' listen='127.0.0.1' passwd='thebeast'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='590' tlsPort='500' autoport='no'/> <mouse mode='client'/> <clipboard copypaste='yes'/> </graphics> diff --git a/tests/xlconfigdata/test-spice.xml b/tests/xlconfigdata/test-spice.xml index f33691f..3673716 100644 --- a/tests/xlconfigdata/test-spice.xml +++ b/tests/xlconfigdata/test-spice.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' port='590' tlsPort='500' autoport='no' listen='127.0.0.1' passwd='thebeast'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='590' tlsPort='500' autoport='no'/> <mouse mode='server'/> <clipboard copypaste='no'/> </graphics> diff --git a/tests/xlconfigdata/test-vif-rate.xml b/tests/xlconfigdata/test-vif-rate.xml index 3620e2a..d5ea04b 100644 --- a/tests/xlconfigdata/test-vif-rate.xml +++ b/tests/xlconfigdata/test-vif-rate.xml @@ -52,7 +52,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-escape-paths.xml b/tests/xmconfigdata/test-escape-paths.xml index a5daa2c..8819685 100644 --- a/tests/xmconfigdata/test-escape-paths.xml +++ b/tests/xmconfigdata/test-escape-paths.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <sound model='sb16'/> <sound model='es1370'/> diff --git a/tests/xmconfigdata/test-fullvirt-default-feature.xml b/tests/xmconfigdata/test-fullvirt-default-feature.xml index ce1280d..8d247ae 100644 --- a/tests/xmconfigdata/test-fullvirt-default-feature.xml +++ b/tests/xmconfigdata/test-fullvirt-default-feature.xml @@ -45,7 +45,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-force-hpet.xml b/tests/xmconfigdata/test-fullvirt-force-hpet.xml index ce1280d..8d247ae 100644 --- a/tests/xmconfigdata/test-fullvirt-force-hpet.xml +++ b/tests/xmconfigdata/test-fullvirt-force-hpet.xml @@ -45,7 +45,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-force-nohpet.xml b/tests/xmconfigdata/test-fullvirt-force-nohpet.xml index 7636f31..f4fa685 100644 --- a/tests/xmconfigdata/test-fullvirt-force-nohpet.xml +++ b/tests/xmconfigdata/test-fullvirt-force-nohpet.xml @@ -45,7 +45,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-localtime.xml b/tests/xmconfigdata/test-fullvirt-localtime.xml index b3adf86..a0506c7 100644 --- a/tests/xmconfigdata/test-fullvirt-localtime.xml +++ b/tests/xmconfigdata/test-fullvirt-localtime.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-net-netfront.xml b/tests/xmconfigdata/test-fullvirt-net-netfront.xml index c22ad8d..f4299e0 100644 --- a/tests/xmconfigdata/test-fullvirt-net-netfront.xml +++ b/tests/xmconfigdata/test-fullvirt-net-netfront.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-new-cdrom.xml b/tests/xmconfigdata/test-fullvirt-new-cdrom.xml index 2bb3d72..33f0b91 100644 --- a/tests/xmconfigdata/test-fullvirt-new-cdrom.xml +++ b/tests/xmconfigdata/test-fullvirt-new-cdrom.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-nohap.xml b/tests/xmconfigdata/test-fullvirt-nohap.xml index 234856c..c9a6129 100644 --- a/tests/xmconfigdata/test-fullvirt-nohap.xml +++ b/tests/xmconfigdata/test-fullvirt-nohap.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml b/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml index be149fd..68baf10 100644 --- a/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml +++ b/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml @@ -48,7 +48,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-dev-2-ports.xml b/tests/xmconfigdata/test-fullvirt-serial-dev-2-ports.xml index 753043d..988f7f2 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-dev-2-ports.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-dev-2-ports.xml @@ -55,7 +55,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-dev-2nd-port.xml b/tests/xmconfigdata/test-fullvirt-serial-dev-2nd-port.xml index a104c6f..d660f42 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-dev-2nd-port.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-dev-2nd-port.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-file.xml b/tests/xmconfigdata/test-fullvirt-serial-file.xml index f27aba9..ef27482 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-file.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-file.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-null.xml b/tests/xmconfigdata/test-fullvirt-serial-null.xml index ea29944..4e53fc3 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-null.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-null.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-pipe.xml b/tests/xmconfigdata/test-fullvirt-serial-pipe.xml index 69bf51c..228e322 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-pipe.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-pipe.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-pty.xml b/tests/xmconfigdata/test-fullvirt-serial-pty.xml index 0c6e477..8ad2233 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-pty.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-pty.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-stdio.xml b/tests/xmconfigdata/test-fullvirt-serial-stdio.xml index 1f12081..632a25f 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-stdio.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-stdio.xml @@ -49,7 +49,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml b/tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml index 47544df..237e02c 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-tcp-telnet.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-tcp.xml b/tests/xmconfigdata/test-fullvirt-serial-tcp.xml index 8f1777a..d9687e5 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-tcp.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-tcp.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-udp.xml b/tests/xmconfigdata/test-fullvirt-serial-udp.xml index c59e2b6..845d5c4 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-udp.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-udp.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-serial-unix.xml b/tests/xmconfigdata/test-fullvirt-serial-unix.xml index e678786..46c9127 100644 --- a/tests/xmconfigdata/test-fullvirt-serial-unix.xml +++ b/tests/xmconfigdata/test-fullvirt-serial-unix.xml @@ -51,7 +51,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-sound.xml b/tests/xmconfigdata/test-fullvirt-sound.xml index 3bd2e76..22ebfb1 100644 --- a/tests/xmconfigdata/test-fullvirt-sound.xml +++ b/tests/xmconfigdata/test-fullvirt-sound.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <sound model='sb16'/> <sound model='es1370'/> diff --git a/tests/xmconfigdata/test-fullvirt-usbmouse.xml b/tests/xmconfigdata/test-fullvirt-usbmouse.xml index f1421b6..56d3add 100644 --- a/tests/xmconfigdata/test-fullvirt-usbmouse.xml +++ b/tests/xmconfigdata/test-fullvirt-usbmouse.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-usbtablet.xml b/tests/xmconfigdata/test-fullvirt-usbtablet.xml index 566c842..5f97025 100644 --- a/tests/xmconfigdata/test-fullvirt-usbtablet.xml +++ b/tests/xmconfigdata/test-fullvirt-usbtablet.xml @@ -44,7 +44,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-fullvirt-utc.xml b/tests/xmconfigdata/test-fullvirt-utc.xml index 2bb3d72..33f0b91 100644 --- a/tests/xmconfigdata/test-fullvirt-utc.xml +++ b/tests/xmconfigdata/test-fullvirt-utc.xml @@ -43,7 +43,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-no-source-cdrom.xml b/tests/xmconfigdata/test-no-source-cdrom.xml index c0b2d43..89d9b15 100644 --- a/tests/xmconfigdata/test-no-source-cdrom.xml +++ b/tests/xmconfigdata/test-no-source-cdrom.xml @@ -48,7 +48,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-paravirt-net-e1000.xml b/tests/xmconfigdata/test-paravirt-net-e1000.xml index 735e8b0..4346f73 100644 --- a/tests/xmconfigdata/test-paravirt-net-e1000.xml +++ b/tests/xmconfigdata/test-paravirt-net-e1000.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-paravirt-net-vifname.xml b/tests/xmconfigdata/test-paravirt-net-vifname.xml index 3ce3639..3f4e5aa 100644 --- a/tests/xmconfigdata/test-paravirt-net-vifname.xml +++ b/tests/xmconfigdata/test-paravirt-net-vifname.xml @@ -31,7 +31,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml index 20c31ec..562a48b 100644 --- a/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml +++ b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='5925' autoport='no' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' port='5925' autoport='no'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-paravirt-new-pvfb.xml b/tests/xmconfigdata/test-paravirt-new-pvfb.xml index 33c48f4..1478e1c 100644 --- a/tests/xmconfigdata/test-paravirt-new-pvfb.xml +++ b/tests/xmconfigdata/test-paravirt-new-pvfb.xml @@ -29,7 +29,7 @@ <input type='mouse' bus='xen'/> <input type='keyboard' bus='xen'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'> - <listen type='address' address='127.0.0.1'/> + <listen type='address' address='127.0.0.1' autoport='yes'/> </graphics> <video> <model type='xen' vram='4096' heads='1' primary='yes'/> diff --git a/tests/xmconfigdata/test-pci-devs.xml b/tests/xmconfigdata/test-pci-devs.xml index 0faae43..5faf16c 100644 --- a/tests/xmconfigdata/test-pci-devs.xml +++ b/tests/xmconfigdata/test-pci-devs.xml @@ -48,7 +48,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'> - <listen type='address'/> + <listen type='address' autoport='yes'/> </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> -- 2.8.2

On 05/12/2016 11:15 AM, Pavel Hrdina wrote:
So far we have only two listen types that supports only address:port method, but in the future we may want to add a new different listen type, for example socket.
This patch moves the ports values out of graphics unions into listen element. The domain XML will now duplicate the ports from first listen element into the graphics element as we do also for address.
This allows us to make part of the graphics code as listen-driven and prepare the code for new listen types.
To support migration back to older versions the new attributes from listen elements are not written into migratable XML.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Since we are breaking from the past, instead I suggest we do: <listen> <port type='XXX' autoport='on|off' value=XXXX/> <port .../> </listen> More future proof WRT future port additions, and gives us a natural place to fix the websocket autoport issue without adding a websocket_autoport=on|off parameter: https://bugzilla.redhat.com/show_bug.cgi?id=1235846 This is a very large patch with several different aspects to it. It should probably be a series unto itself. This is off the cuff, but I suggest structuring the series like - add port bits to listen structure, but no XML parsing/formatting. fill them with the pre-existing port attributes, maybe on demand at GetListen time - convert the code to grab port values from gListen. that way we can verify that the test output doesn't change. this patch should not be changing functionality AFAICT. code that actually updates the port values, like during port allocation, likely needs to continue to use the old values - make gListen values the canonical store, and convert the remaining users If you don't want to separate that series from the later listen=none/socket bits, if the conflict is too high, I imagine you can just do the above patches to make the code 'listen driven'. But then the extra patches would be - parse/format the XML, regenerate the test suite - add new targeted test cases - docs But ideally the port XML rework doesn't block the listen=none/spice bits which are interesting for spice GL Some review on the doc bits below
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fd2dd33..10a9e8d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5090,7 +5090,7 @@ qemu-kvm -net nic,model=? /dev/null <devices> <graphics type='sdl' display=':0.0'/> <graphics type='vnc' port='5904' sharePolicy='allow-exclusive'> - <listen type='address' address='1.2.3.4'/> + <listen type='address' address='1.2.3.4' port='5904'/> </graphics> <graphics type='rdp' autoport='yes' multiUser='yes' /> <graphics type='desktop' fullscreen='yes'/> @@ -5122,16 +5122,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>vnc</code></dt> <dd> <p> - Starts a VNC server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated). The <code>autoport</code> attribute is - the new preferred syntax for indicating auto-allocation of the TCP - port to use. The <code>passwd</code> attribute provides a VNC - password in clear text. The <code>keymap</code> attribute specifies - the keymap to use. It is possible to set a limit on the validity of + Starts a VNC server. To set port or address use <code>listen</code>
*'use the' or 'use a'
+ element. The <code>passwd</code> attribute provides a VNC password + in clear text. The <code>keymap</code> attribute specifies the + keymap to use. It is possible to set a limit on the validity of the password by giving an timestamp - <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be - in UTC. The <code>connected</code> attribute allows control of + <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be in + UTC. The <code>connected</code> attribute allows control of connected client during password changes. VNC accepts <code>keep</code> value only <span class="since">since 0.9.3</span>. NB, this may not be supported by all hypervisors. @@ -5148,26 +5145,16 @@ qemu-kvm -net nic,model=? /dev/null unconditionally <span class="since">since 1.0.6</span>. </p> <p> - Rather than using listen/port, QEMU supports a <code>socket</code> + Rather than using listen element, QEMU supports a <code>socket</code>
*'using the' or 'using a'
attribute for listening on a unix domain socket path <span class="since">Since 0.8.8</span>. </p> - <p> - For VNC WebSocket functionality, <code>websocket</code> attribute - may be used to specify port to listen on (with -1 meaning - auto-allocation and <code>autoport</code> having no effect due to - security reasons) <span class="since">Since 1.0.6</span>.
The 'Since 1.0.6' is lost for websocket.
- </p> </dd> <dt><code>spice</code> <span class="since">Since 0.8.6</span></dt> <dd> <p> - Starts a SPICE server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated), while <code>tlsPort</code> gives - an alternative secure port number. The <code>autoport</code> - attribute is the new preferred syntax for indicating - auto-allocation of needed port numbers. The <code>passwd</code> + Starts a SPICE server. To set port or address use + <code>listen</code> element. The <code>passwd</code> attribute provides a SPICE password in clear text. The <code>keymap</code> attribute specifies the keymap to use. It is possible to set a limit on the validity of the password by giving @@ -5209,6 +5196,7 @@ qemu-kvm -net nic,model=? /dev/null </p> <pre> <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> + <listen type='address' autoport='yes'/> <channel name='main' mode='secure'/> <channel name='record' mode='insecure'/> <image compression='auto_glz'/> @@ -5266,16 +5254,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>rdp</code></dt> <dd> <p> - Starts a RDP server. The <code>port</code> attribute specifies the - TCP port number (with -1 as legacy syntax indicating that it should - be auto-allocated). The <code>autoport</code> attribute is the new - preferred syntax for indicating auto-allocation of the TCP port to - use. The <code>replaceUser</code> attribute is a boolean deciding - whether multiple simultaneous connections to the VM are permitted. - The <code>multiUser</code> attribute is a boolean deciding whether - the existing connection must be dropped and a new connection must - be established by the VRDP server, when a new client connects in - single connection mode. + Starts a RDP server. To set port or address use <code>listen</code> + element. The <code>replaceUser</code> attribute is + a boolean deciding whether multiple simultaneous connections to + the VM are permitted. The <code>multiUser</code> attribute is + a boolean deciding whether the existing connection must be dropped + and a new connection must be established by the VRDP server, when + a new client connects in single connection mode. </p> </dd> <dt><code>desktop</code></dt> @@ -5318,6 +5303,40 @@ qemu-kvm -net nic,model=? /dev/null attribute in <code>graphics</code> element for backward compatibility. If both are provided they must be equal. </p> + <p> + With address it's also possible to specify ports to listen on and
<code>address</code>
+ whether those ports should be auto-generated or not + <span class="since">Since 1.3.5</span>. Depending on graphics type
Since capitalization is weird here. I think move the Since block to the start of the line.
+ those attributes are available: + </p> + <ul> + <li> + <code>port</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>), + </li> + <li> + <code>tlsPort</code> secure TCP port number (<code>spice</code>), + </li> + <li> + <code>websocket</code> TCP port number (<code>vnc</code>), + </li> + <li> + <code>autoport</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>). + </li> + </ul>
I think consolidating the ports configuration is a good idea, maybe even give it its own subsection. This should probably be a <dd> list though which is more common. But I think the list items should describe when the original attribute was added, and a bit about what the attribute does. Then add the bit about 'since 1.3.5 specify these in the <listen> element...' should come afterwards. That way there's a natural place to preserve the websocket 'Since' bit, the Websocket warning, etc.
+ <p> + If <code>autoport='yes'</code> the <code>port</code> and + <code>tlsPort</code> are auto-generated. It's also possible to use + <code>-1</code> as legacy syntax to tell that the port should be + auto-generated. The <code>websocket</code> has an exception for + security reasons that it can be only auto-generated using the legacy
s/be only/only be/g
+ syntax <code>websocket='-1'</code>. + </p> + <p> + This ports configuration is duplicated into <code>graphics</code> + element for backwards compatibility. + </p> </dd> <dt><code>network</code></dt> <dd> @@ -5335,6 +5354,10 @@ qemu-kvm -net nic,model=? /dev/null describing one of the 'direct' (macvtap) modes, the first IPv4 address of the first forward dev will be used. </p> + <p> + Specifying ports uses the same rules and syntax as listen type + <code>address</code>. + </p> </dd> </dl>
Granted the docs will likely be different if the <port> format is used - Cole

On Mon, May 16, 2016 at 01:57:13PM -0400, Cole Robinson wrote:
On 05/12/2016 11:15 AM, Pavel Hrdina wrote:
So far we have only two listen types that supports only address:port method, but in the future we may want to add a new different listen type, for example socket.
This patch moves the ports values out of graphics unions into listen element. The domain XML will now duplicate the ports from first listen element into the graphics element as we do also for address.
This allows us to make part of the graphics code as listen-driven and prepare the code for new listen types.
To support migration back to older versions the new attributes from listen elements are not written into migratable XML.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Since we are breaking from the past, instead I suggest we do:
<listen> <port type='XXX' autoport='on|off' value=XXXX/> <port .../> </listen>
More future proof WRT future port additions, and gives us a natural place to fix the websocket autoport issue without adding a websocket_autoport=on|off parameter:
Ok, this probably makes sense and it also allow us to drop the legacy '-1' syntax for autoport. I guess that we can go this way.
This is a very large patch with several different aspects to it. It should probably be a series unto itself. This is off the cuff, but I suggest structuring the series like
Yes it's very large patch and my intention was to keep those changes together, but I agree that splitting it into multiple patches would be easier for review. I was thinking about this and decided to go with one large patch.
- add port bits to listen structure, but no XML parsing/formatting. fill them with the pre-existing port attributes, maybe on demand at GetListen time - convert the code to grab port values from gListen. that way we can verify that the test output doesn't change. this patch should not be changing functionality AFAICT. code that actually updates the port values, like during port allocation, likely needs to continue to use the old values - make gListen values the canonical store, and convert the remaining users
If you don't want to separate that series from the later listen=none/socket bits, if the conflict is too high, I imagine you can just do the above patches to make the code 'listen driven'. But then the extra patches would be
I'll see what I can do about this and how hard it would be.
- parse/format the XML, regenerate the test suite - add new targeted test cases - docs
But ideally the port XML rework doesn't block the listen=none/spice bits which are interesting for spice GL
Some review on the doc bits below
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fd2dd33..10a9e8d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5090,7 +5090,7 @@ qemu-kvm -net nic,model=? /dev/null <devices> <graphics type='sdl' display=':0.0'/> <graphics type='vnc' port='5904' sharePolicy='allow-exclusive'> - <listen type='address' address='1.2.3.4'/> + <listen type='address' address='1.2.3.4' port='5904'/> </graphics> <graphics type='rdp' autoport='yes' multiUser='yes' /> <graphics type='desktop' fullscreen='yes'/> @@ -5122,16 +5122,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>vnc</code></dt> <dd> <p> - Starts a VNC server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated). The <code>autoport</code> attribute is - the new preferred syntax for indicating auto-allocation of the TCP - port to use. The <code>passwd</code> attribute provides a VNC - password in clear text. The <code>keymap</code> attribute specifies - the keymap to use. It is possible to set a limit on the validity of + Starts a VNC server. To set port or address use <code>listen</code>
*'use the' or 'use a'
+ element. The <code>passwd</code> attribute provides a VNC password + in clear text. The <code>keymap</code> attribute specifies the + keymap to use. It is possible to set a limit on the validity of the password by giving an timestamp - <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be - in UTC. The <code>connected</code> attribute allows control of + <code>passwdValidTo='2010-04-09T15:51:00'</code> assumed to be in + UTC. The <code>connected</code> attribute allows control of connected client during password changes. VNC accepts <code>keep</code> value only <span class="since">since 0.9.3</span>. NB, this may not be supported by all hypervisors. @@ -5148,26 +5145,16 @@ qemu-kvm -net nic,model=? /dev/null unconditionally <span class="since">since 1.0.6</span>. </p> <p> - Rather than using listen/port, QEMU supports a <code>socket</code> + Rather than using listen element, QEMU supports a <code>socket</code>
*'using the' or 'using a'
attribute for listening on a unix domain socket path <span class="since">Since 0.8.8</span>. </p> - <p> - For VNC WebSocket functionality, <code>websocket</code> attribute - may be used to specify port to listen on (with -1 meaning - auto-allocation and <code>autoport</code> having no effect due to - security reasons) <span class="since">Since 1.0.6</span>.
The 'Since 1.0.6' is lost for websocket.
- </p> </dd> <dt><code>spice</code> <span class="since">Since 0.8.6</span></dt> <dd> <p> - Starts a SPICE server. The <code>port</code> attribute specifies - the TCP port number (with -1 as legacy syntax indicating that it - should be auto-allocated), while <code>tlsPort</code> gives - an alternative secure port number. The <code>autoport</code> - attribute is the new preferred syntax for indicating - auto-allocation of needed port numbers. The <code>passwd</code> + Starts a SPICE server. To set port or address use + <code>listen</code> element. The <code>passwd</code> attribute provides a SPICE password in clear text. The <code>keymap</code> attribute specifies the keymap to use. It is possible to set a limit on the validity of the password by giving @@ -5209,6 +5196,7 @@ qemu-kvm -net nic,model=? /dev/null </p> <pre> <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> + <listen type='address' autoport='yes'/> <channel name='main' mode='secure'/> <channel name='record' mode='insecure'/> <image compression='auto_glz'/> @@ -5266,16 +5254,13 @@ qemu-kvm -net nic,model=? /dev/null <dt><code>rdp</code></dt> <dd> <p> - Starts a RDP server. The <code>port</code> attribute specifies the - TCP port number (with -1 as legacy syntax indicating that it should - be auto-allocated). The <code>autoport</code> attribute is the new - preferred syntax for indicating auto-allocation of the TCP port to - use. The <code>replaceUser</code> attribute is a boolean deciding - whether multiple simultaneous connections to the VM are permitted. - The <code>multiUser</code> attribute is a boolean deciding whether - the existing connection must be dropped and a new connection must - be established by the VRDP server, when a new client connects in - single connection mode. + Starts a RDP server. To set port or address use <code>listen</code> + element. The <code>replaceUser</code> attribute is + a boolean deciding whether multiple simultaneous connections to + the VM are permitted. The <code>multiUser</code> attribute is + a boolean deciding whether the existing connection must be dropped + and a new connection must be established by the VRDP server, when + a new client connects in single connection mode. </p> </dd> <dt><code>desktop</code></dt> @@ -5318,6 +5303,40 @@ qemu-kvm -net nic,model=? /dev/null attribute in <code>graphics</code> element for backward compatibility. If both are provided they must be equal. </p> + <p> + With address it's also possible to specify ports to listen on and
<code>address</code>
+ whether those ports should be auto-generated or not + <span class="since">Since 1.3.5</span>. Depending on graphics type
Since capitalization is weird here. I think move the Since block to the start of the line.
+ those attributes are available: + </p> + <ul> + <li> + <code>port</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>), + </li> + <li> + <code>tlsPort</code> secure TCP port number (<code>spice</code>), + </li> + <li> + <code>websocket</code> TCP port number (<code>vnc</code>), + </li> + <li> + <code>autoport</code> TCP port number (<code>vnc</code>, + <code>spice</code>, <code>rdp</code>). + </li> + </ul>
I think consolidating the ports configuration is a good idea, maybe even give it its own subsection. This should probably be a <dd> list though which is more common.
But I think the list items should describe when the original attribute was added, and a bit about what the attribute does. Then add the bit about 'since 1.3.5 specify these in the <listen> element...' should come afterwards. That way there's a natural place to preserve the websocket 'Since' bit, the Websocket warning, etc.
+ <p> + If <code>autoport='yes'</code> the <code>port</code> and + <code>tlsPort</code> are auto-generated. It's also possible to use + <code>-1</code> as legacy syntax to tell that the port should be + auto-generated. The <code>websocket</code> has an exception for + security reasons that it can be only auto-generated using the legacy
s/be only/only be/g
+ syntax <code>websocket='-1'</code>. + </p> + <p> + This ports configuration is duplicated into <code>graphics</code> + element for backwards compatibility. + </p> </dd> <dt><code>network</code></dt> <dd> @@ -5335,6 +5354,10 @@ qemu-kvm -net nic,model=? /dev/null describing one of the 'direct' (macvtap) modes, the first IPv4 address of the first forward dev will be used. </p> + <p> + Specifying ports uses the same rules and syntax as listen type + <code>address</code>. + </p> </dd> </dl>
Granted the docs will likely be different if the <port> format is used
So I'll prepare another version and we'll see. Thanks, Pavel

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> --- docs/formatdomain.html.in | 16 +++ docs/schemas/domaincommon.rng | 10 ++ src/conf/domain_conf.c | 149 ++++++++++++++++++--- src/conf/domain_conf.h | 8 +- src/libvirt_private.syms | 1 + src/qemu/qemu.conf | 6 +- 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 ++- ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 +++++ ...hics-vnc-socket-attr-listen-socket-mismatch.xml | 30 +++++ ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 +++++ ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 +++++ ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 +++++ .../generic-graphics-vnc-socket-listen.xml | 4 +- .../generic-graphics-vnc-socket.xml | 4 +- tests/genericxml2xmltest.c | 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 + 30 files changed, 552 insertions(+), 83 deletions(-) create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml 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 10a9e8d..682e30d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null <code>address</code>. </p> </dd> + <dt><code>socket</code> <span class="since">since 1.3.5</span></dt> + <dd> + <p> + This listen type tells a graphics server to listen on unix socket. + Attribute <code>socket</code> contains a path to unix socket. If this + attribute is omitted libvirt will generate this path for you. + Supported by graphics type <code>vnc</code>. + </p> + <p> + For <code>vnc</code> graphics be backward compatible + the <code>socket</code> attribute of first <code>listen</code> element + is duplicated as <code>socket</code> attribute in <code>graphics</code> + element. If <code>graphics</code> element contains a <code>socket</code> + attribute all <code>listen</code> elements are ignored. + </p> + </dd> </dl> <h4><a name="elementsVideo">Video devices</a></h4> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e916cc1..03591fe 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3011,6 +3011,16 @@ </attribute> </optional> </group> + <group> + <attribute name="type"> + <value>socket</value> + </attribute> + <optional> + <attribute name="socket"> + <ref name="absFilePath"/> + </attribute> + </optional> + </group> </choice> </element> </zeroOrMore> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c546997..e8b51ea 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; @@ -10803,12 +10804,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, char *type = virXMLPropString(node, "type"); char *address = virXMLPropString(node, "address"); char *network = virXMLPropString(node, "network"); + char *socket = virXMLPropString(node, "socket"); char *fromConfig = virXMLPropString(node, "fromConfig"); char *addressCompat = NULL; + char *socketCompat = NULL; + const char *graphicsType = virDomainGraphicsTypeToString(graphics->type); int tmp, typeVal; - if (parent) + if (parent) { addressCompat = virXMLPropString(parent, "listen"); + socketCompat = virXMLPropString(parent, "socket"); + } if (!type) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -10823,6 +10829,14 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } def->type = typeVal; + if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("listen type 'socket' is not available for " + "graphics type '%s'"), graphicsType); + goto error; + } + if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { if (address && addressCompat && STRNEQ(address, addressCompat)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -10838,6 +10852,21 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } } + if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { + if (socket && socketCompat && STRNEQ(socket, socketCompat)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("graphics 'socket' attribute '%s' must match " + "'socket' attribute of first listen element " + "(found '%s')"), socketCompat, socket); + goto error; + } + + if (!socket) { + socket = socketCompat; + socketCompat = NULL; + } + } + if (address && address[0] && (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK && @@ -10857,6 +10886,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, network = NULL; } + if (socket && socket[0]) { + if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'socket' attribute is valid only for listen " + "type 'socket'")); + goto error; + } + def->socket = socket; + socket = NULL; + } + if (fromConfig && flags & VIR_DOMAIN_DEF_PARSE_STATUS) { if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) { @@ -10879,8 +10919,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, VIR_FREE(type); VIR_FREE(address); VIR_FREE(network); + VIR_FREE(socket); VIR_FREE(fromConfig); VIR_FREE(addressCompat); + VIR_FREE(socketCompat); return ret; } @@ -10900,12 +10942,6 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, ctxt->node = node; - if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && - (socketPath = virXMLPropString(node, "socket"))) { - ret = 0; - goto error; - } - /* parse the <listen> subelements for graphics types that support it */ nListens = virXPathNodeSet("./listen", ctxt, &listenNodes); if (nListens < 0) @@ -10928,9 +10964,19 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, def->nListens++; } VIR_FREE(listenNodes); + } + + /* If no <listen/> element was found in XML for backward compatibility + * we should try to parse 'listen' or 'socket' attribute from <graphics/> + * element. */ + if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) + socketPath = virXMLPropString(node, "socket"); + + if (socketPath) { + newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; + newListen.socket = socketPath; + socketPath = NULL; } else { - /* If no <listen/> element was found in XML for backward compatibility - * we should try to parse 'listen' attribute from <graphics/> element. */ newListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; newListen.address = virXMLPropString(node, "listen"); if (STREQ_NULLABLE(newListen.address, "")) @@ -10939,9 +10985,26 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, if (virDomainGraphicsListenDefParsePorts(&newListen, node, def, NULL, flags) < 0) goto error; + } + /* If no <listen/> element was found add a new one created by parsing + * <graphics/> element. */ + if (def->nListens == 0) { if (VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) goto error; + } else { + virDomainGraphicsListenDefPtr glisten = &def->listens[0]; + + /* If the first <listen/> element is 'address' or 'network' and we found + * 'socket' attribute inside <graphics/> element for backward + * compatibility we need to replace the first listen by + * <listen type='socket' .../> element based on the 'socket' attribite. */ + if ((glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || + glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) && + newListen.type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { + virDomainGraphicsListenDefClear(glisten); + *glisten = newListen; + } } ret = 0; @@ -10981,7 +11044,6 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def, } } - def->data.vnc.socket = virXMLPropString(node, "socket"); def->data.vnc.keymap = virXMLPropString(node, "keymap"); if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth, @@ -21451,6 +21513,13 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf, } } + if (def->socket && + def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && + !(def->autogenerated && + (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) { + virBufferEscapeString(buf, " socket='%s'", def->socket); + } + if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS) virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig); @@ -21480,11 +21549,17 @@ virDomainGraphicsDefFormat(virBufferPtr buf, switch (def->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: - if (def->data.vnc.socket) { - if (!def->data.vnc.socketAutogenerated || - !(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) { - virBufferEscapeString(buf, " socket='%s'", - def->data.vnc.socket); + if (!glisten) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element for graphics")); + return -1; + } + + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { + if (glisten->socket && + !((glisten->autogenerated || glisten->fromConfig) && + (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) { + virBufferEscapeString(buf, " socket='%s'", glisten->socket); } } else if (glisten) { if (glisten->port && @@ -21592,9 +21667,19 @@ virDomainGraphicsDefFormat(virBufferPtr buf, for (i = 0; i < def->nListens; i++) { if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE) continue; - if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE && - def->listens[i].fromConfig) - continue; + if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { + if (def->listens[i].fromConfig) + continue; + + /* If the socket is provided by user in the XML we need to skip this + * listen type to support migration back to old libvirt since old + * libvirt supports specifying socket path inside graphics element + * as 'socket' attribute. */ + if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && + def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && + !def->listens[i].autogenerated) + continue; + } if (!children) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); @@ -23917,6 +24002,30 @@ virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def, } +int +virDomainGraphicsListenAppendSocket(virDomainGraphicsDefPtr def, + const char *socket) +{ + virDomainGraphicsListenDef listen; + + memset(&listen, 0, sizeof(listen)); + + listen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; + + if (VIR_STRDUP(listen.socket, socket) < 0) + goto error; + + if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, listen) < 0) + goto error; + + return 0; + + error: + VIR_FREE(listen.socket); + return -1; +} + + /** * virDomainNetFind: * @def: domain's def diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3247177..0eba888 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1539,6 +1539,7 @@ typedef enum { VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE = 0, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK, + VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET, VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST } virDomainGraphicsListenType; @@ -1555,6 +1556,7 @@ struct _virDomainGraphicsListenDef { virDomainGraphicsListenType type; char *address; char *network; + char *socket; bool fromConfig; /* true if the @address is config file originated */ int port; int tlsPort; @@ -1562,6 +1564,7 @@ struct _virDomainGraphicsListenDef { bool autoport; bool portReserved; bool tlsPortReserved; + bool autogenerated; }; struct _virDomainGraphicsDef { @@ -1574,8 +1577,6 @@ struct _virDomainGraphicsDef { union { struct { char *keymap; - char *socket; - bool socketAutogenerated; virDomainGraphicsAuthDef auth; int sharePolicy; } vnc; @@ -2840,6 +2841,9 @@ int virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def, const int websocket, const bool autoport) ATTRIBUTE_NONNULL(1); +int virDomainGraphicsListenAppendSocket(virDomainGraphicsDefPtr def, + const char *socket) + ATTRIBUTE_NONNULL(1); int virDomainNetGetActualType(virDomainNetDefPtr iface); const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a980a32..4b8b2de 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -305,6 +305,7 @@ virDomainGraphicsAuthConnectedTypeToString; virDomainGraphicsDefFree; virDomainGraphicsGetListen; virDomainGraphicsListenAppendAddress; +virDomainGraphicsListenAppendSocket; virDomainGraphicsSpiceChannelModeTypeFromString; virDomainGraphicsSpiceChannelModeTypeToString; virDomainGraphicsSpiceChannelNameTypeFromString; diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 4fa5e8a..59c839e 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -15,9 +15,9 @@ # unix socket. This prevents unprivileged access from users on the # host machine, though most VNC clients do not support it. # -# This will only be enabled for VNC configurations that do not have -# a hardcoded 'listen' or 'socket' value. This setting takes preference -# over vnc_listen. +# This will only be enabled for VNC configurations that have listen +# type=address but without any address specified. This setting takes +# preference over vnc_listen. # #vnc_auto_unix_socket = 1 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6b7ce0f..bca94fa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7373,8 +7373,7 @@ static int qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, virQEMUCapsPtr qemuCaps, - virDomainGraphicsDefPtr graphics, - const char *domainLibDir) + virDomainGraphicsDefPtr graphics) { virBuffer opt = VIR_BUFFER_INITIALIZER; virDomainGraphicsListenDefPtr glisten = NULL; @@ -7389,24 +7388,19 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, goto error; } - if (graphics->data.vnc.socket || cfg->vncAutoUnixSocket) { - if (!graphics->data.vnc.socket) { - if (virAsprintf(&graphics->data.vnc.socket, - "%s/vnc.sock", domainLibDir) < 0) - goto error; - - graphics->data.vnc.socketAutogenerated = true; - } - - virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket); + if (!(glisten = virDomainGraphicsGetListen(graphics, 0))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + goto error; + } - } else { - if (!(glisten = virDomainGraphicsGetListen(graphics, 0))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing listen element")); - goto error; - } + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + virBufferAsprintf(&opt, "unix:%s", glisten->socket); + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: if (!glisten->autoport && (glisten->port < 5900 || glisten->port > 65535)) { @@ -7442,6 +7436,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } @@ -7467,6 +7462,11 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, } virBufferAsprintf(&opt, ",websocket=%d", glisten->websocket); } + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (graphics->data.vnc.sharePolicy) { @@ -7603,6 +7603,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } @@ -7781,8 +7782,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, virCommandPtr cmd, virDomainDefPtr def, virQEMUCapsPtr qemuCaps, - virDomainGraphicsDefPtr graphics, - const char *domainLibDir) + virDomainGraphicsDefPtr graphics) { switch (graphics->type) { case VIR_DOMAIN_GRAPHICS_TYPE_SDL: @@ -7814,8 +7814,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_TYPE_VNC: - return qemuBuildGraphicsVNCCommandLine(cfg, cmd, qemuCaps, - graphics, domainLibDir); + return qemuBuildGraphicsVNCCommandLine(cfg, cmd, qemuCaps, graphics); case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: return qemuBuildGraphicsSPICECommandLine(cfg, cmd, qemuCaps, graphics); @@ -9543,7 +9542,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, for (i = 0; i < def->ngraphics; ++i) { if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps, - def->graphics[i], domainLibDir) < 0) + def->graphics[i]) < 0) goto error; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 39a50e6..4b083f8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1993,17 +1993,22 @@ qemuDomainRecheckInternalPaths(virDomainDefPtr def, unsigned int flags) { size_t i = 0; + size_t j = 0; for (i = 0; i < def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = def->graphics[i]; - if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && - graphics->data.vnc.socket && - STRPREFIX(graphics->data.vnc.socket, cfg->libDir)) { - if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) - VIR_FREE(graphics->data.vnc.socket); - else - graphics->data.vnc.socketAutogenerated = true; + for (j = 0; j < graphics->nListens; ++j) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; + + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && + glisten->socket && + STRPREFIX(glisten->socket, cfg->libDir)) { + if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) + VIR_FREE(glisten->socket); + else + glisten->autogenerated = true; + } } } } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 06033df..53cf8e1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2675,6 +2675,15 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, } break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + if (STRNEQ_NULLABLE(newlisten->socket, oldlisten->socket)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot change listen socket setting " + "on '%s' graphics"), type); + goto cleanup; + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: /* nada */ diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index d73e834..2a80263 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -509,7 +509,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def, if (STRPREFIX(val, "unix:")) { /* -vnc unix:/some/big/path */ - if (VIR_STRDUP(vnc->data.vnc.socket, val + 5) < 0) + if (virDomainGraphicsListenAppendSocket(vnc, val + 5) < 0) goto cleanup; } else { /* diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9f96545..3d78455 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3864,9 +3864,6 @@ qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver, unsigned short port; size_t i; - if (graphics->data.vnc.socket) - return 0; - for (i = 0; i < graphics->nListens; i++) { virDomainGraphicsListenDefPtr glisten = &graphics->listens[i]; @@ -3892,6 +3889,7 @@ qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } @@ -3990,6 +3988,7 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } @@ -4424,6 +4423,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, unsigned int flags) { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); + qemuDomainObjPrivatePtr priv = vm->privateData; bool allocate = !(flags & VIR_QEMU_PROCESS_START_PRETEND); size_t i, j; int ret = -1; @@ -4433,6 +4433,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = vm->def->graphics[i]; + const char *type = virDomainGraphicsTypeToString(graphics->type); char *listenAddr = NULL; switch (graphics->type) { @@ -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)); + if (virAsprintf(&glisten->socket, "%s/%s.sock", + priv->libDir, type) < 0) + goto cleanup; + glisten->fromConfig = true; + glisten->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; + } else if (listenAddr) { + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + goto cleanup; + glisten->fromConfig = true; + } + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + if (!glisten->socket) { + if (virAsprintf(&glisten->socket, "%s/%s.sock", + priv->libDir, type) < 0) + goto cleanup; + glisten->autogenerated = true; + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } } } @@ -6232,6 +6260,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 7eeb4ef..b144250 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1060,10 +1060,17 @@ get_files(vahControl * ctl) goto cleanup; for (i = 0; i < ctl->def->ngraphics; i++) { - if (ctl->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && - ctl->def->graphics[i]->data.vnc.socket && - vah_add_file(&buf, ctl->def->graphics[i]->data.vnc.socket, "w")) - goto cleanup; + virDomainGraphicsDefPtr graphics = ctl->def->graphics[i]; + size_t n; + + for (n = 0; n < graphics->nListens; n++) { + virDomainGraphicsListenDef listenObj = graphics->listens[n]; + + if (listenObj.type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && + listenObj.socket && + vah_add_file(&buf, listenObj.socket, "rw")) + goto cleanup; + } } if (ctl->def->ngraphics == 1 && diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml new file mode 100644 index 0000000..a32c20b --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='address' address='0.0.0.0'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml new file mode 100644 index 0000000..980b64c --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='socket' socket='/tmp/mismatch.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml new file mode 100644 index 0000000..ea3efca --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='socket' socket='/tmp/vnc.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml new file mode 100644 index 0000000..f205e13 --- /dev/null +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='socket' socket='/tmp/vnc.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml new file mode 100644 index 0000000..f205e13 --- /dev/null +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='socket' socket='/tmp/vnc.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml index d8742c6..cb4e5ac 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket-listen.xml @@ -19,7 +19,9 @@ <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'/> + <graphics type='vnc' socket='/tmp/QEMUGuest1-vnc.sock'> + <listen type='socket' socket='/tmp/QEMUGuest1-vnc.sock'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket.xml b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket.xml index d8742c6..cb4e5ac 100644 --- a/tests/genericxml2xmloutdata/generic-graphics-vnc-socket.xml +++ b/tests/genericxml2xmloutdata/generic-graphics-vnc-socket.xml @@ -19,7 +19,9 @@ <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'/> + <graphics type='vnc' socket='/tmp/QEMUGuest1-vnc.sock'> + <listen type='socket' socket='/tmp/QEMUGuest1-vnc.sock'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 76c18e5..9d57f27 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -90,6 +90,10 @@ mymain(void) DO_TEST_DIFFERENT("graphics-vnc-listen-element-minimal"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address"); DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address-port"); + DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-address"); + DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-socket"); + DO_TEST_FULL("graphics-vnc-socket-attr-listen-socket-mismatch", 0, false, + TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); DO_TEST_FULL("name-slash-parse", 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml index 93daa76..8f2478a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml @@ -25,7 +25,9 @@ <controller type='ide' index='0'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' socket='/tmp/foo.socket'/> + <graphics type='vnc' socket='/tmp/foo.socket'> + <listen type='socket' socket='/tmp/foo.socket'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args new file mode 100644 index 0000000..84ce727 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml new file mode 100644 index 0000000..3e455df --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.args index 2464867..abf724c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.args @@ -16,7 +16,5 @@ QEMU_AUDIO_DRV=none \ -no-acpi \ -boot c \ -usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --vnc unix:/tmp/foo.socket \ +-vnc unix:/tmp/vnc.sock \ -vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml index de70bc4..522c3af 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml @@ -14,18 +14,14 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> <controller type='usb' index='0'/> <controller type='ide' index='0'/> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc' socket='/tmp/foo.socket'/> + <graphics type='vnc'> + <listen type='socket' socket='/tmp/vnc.sock'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1'/> </video> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d1cfbec..43deebd 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -876,6 +876,8 @@ mymain(void) DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET); DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY); DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC); + DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); + DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC); driver.config->vncSASL = 1; VIR_FREE(driver.config->vncSASLdir); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml new file mode 100644 index 0000000..e14bbd1 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml index 7450566..5013b18 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml @@ -29,7 +29,9 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='vnc'/> + <graphics type='vnc'> + <listen type='socket'/> + </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml new file mode 100644 index 0000000..9a83328 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/vnc.sock'> + <listen type='socket' socket='/tmp/vnc.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a43fa9..b67d687 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -434,6 +434,8 @@ mymain(void) DO_TEST("graphics-vnc-sasl"); DO_TEST("graphics-vnc-tls"); DO_TEST("graphics-vnc-no-listen-attr"); + DO_TEST("graphics-vnc-socket"); + DO_TEST("graphics-vnc-auto-socket"); DO_TEST("graphics-sdl"); DO_TEST("graphics-sdl-fullscreen"); DO_TEST("graphics-spice"); -- 2.8.2

Add a new capability to detect support of unix sockets for spice graphics. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1bddf43..4efb8c2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -328,6 +328,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "device-tray-moved-event", "nec-usb-xhci-ports", "virtio-scsi-pci.iothread", + "spice-unix", ); @@ -2666,6 +2667,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { { "spice", "gl", QEMU_CAPS_SPICE_GL }, { "chardev", "logfile", QEMU_CAPS_CHARDEV_LOGFILE }, { "name", "debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS }, + { "spice", "unix", QEMU_CAPS_SPICE_UNIX }, }; static int diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e7d0a60..3ae4a46 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -359,6 +359,7 @@ typedef enum { QEMU_CAPS_DEVICE_TRAY_MOVED, /* DEVICE_TRAY_MOVED event */ QEMU_CAPS_NEC_USB_XHCI_PORTS, /* -device nec-usb-xhci.p3 ports setting */ QEMU_CAPS_VIRTIO_SCSI_IOTHREAD, /* virtio-scsi-{pci,ccw}.iothread */ + QEMU_CAPS_SPICE_UNIX, /* -spice unix */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; -- 2.8.2

This prepares the code for other listen types. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 57 ++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bca94fa..c6c1918 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7536,8 +7536,9 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, const char *listenAddr = NULL; char *netAddr = NULL; int ret; - int defaultMode = graphics->data.spice.defaultMode; size_t i; + bool hasSecure = false; + bool hasInsecure = false; if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -7551,8 +7552,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, goto error; } - if (glisten->port > 0) + if (glisten->port > 0) { virBufferAsprintf(&opt, "port=%u,", glisten->port); + hasInsecure = true; + } if (glisten->tlsPort > 0) { if (!cfg->spiceTLS) { @@ -7562,6 +7565,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, goto error; } virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort); + hasSecure = true; } if (cfg->spiceSASL) { @@ -7636,17 +7640,30 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, !cfg->spicePassword) virBufferAddLit(&opt, "disable-ticketing,"); - if (glisten->tlsPort > 0) + if (hasSecure) virBufferAsprintf(&opt, "x509-dir=%s,", cfg->spiceTLSx509certdir); - switch (defaultMode) { + switch (graphics->data.spice.defaultMode) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: + if (!hasSecure) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spice defaultMode secure requested in XML " + "configuration, but TLS is not available")); + goto error; + } virBufferAddLit(&opt, "tls-channel=default,"); break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: + if (!hasInsecure) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spice defaultMode insecure requested in XML " + "configuration, but plaintext is not available")); + goto error; + } virBufferAddLit(&opt, "plaintext-channel=default,"); break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: + case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST: /* nothing */ break; } @@ -7654,10 +7671,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, for (i = 0; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST; i++) { switch (graphics->data.spice.channels[i]) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - if (glisten->tlsPort <= 0) { + if (!hasSecure) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spice secure channels set in XML configuration, " - "but TLS port is not provided")); + _("spice secure channels set in XML " + "configuration, but TLS is not available")); goto error; } virBufferAsprintf(&opt, "tls-channel=%s,", @@ -7665,10 +7682,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - if (glisten->port <= 0) { + if (!hasInsecure) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("spice insecure channels set in XML " - "configuration, but plain port is not provided")); + "configuration, but plaintext is not available")); goto error; } virBufferAsprintf(&opt, "plaintext-channel=%s,", @@ -7676,29 +7693,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - switch (defaultMode) { - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - if (glisten->tlsPort <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spice defaultMode secure requested in XML " - "configuration but TLS port not provided")); - goto error; - } - break; - - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - if (glisten->port <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spice defaultMode insecure requested in XML " - "configuration but plain port not provided")); - goto error; - } - break; - - case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY: - /* don't care */ break; - } } } -- 2.8.2

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 2 +- src/conf/domain_conf.c | 33 ++++-- src/qemu/qemu_command.c | 120 ++++++++++++--------- src/qemu/qemu_migration.c | 50 ++++++--- .../qemuxml2argv-graphics-spice-auto-socket.args | 20 ++++ .../qemuxml2argv-graphics-spice-auto-socket.xml | 30 ++++++ .../qemuxml2argv-graphics-spice-socket.args | 20 ++++ .../qemuxml2argv-graphics-spice-socket.xml | 30 ++++++ tests/qemuxml2argvtest.c | 6 ++ .../qemuxml2xmlout-graphics-spice-auto-socket.xml | 35 ++++++ .../qemuxml2xmlout-graphics-spice-socket.xml | 35 ++++++ tests/qemuxml2xmltest.c | 2 + 12 files changed, 305 insertions(+), 78 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 682e30d..a0d2e4b 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5365,7 +5365,7 @@ qemu-kvm -net nic,model=? /dev/null This listen type tells a graphics server to listen on unix socket. Attribute <code>socket</code> contains a path to unix socket. If this attribute is omitted libvirt will generate this path for you. - Supported by graphics type <code>vnc</code>. + Supported by graphics type <code>vnc</code> and <code>spice</code>. </p> <p> For <code>vnc</code> graphics be backward compatible diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e8b51ea..7691814 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10830,7 +10830,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, def->type = typeVal; if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && - graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("listen type 'socket' is not available for " "graphics type '%s'"), graphicsType); @@ -21635,19 +21636,29 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: - if (glisten->port) - virBufferAsprintf(buf, " port='%d'", - glisten->port); + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (glisten->port) + virBufferAsprintf(buf, " port='%d'", + glisten->port); - if (glisten->tlsPort) - virBufferAsprintf(buf, " tlsPort='%d'", - glisten->tlsPort); + if (glisten->tlsPort) + virBufferAsprintf(buf, " tlsPort='%d'", + glisten->tlsPort); - virBufferAsprintf(buf, " autoport='%s'", - glisten->autoport ? "yes" : "no"); + virBufferAsprintf(buf, " autoport='%s'", + glisten->autoport ? "yes" : "no"); - if (glisten->address && !glisten->fromConfig) - virBufferAsprintf(buf, " listen='%s'", glisten->address); + if (glisten->address && !glisten->fromConfig) + virBufferAsprintf(buf, " listen='%s'", glisten->address); + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } if (def->data.spice.keymap) virBufferEscapeString(buf, " keymap='%s'", diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c6c1918..89e8b0e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7552,72 +7552,94 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, goto error; } - if (glisten->port > 0) { - virBufferAsprintf(&opt, "port=%u,", glisten->port); - hasInsecure = true; - } - - if (glisten->tlsPort > 0) { - if (!cfg->spiceTLS) { + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_UNIX)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spice TLS port set in XML configuration," - " but TLS is disabled in qemu.conf")); + _("unix socket for spice graphics are not supported " + "with this QEMU")); goto error; } - virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort); - hasSecure = true; - } + virBufferAsprintf(&opt, "unix,addr=%s,", glisten->socket); + hasInsecure = true; + break; - if (cfg->spiceSASL) { - virBufferAddLit(&opt, "sasl,"); + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: - if (cfg->spiceSASLdir) - virCommandAddEnvPair(cmd, "SASL_CONF_PATH", - cfg->spiceSASLdir); + if (glisten->port > 0) { + virBufferAsprintf(&opt, "port=%u,", glisten->port); + hasInsecure = true; + } - /* TODO: Support ACLs later */ - } + if (glisten->tlsPort > 0) { + if (!cfg->spiceTLS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spice TLS port set in XML configuration, " + "but TLS is disabled in qemu.conf")); + goto error; + } + virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort); + hasSecure = true; + } - if (glisten->port > 0 || glisten->tlsPort > 0) { + if (cfg->spiceSASL) { + virBufferAddLit(&opt, "sasl,"); - switch (glisten->type) { - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: - listenAddr = glisten->address; - break; + if (cfg->spiceSASLdir) + virCommandAddEnvPair(cmd, "SASL_CONF_PATH", + cfg->spiceSASLdir); - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: - if (!glisten->network) + /* TODO: Support ACLs later */ + } + + if (glisten->port > 0 || glisten->tlsPort > 0) { + + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + listenAddr = glisten->address; break; - ret = networkGetNetworkAddress(glisten->network, &netAddr); - if (ret <= -2) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("network-based listen not possible, " - "network driver not present")); - goto error; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + if (!glisten->network) + break; + + ret = networkGetNetworkAddress(glisten->network, &netAddr); + if (ret <= -2) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("network-based listen not possible, " + "network driver not present")); + goto error; + } + if (ret < 0) + goto error; + + listenAddr = netAddr; + /* store the address we found in the <graphics> element so it will + * show up in status. */ + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + goto error; + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } - if (ret < 0) - goto error; - listenAddr = netAddr; - /* store the address we found in the <graphics> element so it will - * show up in status. */ - if (VIR_STRDUP(glisten->address, listenAddr) < 0) - goto error; - break; + if (!listenAddr) + listenAddr = cfg->spiceListen; + if (listenAddr) + virBufferAsprintf(&opt, "addr=%s,", listenAddr); - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: - break; + VIR_FREE(netAddr); } - if (!listenAddr) - listenAddr = cfg->spiceListen; - if (listenAddr) - virBufferAsprintf(&opt, "addr=%s,", listenAddr); + break; - VIR_FREE(netAddr); + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (graphics->data.spice.mousemode) { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6440cf1..9970be4 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -315,23 +315,16 @@ qemuDomainExtractTLSSubject(const char *certdir) static qemuMigrationCookieGraphicsPtr qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver, - virDomainGraphicsDefPtr def) + virDomainGraphicsListenDefPtr glisten) { qemuMigrationCookieGraphicsPtr mig = NULL; const char *listenAddr; - virDomainGraphicsListenDefPtr glisten = virDomainGraphicsGetListen(def, 0); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); if (VIR_ALLOC(mig) < 0) goto error; - if (!glisten) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing listen element")); - goto error; - } - - mig->type = def->type; + mig->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE; mig->port = glisten->port; if (cfg->spiceTLS) mig->tlsPort = glisten->tlsPort; @@ -458,14 +451,37 @@ qemuMigrationCookieAddGraphics(qemuMigrationCookiePtr mig, } for (i = 0; i < dom->def->ngraphics; i++) { - if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - if (!(mig->graphics = - qemuMigrationCookieGraphicsSpiceAlloc(driver, - dom->def->graphics[i]))) - return -1; - mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS; - break; - } + if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virDomainGraphicsListenDefPtr glisten = + virDomainGraphicsGetListen(dom->def->graphics[i], 0); + + if (!glisten) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing listen element")); + return -1; + } + + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + /* Seamless migration is supported only for listen types + * 'address and 'network'. */ + if (!(mig->graphics = + qemuMigrationCookieGraphicsSpiceAlloc(driver, glisten))) + return -1; + mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS; + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } + + /* Seamless migration is supported only for one graphics. */ + if (mig->graphics) + break; + } } return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args new file mode 100644 index 0000000..61335b0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-spice unix,addr=/tmp/lib/domain--1-QEMUGuest1/spice.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml new file mode 100644 index 0000000..acb325a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args new file mode 100644 index 0000000..26d0671 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-spice unix,addr=/tmp/spice.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml new file mode 100644 index 0000000..13bbef1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket' socket='/tmp/spice.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 43deebd..4bf5249 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -941,6 +941,12 @@ mymain(void) QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_SPICE_FILE_XFER_DISABLE); + DO_TEST("graphics-spice-socket", + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_UNIX); + DO_TEST("graphics-spice-auto-socket", + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_UNIX); DO_TEST("input-usbmouse", NONE); DO_TEST("input-usbtablet", NONE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml new file mode 100644 index 0000000..931ec0f --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml new file mode 100644 index 0000000..dd672ed --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket' socket='/tmp/spice.sock'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index b67d687..172fbf9 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -441,6 +441,8 @@ mymain(void) DO_TEST("graphics-spice"); DO_TEST("graphics-spice-compression"); DO_TEST("graphics-spice-qxl-vga"); + DO_TEST("graphics-spice-socket"); + DO_TEST("graphics-spice-auto-socket"); DO_TEST("nographics-vga"); DO_TEST("input-usbmouse"); DO_TEST("input-usbtablet"); -- 2.8.2

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_process.c | 123 ++++++++++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 46 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3d78455..21c2db2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4418,14 +4418,87 @@ qemuProcessGraphicsReservePorts(virQEMUDriverPtr driver, static int +qemuProcessGraphicsListenGenerate(virDomainObjPtr vm, + virQEMUDriverConfigPtr cfg, + virDomainGraphicsDefPtr graphics) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + const char *type = virDomainGraphicsTypeToString(graphics->type); + char *listenAddr = NULL; + bool autoSocket = false; + size_t i; + + switch (graphics->type) { + case VIR_DOMAIN_GRAPHICS_TYPE_VNC: + if (cfg->vncAutoUnixSocket) { + autoSocket = true; + } else { + listenAddr = cfg->vncListen; + } + break; + + case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + listenAddr = cfg->spiceListen; + break; + + case VIR_DOMAIN_GRAPHICS_TYPE_SDL: + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: + case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: + case VIR_DOMAIN_GRAPHICS_TYPE_LAST: + break; + } + + for (i = 0; i < graphics->nListens; i++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[i]; + + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + /* If there is no address specified we will use address from + * qemu.conf from '*Listen'. If '*_auto_unix_socket' is set it has + * higher priority and we will use unix socket as a default listen + * type. */ + if (!glisten->address) { + if (autoSocket) { + memset(glisten, 0, sizeof(virDomainGraphicsListenDef)); + if (virAsprintf(&glisten->socket, "%s/%s.sock", + priv->libDir, type) < 0) + return -1; + glisten->fromConfig = true; + glisten->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; + } else if (listenAddr) { + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + return -1; + glisten->fromConfig = true; + } + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + if (!glisten->socket) { + if (virAsprintf(&glisten->socket, "%s/%s.sock", + priv->libDir, type) < 0) + return -1; + glisten->autogenerated = true; + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } + } + + return 0; +} + + +static int qemuProcessSetupGraphics(virQEMUDriverPtr driver, virDomainObjPtr vm, unsigned int flags) { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); - qemuDomainObjPrivatePtr priv = vm->privateData; bool allocate = !(flags & VIR_QEMU_PROCESS_START_PRETEND); - size_t i, j; + size_t i; int ret = -1; if (allocate && qemuProcessGraphicsReservePorts(driver, vm) < 0) @@ -4433,22 +4506,16 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, for (i = 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics = vm->def->graphics[i]; - const char *type = virDomainGraphicsTypeToString(graphics->type); - char *listenAddr = NULL; switch (graphics->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: if (qemuProcessVNCAllocatePorts(driver, graphics, allocate) < 0) goto cleanup; - - listenAddr = cfg->vncListen; break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: if (qemuProcessSPICEAllocatePorts(driver, cfg, graphics, allocate) < 0) goto cleanup; - - listenAddr = cfg->spiceListen; break; case VIR_DOMAIN_GRAPHICS_TYPE_SDL: @@ -4458,44 +4525,8 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, break; } - for (j = 0; j < graphics->nListens; j++) { - virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; - - 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)); - if (virAsprintf(&glisten->socket, "%s/%s.sock", - priv->libDir, type) < 0) - goto cleanup; - glisten->fromConfig = true; - glisten->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET; - } else if (listenAddr) { - if (VIR_STRDUP(glisten->address, listenAddr) < 0) - goto cleanup; - glisten->fromConfig = true; - } - } - break; - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: - if (!glisten->socket) { - if (virAsprintf(&glisten->socket, "%s/%s.sock", - priv->libDir, type) < 0) - goto cleanup; - glisten->autogenerated = true; - } - break; - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: - case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: - break; - } - } + if (qemuProcessGraphicsListenGenerate(vm, cfg, graphics) < 0) + goto cleanup; } ret = 0; -- 2.8.2

Commit 55320c23 introduced a new test for VNC to test if vnc_auto_unix_socket is set in qemu.conf, but forget to enable it in qemuxml2argvtest.c. This patch also moves the code in qemuxml2xmltest.c next to other VNC tests. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .../qemuxml2argv-graphics-vnc-auto-socket-cfg.args | 22 ++++++++++++ .../qemuxml2argv-graphics-vnc-auto-socket-cfg.xml | 34 ++++++++++++++++++ .../qemuxml2argv-graphics-vnc-autosocket.args | 22 ------------ .../qemuxml2argv-graphics-vnc-autosocket.xml | 34 ------------------ tests/qemuxml2argvtest.c | 3 ++ ...qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml | 41 ++++++++++++++++++++++ .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 41 ---------------------- tests/qemuxml2xmltest.c | 11 +++--- 8 files changed, 106 insertions(+), 102 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args new file mode 100644 index 0000000..cfa63b1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml new file mode 100644 index 0000000..fa59c39 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args deleted file mode 100644 index 7e1fb6b..0000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args +++ /dev/null @@ -1,22 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu \ --name QEMUGuest1 \ --S \ --M pc \ --m 214 \ --smp 1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --nodefaults \ --monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ --no-acpi \ --boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.socket \ --vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml deleted file mode 100644 index fa59c39..0000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml +++ /dev/null @@ -1,34 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='i686' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <graphics type='vnc' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/> - <video> - <model type='cirrus' vram='16384' heads='1'/> - </video> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4bf5249..a3651c9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -878,6 +878,9 @@ mymain(void) DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC); + driver.config->vncAutoUnixSocket = true; + DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC); + driver.config->vncAutoUnixSocket = false; driver.config->vncSASL = 1; VIR_FREE(driver.config->vncSASLdir); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml new file mode 100644 index 0000000..5013b18 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml @@ -0,0 +1,41 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='vnc'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml deleted file mode 100644 index 5013b18..0000000 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml +++ /dev/null @@ -1,41 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</currentMemory> - <vcpu placement='static'>1</vcpu> - <os> - <type arch='i686' machine='pc'>hvm</type> - <boot dev='hd'/> - </os> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>/usr/bin/qemu</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> - </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <graphics type='vnc'> - <listen type='socket'/> - </graphics> - <video> - <model type='cirrus' vram='16384' heads='1' primary='yes'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> - </video> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 172fbf9..49bf557 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -268,6 +268,8 @@ mymain(void) if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; + cfg = virQEMUDriverGetConfig(&driver); + /* TODO: test with format probing disabled too */ driver.config->allowDiskFormatProbing = true; @@ -436,6 +438,10 @@ mymain(void) DO_TEST("graphics-vnc-no-listen-attr"); DO_TEST("graphics-vnc-socket"); DO_TEST("graphics-vnc-auto-socket"); + cfg->vncAutoUnixSocket = true; + DO_TEST_FULL("graphics-vnc-auto-socket-cfg", WHEN_INACTIVE, NONE); + cfg->vncAutoUnixSocket = false; + DO_TEST("graphics-sdl"); DO_TEST("graphics-sdl-fullscreen"); DO_TEST("graphics-spice"); @@ -792,11 +798,6 @@ mymain(void) DO_TEST("virtio-input"); DO_TEST("virtio-input-passthrough"); - cfg = virQEMUDriverGetConfig(&driver); - cfg->vncAutoUnixSocket = true; - DO_TEST_FULL("graphics-vnc-autosocket", WHEN_INACTIVE, NONE); - cfg->vncAutoUnixSocket = false; - virObjectUnref(cfg); qemuTestDriverFree(&driver); -- 2.8.2

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 11 +++++++ src/qemu/qemu_conf.c | 1 + src/qemu/qemu_conf.h | 1 + src/qemu/qemu_process.c | 4 +++ src/qemu/test_libvirtd_qemu.aug.in | 1 + ...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 +++++++++++++ ...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 +++++++++++++++++++ tests/qemuxml2argvtest.c | 5 ++++ ...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 4 +++ 11 files changed, 113 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index b6f6dc4..8bc23ba 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -37,6 +37,7 @@ module Libvirtd_qemu = let spice_entry = str_entry "spice_listen" | bool_entry "spice_tls" | str_entry "spice_tls_x509_cert_dir" + | bool_entry "spice_auto_unix_socket" | str_entry "spice_password" | bool_entry "spice_sasl" | str_entry "spice_sasl_dir" diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 59c839e..4ac6fc9 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -130,6 +130,17 @@ #spice_tls_x509_cert_dir = "/etc/pki/libvirt-spice" +# Enable this option to have SPICE served over an automatically created +# unix socket. This prevents unprivileged access from users on the +# host machine, though most SPICE clients do not support it. +# +# This will only be enabled for SPICE configurations that have listen +# type=address but without any address specified. This setting takes +# preference over spice_listen. +# +#spice_auto_unix_socket = 1 + + # The default SPICE password. This parameter is only used if the # per-domain XML config does not already provide a password. To # allow access without passwords, leave this commented out. An diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e00ddca..d4c34c9 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -588,6 +588,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, GET_VALUE_STR("spice_sasl_dir", cfg->spiceSASLdir); GET_VALUE_STR("spice_listen", cfg->spiceListen); GET_VALUE_STR("spice_password", cfg->spicePassword); + GET_VALUE_BOOL("spice_auto_unix_socket", cfg->spiceAutoUnixSocket); GET_VALUE_ULONG("remote_websocket_port_min", cfg->webSocketPortMin); diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index a714b84..c94bf13 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -123,6 +123,7 @@ struct _virQEMUDriverConfig { char *spiceSASLdir; char *spiceListen; char *spicePassword; + bool spiceAutoUnixSocket; int remotePortMin; int remotePortMax; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 21c2db2..05ddb32 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4438,7 +4438,11 @@ qemuProcessGraphicsListenGenerate(virDomainObjPtr vm, break; case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + if (cfg->spiceAutoUnixSocket) { + autoSocket = true; + } else { listenAddr = cfg->spiceListen; + } break; case VIR_DOMAIN_GRAPHICS_TYPE_SDL: diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in index 8bec743..c4d4f19 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -14,6 +14,7 @@ module Test_libvirtd_qemu = { "spice_listen" = "0.0.0.0" } { "spice_tls" = "1" } { "spice_tls_x509_cert_dir" = "/etc/pki/libvirt-spice" } +{ "spice_auto_unix_socket" = "1" } { "spice_password" = "XYZ12345" } { "spice_sasl" = "1" } { "spice_sasl_dir" = "/some/directory/sasl2" } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args new file mode 100644 index 0000000..61335b0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-spice unix,addr=/tmp/lib/domain--1-QEMUGuest1/spice.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml new file mode 100644 index 0000000..ff155c3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a3651c9..f046060 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -950,6 +950,11 @@ mymain(void) DO_TEST("graphics-spice-auto-socket", QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX); + driver.config->spiceAutoUnixSocket = true; + DO_TEST("graphics-spice-auto-socket-cfg", + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_UNIX); + driver.config->spiceAutoUnixSocket = false; DO_TEST("input-usbmouse", NONE); DO_TEST("input-usbtablet", NONE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml new file mode 100644 index 0000000..931ec0f --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 49bf557..9db7ddd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -449,6 +449,10 @@ mymain(void) DO_TEST("graphics-spice-qxl-vga"); DO_TEST("graphics-spice-socket"); DO_TEST("graphics-spice-auto-socket"); + cfg->spiceAutoUnixSocket = true; + DO_TEST_FULL("graphics-spice-auto-socket-cfg", WHEN_INACTIVE, NONE); + cfg->spiceAutoUnixSocket = false; + DO_TEST("nographics-vga"); DO_TEST("input-usbmouse"); DO_TEST("input-usbtablet"); -- 2.8.2

On 05/12/2016 11:15 AM, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 11 +++++++ src/qemu/qemu_conf.c | 1 + src/qemu/qemu_conf.h | 1 + src/qemu/qemu_process.c | 4 +++ src/qemu/test_libvirtd_qemu.aug.in | 1 + ...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 +++++++++++++ ...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 +++++++++++++++++++ tests/qemuxml2argvtest.c | 5 ++++ ...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 4 +++ 11 files changed, 113 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index b6f6dc4..8bc23ba 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -37,6 +37,7 @@ module Libvirtd_qemu = let spice_entry = str_entry "spice_listen" | bool_entry "spice_tls" | str_entry "spice_tls_x509_cert_dir" + | bool_entry "spice_auto_unix_socket" | str_entry "spice_password" | bool_entry "spice_sasl" | str_entry "spice_sasl_dir" diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 59c839e..4ac6fc9 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -130,6 +130,17 @@ #spice_tls_x509_cert_dir = "/etc/pki/libvirt-spice"
+# Enable this option to have SPICE served over an automatically created +# unix socket. This prevents unprivileged access from users on the +# host machine, though most SPICE clients do not support it. +# +# This will only be enabled for SPICE configurations that have listen +# type=address but without any address specified. This setting takes +# preference over spice_listen. +# +#spice_auto_unix_socket = 1 + +
Actually the comment about 'Most XXX clients' is wrong... virt-viewer/spice-gtk as the most common spice client does support it :) I think I made the same mistake in my old patch too
# The default SPICE password. This parameter is only used if the # per-domain XML config does not already provide a password. To # allow access without passwords, leave this commented out. An diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e00ddca..d4c34c9 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -588,6 +588,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, GET_VALUE_STR("spice_sasl_dir", cfg->spiceSASLdir); GET_VALUE_STR("spice_listen", cfg->spiceListen); GET_VALUE_STR("spice_password", cfg->spicePassword); + GET_VALUE_BOOL("spice_auto_unix_socket", cfg->spiceAutoUnixSocket);
GET_VALUE_ULONG("remote_websocket_port_min", cfg->webSocketPortMin); diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index a714b84..c94bf13 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -123,6 +123,7 @@ struct _virQEMUDriverConfig { char *spiceSASLdir; char *spiceListen; char *spicePassword; + bool spiceAutoUnixSocket;
int remotePortMin; int remotePortMax; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 21c2db2..05ddb32 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4438,7 +4438,11 @@ qemuProcessGraphicsListenGenerate(virDomainObjPtr vm, break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + if (cfg->spiceAutoUnixSocket) { + autoSocket = true; + } else { listenAddr = cfg->spiceListen; + } break;
case VIR_DOMAIN_GRAPHICS_TYPE_SDL: diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in index 8bec743..c4d4f19 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -14,6 +14,7 @@ module Test_libvirtd_qemu = { "spice_listen" = "0.0.0.0" } { "spice_tls" = "1" } { "spice_tls_x509_cert_dir" = "/etc/pki/libvirt-spice" } +{ "spice_auto_unix_socket" = "1" } { "spice_password" = "XYZ12345" } { "spice_sasl" = "1" } { "spice_sasl_dir" = "/some/directory/sasl2" } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args new file mode 100644 index 0000000..61335b0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=spice \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-spice unix,addr=/tmp/lib/domain--1-QEMUGuest1/spice.sock \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml new file mode 100644 index 0000000..ff155c3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a3651c9..f046060 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -950,6 +950,11 @@ mymain(void) DO_TEST("graphics-spice-auto-socket", QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX); + driver.config->spiceAutoUnixSocket = true; + DO_TEST("graphics-spice-auto-socket-cfg", + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_UNIX); + driver.config->spiceAutoUnixSocket = false;
DO_TEST("input-usbmouse", NONE); DO_TEST("input-usbtablet", NONE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml new file mode 100644 index 0000000..931ec0f --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='spice'> + <listen type='socket'/> + </graphics> + <video> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 49bf557..9db7ddd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -449,6 +449,10 @@ mymain(void) DO_TEST("graphics-spice-qxl-vga"); DO_TEST("graphics-spice-socket"); DO_TEST("graphics-spice-auto-socket"); + cfg->spiceAutoUnixSocket = true; + DO_TEST_FULL("graphics-spice-auto-socket-cfg", WHEN_INACTIVE, NONE); + cfg->spiceAutoUnixSocket = false; + DO_TEST("nographics-vga"); DO_TEST("input-usbmouse"); DO_TEST("input-usbtablet");
This should also be testing that <graphics type='spice'/> fills in a socket value as well, we shouldn't only be testing the bare <listen type='socket'/> case - Cole

This new listen type is currently supported only by spice graphics. It's introduced to make it easier and clearer specify to not listen anywhere in order to start a guest with OpenGL support. The old way to do this was set spice graphics autoport='no' and don't specify any ports. The new way is to use <listen type='none'/>. In order to be able to migrate to old libvirt the migratable XML will be generated without the listen element and with autoport='no'. Also the old configuration will be automatically converted to the this listen type. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 11 ++++ docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 61 +++++++++++++++++----- src/qemu/qemu_command.c | 13 +++-- .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +- .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 4 +- 6 files changed, 73 insertions(+), 23 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a0d2e4b..d217ae0 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5375,6 +5375,17 @@ qemu-kvm -net nic,model=? /dev/null attribute all <code>listen</code> elements are ignored. </p> </dd> + <dt><code>none</code> <span class="since">since 1.3.5</span></dt> + <dd> + <p> + This listen type doesn't have any other attribute. Libvirt supports + passing a file descriptor through our APIs virDomainOpenGraphics() and + virDomainOpenGraphicsFD(). No other listen types are allowed if this + one is used and the graphics device doesn't listen anywhere. You need + to use one of the two APIs to pass a FD to QEMU in order to connect to + this graphics device. Supported only by <code>spice</code>. + </p> + </dd> </dl> <h4><a name="elementsVideo">Video devices</a></h4> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 03591fe..3ed7498 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3021,6 +3021,11 @@ </attribute> </optional> </group> + <group> + <attribute name="type"> + <value>none</value> + </attribute> + </group> </choice> </element> </zeroOrMore> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7691814..0963f4a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10829,13 +10829,28 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } def->type = typeVal; - if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && - graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC && - graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("listen type 'socket' is not available for " - "graphics type '%s'"), graphicsType); - goto error; + switch (def->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: + if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("listen type 'socket' is not available for " + "graphics type '%s'"), graphicsType); + goto error; + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("listen type 'none' is not available for " + "graphics type '%s'"), graphicsType); + goto error; + } + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { @@ -11008,6 +11023,19 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, } } + /* If spice graphics is configured without ports and with autoport='no' then + * we start qemu with Spice to not listen anywhere. Let's convert this + * configuration to the new listen type='none' which does the same. */ + if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virDomainGraphicsListenDefPtr glisten = &def->listens[0]; + + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS && + glisten->port == 0 && glisten->tlsPort == 0 && !glisten->autoport) { + VIR_FREE(glisten->address); + glisten->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE; + } + } + ret = 0; error: if (ret < 0) @@ -21475,10 +21503,8 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf, return; virBufferAddLit(buf, "<listen"); - if (def->type) { - virBufferAsprintf(buf, " type='%s'", - virDomainGraphicsListenTypeToString(def->type)); - } + virBufferAsprintf(buf, " type='%s'", + virDomainGraphicsListenTypeToString(def->type)); if (def->address && (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS || @@ -21655,6 +21681,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) + virBufferAddStr(buf, " autoport='no'"); + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; @@ -21676,8 +21706,6 @@ virDomainGraphicsDefFormat(virBufferPtr buf, } for (i = 0; i < def->nListens; i++) { - if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE) - continue; if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { if (def->listens[i].fromConfig) continue; @@ -21690,6 +21718,13 @@ virDomainGraphicsDefFormat(virBufferPtr buf, def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET && !def->listens[i].autogenerated) continue; + + /* The new listen type none is in the migratable XML represented as + * port=0 and autoport=no because old libvirt support this + * configuration for spice. */ + if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE && + def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE) + continue; } if (!children) { virBufferAddLit(buf, ">\n"); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89e8b0e..17651c4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7638,6 +7638,11 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + /* QEMU requires either port or tls-port to be specified if there is no + * other argument. Use a dummy port=0. */ + virBufferAddLit(&opt, "port=0,"); + hasInsecure = true; + break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } @@ -7771,13 +7776,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg, virBufferTrim(&opt, ",", -1); virCommandAddArg(cmd, "-spice"); - /* If we did not add any SPICE arguments, add a dummy 'port=0' one - * as -spice alone is not allowed on QEMU command line - */ - if (virBufferUse(&opt) == 0) - virCommandAddArg(cmd, "port=0"); - else - virCommandAddArgBuffer(cmd, &opt); + virCommandAddArgBuffer(cmd, &opt); if (graphics->data.spice.keymap) virCommandAddArgList(cmd, "-k", graphics->data.spice.keymap, NULL); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args index b80ad16..edecca1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args @@ -19,6 +19,6 @@ QEMU_AUDIO_DRV=spice \ -drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\ id=drive-ide0-0-0,cache=none \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --spice gl=on \ +-spice port=0,gl=on \ -device virtio-vga,id=video0,virgl=on,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml index fd260ea..9fb533a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-spice-gl.xml @@ -29,8 +29,8 @@ <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <graphics type='spice' autoport='no'> - <listen type='address' autoport='no'/> + <graphics type='spice'> + <listen type='none'/> <gl enable='yes'/> </graphics> <video> -- 2.8.2

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 3 ++- src/conf/domain_conf.c | 3 ++- src/qemu/qemu_command.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d217ae0..d1d5915 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5383,7 +5383,8 @@ qemu-kvm -net nic,model=? /dev/null virDomainOpenGraphicsFD(). No other listen types are allowed if this one is used and the graphics device doesn't listen anywhere. You need to use one of the two APIs to pass a FD to QEMU in order to connect to - this graphics device. Supported only by <code>spice</code>. + this graphics device. Supported only by <code>vnc</code> and + <code>spice</code>. </p> </dd> </dl> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0963f4a..96ccff2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10840,7 +10840,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("listen type 'none' is not available for " "graphics type '%s'"), graphicsType); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 17651c4..a58d0e9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7465,6 +7465,9 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + virBufferAddLit(&opt, "none"); + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; } -- 2.8.2

On 05/12/2016 11:15 AM, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 3 ++- src/conf/domain_conf.c | 3 ++- src/qemu/qemu_command.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d217ae0..d1d5915 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5383,7 +5383,8 @@ qemu-kvm -net nic,model=? /dev/null virDomainOpenGraphicsFD(). No other listen types are allowed if this one is used and the graphics device doesn't listen anywhere. You need to use one of the two APIs to pass a FD to QEMU in order to connect to - this graphics device. Supported only by <code>spice</code>. + this graphics device. Supported only by <code>vnc</code> and + <code>spice</code>. </p> </dd> </dl> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0963f4a..96ccff2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10840,7 +10840,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, } break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: - if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE && + graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("listen type 'none' is not available for " "graphics type '%s'"), graphicsType); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 17651c4..a58d0e9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7465,6 +7465,9 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, break;
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + virBufferAddLit(&opt, "none"); + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: break; }
Cool, I didn't know qemu supported this. But this patch needs a test case Thanks, Cole

On Mon, May 16, 2016 at 11:01:30AM -0400, Cole Robinson wrote:
On 05/13/2016 07:39 AM, Pavel Hrdina wrote:
I forgot to mention that patches 1-4,7,10,11 are already acked.
1-4 look good to me too at a glance, I suggest pushing them ahead of time since they are useful on their own. I'll try and review the rest now
Right, Patches 1-4 pushed. Thanks

Hey, Something which I forgot to mention/test when going through the first iteration is virsh domdisplay, it's currently failing with <graphics type='spice'><listen type='socket' socket='/tmp/foo'/></graphics> I think something like 'spice+unix:///tmp/foo' is expected. This can be addressed as a follow-up to this series though. Christophe On Thu, May 12, 2016 at 05:15:44PM +0200, Pavel Hrdina wrote:
This patch series improves the way how different listen types can be specified and also introduce a new listen types for graphics devices.
First improvement is to move ports out of graphics element into listen element with type address or network. This is a first step to make the code listen-driven.
Second step is to create a new listen type socket to improve the current vnc configuration and to print only socket path witout any other listen types. With the new socket type now we can add support also to spice graphics.
The last improvement is to introduce new listen type none for spice and vnc graphics to specify that the spice graphics shouldn't listen anywhere by default.
In case of spice graphics the new listen types socket or none are required to start a guest with OpenGL support.
Changes in v3: - add listen type none support for vnc - fix issues pointed out in v2
Changes in v2: - don't remove vnc_auto_unix_socket from qemu.conf - add spice_auto_unix_socket
Pavel Hrdina (14): graphics: don't parse listens if socket attribute is present domain_conf: parse listen attribute while parsing listen elements graphics: make address attribute for listen type='address' optional domain_conf: cleanup virDomainGraphicsListenDefParseXML graphics: move port definition to listen element graphics: introduce listen type=socket and use it for VNC qemu_capabilites: add QEMU_CAPS_SPICE_UNIX qemu_command: refactor spice channel code spice: add support for listen type socket qemu_process: separate graphics socket and address generation tests: cleanup vnc auto socket test spice: introduce spice_auto_unix_socket config option spice: introduce listen type none vnc: add support for listen type none
docs/formatdomain.html.in | 141 +++-- docs/schemas/domaincommon.rng | 63 +- src/conf/domain_conf.c | 637 ++++++++++++++------- src/conf/domain_conf.h | 31 +- src/libvirt_private.syms | 1 + src/libxl/libxl_conf.c | 53 +- src/libxl/libxl_domain.c | 17 +- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 17 +- src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 273 +++++---- src/qemu/qemu_conf.c | 1 + src/qemu/qemu_conf.h | 1 + src/qemu/qemu_domain.c | 19 +- src/qemu/qemu_hotplug.c | 40 +- src/qemu/qemu_migration.c | 50 +- src/qemu/qemu_parse_command.c | 41 +- src/qemu/qemu_process.c | 351 ++++++++---- src/qemu/test_libvirtd_qemu.aug.in | 1 + src/security/virt-aa-helper.c | 15 +- src/vbox/vbox_common.c | 30 +- src/vbox/vbox_tmpl.c | 34 +- src/vbox/vbox_uniformed_api.h | 4 +- src/vmx/vmx.c | 54 +- src/vz/vz_sdk.c | 30 +- src/xenconfig/xen_common.c | 75 ++- src/xenconfig/xen_sxpr.c | 71 +-- src/xenconfig/xen_xl.c | 45 +- .../generic-graphics-listen-back-compat-ports.xml | 30 + ...generic-graphics-vnc-listen-element-minimal.xml | 2 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 + ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 + ...hics-vnc-socket-attr-listen-socket-mismatch.xml | 30 + ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 + .../generic-graphics-listen-back-compat-ports.xml | 30 + .../generic-graphics-listen-back-compat.xml | 2 +- .../generic-graphics-vnc-listen-attr-only.xml | 2 +- ...generic-graphics-vnc-listen-element-minimal.xml | 4 +- ...aphics-vnc-listen-element-with-address-port.xml | 30 + ...ic-graphics-vnc-listen-element-with-address.xml | 2 +- .../generic-graphics-vnc-manual-port.xml | 4 +- .../generic-graphics-vnc-minimal.xml | 4 +- ...ric-graphics-vnc-socket-attr-listen-address.xml | 30 + ...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 + .../generic-graphics-vnc-socket-listen.xml | 2 +- .../generic-graphics-vnc-socket.xml | 4 +- tests/genericxml2xmltest.c | 7 + .../qemuargv2xml-graphics-vnc-policy.xml | 2 +- .../qemuargv2xml-graphics-vnc-sasl.xml | 2 +- .../qemuargv2xml-graphics-vnc-socket.xml | 4 +- .../qemuargv2xml-graphics-vnc-tls.xml | 2 +- .../qemuargv2xml-graphics-vnc-websocket.xml | 2 +- .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml | 2 +- ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- ...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 + ...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 + .../qemuxml2argv-graphics-spice-auto-socket.args | 20 + .../qemuxml2argv-graphics-spice-auto-socket.xml | 30 + .../qemuxml2argv-graphics-spice-socket.args | 20 + .../qemuxml2argv-graphics-spice-socket.xml | 30 + .../qemuxml2argv-graphics-vnc-auto-socket-cfg.args | 22 + .../qemuxml2argv-graphics-vnc-auto-socket-cfg.xml | 34 ++ .../qemuxml2argv-graphics-vnc-auto-socket.args | 20 + .../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 + .../qemuxml2argv-graphics-vnc-autosocket.args | 22 - .../qemuxml2argv-graphics-vnc-autosocket.xml | 34 -- .../qemuxml2argv-graphics-vnc-socket.args | 4 +- .../qemuxml2argv-graphics-vnc-socket.xml | 10 +- .../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +- tests/qemuxml2argvtest.c | 16 + .../qemuxml2xmlout-graphics-listen-network.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 4 +- ...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-auto-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-compression.xml | 2 +- .../qemuxml2xmlout-graphics-spice-qxl-vga.xml | 2 +- .../qemuxml2xmlout-graphics-spice-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-spice-timeout.xml | 4 +- .../qemuxml2xmlout-graphics-spice.xml | 2 +- ...qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml | 41 ++ .../qemuxml2xmlout-graphics-vnc-auto-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-vnc-autosocket.xml | 39 -- .../qemuxml2xmlout-graphics-vnc-no-listen-attr.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-sasl.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-socket.xml | 35 ++ .../qemuxml2xmlout-graphics-vnc-tls.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-websocket.xml | 2 +- .../qemuxml2xmlout-graphics-vnc.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 4 +- .../qemuxml2xmlout-net-bandwidth.xml | 4 +- .../qemuxml2xmlout-net-bandwidth2.xml | 4 +- .../qemuxml2xmlout-pci-bridge.xml | 2 +- ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 3 +- tests/qemuxml2xmltest.c | 19 +- tests/sexpr2xmldata/sexpr2xml-curmem.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml | 4 +- .../sexpr2xml-fv-serial-dev-2-ports.xml | 4 +- .../sexpr2xml-fv-serial-dev-2nd-port.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml | 4 +- .../sexpr2xml-fv-serial-tcp-telnet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-sound.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-utc.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-fv.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml | 4 +- .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 2 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 2 +- .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-vif-rate.xml | 4 +- tests/vmx2xmldata/vmx2xml-graphics-vnc.xml | 4 +- .../test-disk-positional-parms-full.xml | 2 +- .../test-disk-positional-parms-partial.xml | 2 +- ...est-fullvirt-direct-kernel-boot-bogus-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot-extra.xml | 2 +- .../test-fullvirt-direct-kernel-boot.xml | 2 +- tests/xlconfigdata/test-fullvirt-multiusb.xml | 2 +- tests/xlconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xlconfigdata/test-new-disk.xml | 2 +- tests/xlconfigdata/test-rbd-multihost-noauth.xml | 2 +- tests/xlconfigdata/test-spice-features.xml | 2 +- tests/xlconfigdata/test-spice.xml | 2 +- tests/xlconfigdata/test-vif-rate.xml | 2 +- tests/xmconfigdata/test-escape-paths.xml | 2 +- .../xmconfigdata/test-fullvirt-default-feature.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-hpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-force-nohpet.xml | 2 +- tests/xmconfigdata/test-fullvirt-localtime.xml | 2 +- tests/xmconfigdata/test-fullvirt-net-netfront.xml | 2 +- tests/xmconfigdata/test-fullvirt-new-cdrom.xml | 2 +- tests/xmconfigdata/test-fullvirt-nohap.xml | 2 +- tests/xmconfigdata/test-fullvirt-parallel-tcp.xml | 2 +- .../test-fullvirt-serial-dev-2-ports.xml | 2 +- .../test-fullvirt-serial-dev-2nd-port.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-file.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-null.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pipe.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-pty.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-stdio.xml | 2 +- .../test-fullvirt-serial-tcp-telnet.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-tcp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-udp.xml | 2 +- tests/xmconfigdata/test-fullvirt-serial-unix.xml | 2 +- tests/xmconfigdata/test-fullvirt-sound.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 2 +- tests/xmconfigdata/test-fullvirt-usbtablet.xml | 2 +- tests/xmconfigdata/test-fullvirt-utc.xml | 2 +- tests/xmconfigdata/test-no-source-cdrom.xml | 4 +- tests/xmconfigdata/test-paravirt-net-e1000.xml | 2 +- tests/xmconfigdata/test-paravirt-net-vifname.xml | 2 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 2 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 2 +- tests/xmconfigdata/test-pci-devs.xml | 4 +- 172 files changed, 2310 insertions(+), 987 deletions(-) create mode 100644 tests/genericxml2xmlindata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-listen-element-with-address-port.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-listen-back-compat-ports.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-listen-element-with-address-port.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket-cfg.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket-cfg.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml
-- 2.8.2
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 05/13/2016 12:35 PM, Christophe Fergeau wrote:
Hey,
Something which I forgot to mention/test when going through the first iteration is virsh domdisplay, it's currently failing with <graphics type='spice'><listen type='socket' socket='/tmp/foo'/></graphics>
I think something like 'spice+unix:///tmp/foo' is expected. This can be addressed as a follow-up to this series though.
Can you file an upstream bug for this? Just so it doesn't get lost (unless it's on your todo list and it will definitely get done) http://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Virtualization%20Tools&component=libvirt Thanks, Cole

On Mon, May 16, 2016 at 10:59:47AM -0400, Cole Robinson wrote:
On 05/13/2016 12:35 PM, Christophe Fergeau wrote:
Hey,
Something which I forgot to mention/test when going through the first iteration is virsh domdisplay, it's currently failing with <graphics type='spice'><listen type='socket' socket='/tmp/foo'/></graphics>
I think something like 'spice+unix:///tmp/foo' is expected. This can be addressed as a follow-up to this series though.
Can you file an upstream bug for this? Just so it doesn't get lost (unless it's on your todo list and it will definitely get done)
http://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Virtualization%20Tools&component=libvirt
Done, https://bugzilla.redhat.com/show_bug.cgi?id=1336720 Christophe
participants (3)
-
Christophe Fergeau
-
Cole Robinson
-
Pavel Hrdina