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(a)redhat.com>
---
docs/formatdomain.html.in | 87 +++--
docs/schemas/domaincommon.rng | 40 +++
src/conf/domain_conf.c | 349 ++++++++++++---------
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, 1029 insertions(+), 715 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 1350519..0d22922 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5078,7 +5078,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'/>
@@ -5110,16 +5110,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.
@@ -5140,22 +5137,12 @@ qemu-kvm -net nic,model=? /dev/null
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
@@ -5197,6 +5184,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'/>
@@ -5254,16 +5242,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>
@@ -5306,6 +5291,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>
@@ -5323,6 +5342,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 ffeafd2..e7eda77 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2960,6 +2960,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">
@@ -2973,6 +2993,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 72ab2d7..2168bac 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10642,9 +10642,131 @@ 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)
+ 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_*
*
@@ -10656,6 +10778,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
xmlNodePtr node,
+ virDomainGraphicsDefPtr graphics,
xmlNodePtr parent,
unsigned int flags)
{
@@ -10727,6 +10850,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr
def,
def->fromConfig = tmp != 0;
}
+ if (virDomainGraphicsListenDefParsePorts(def, node, graphics,
+ parent, flags) < 0)
+ goto error;
+
ret = 0;
error:
if (ret < 0)
@@ -10775,6 +10902,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;
@@ -10790,6 +10918,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;
}
@@ -10811,50 +10943,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);
@@ -10878,9 +10972,6 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDefPtr def,
ret = 0;
error:
- VIR_FREE(port);
- VIR_FREE(autoport);
- VIR_FREE(websocket);
VIR_FREE(sharePolicy);
return ret;
}
@@ -10923,8 +11014,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;
@@ -10932,27 +11021,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;
@@ -10961,8 +11029,6 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDefPtr def,
ret = 0;
error:
- VIR_FREE(port);
- VIR_FREE(autoport);
VIR_FREE(replaceUser);
VIR_FREE(multiUser);
return ret;
@@ -11006,9 +11072,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;
@@ -11016,29 +11079,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) {
@@ -11051,16 +11091,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,
@@ -11295,9 +11325,6 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def,
ret = 0;
error:
- VIR_FREE(port);
- VIR_FREE(tlsPort);
- VIR_FREE(autoport);
VIR_FREE(defaultMode);
return ret;
}
@@ -21391,6 +21418,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);
@@ -21403,8 +21450,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;
@@ -21414,23 +21461,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);
@@ -21442,22 +21473,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)
@@ -21486,24 +21516,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:
@@ -21517,19 +21547,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'",
@@ -23844,23 +23874,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 b825477..0895136 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 14a900c..4bbf1e7 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 8ec550e..7f7ce60 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7322,7 +7322,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;
@@ -7346,46 +7346,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)
@@ -7396,21 +7399,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) {
@@ -7476,13 +7477,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)) {
@@ -7491,17 +7490,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) {
@@ -7514,39 +7519,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)
@@ -7577,7 +7580,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) {
@@ -7595,7 +7598,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"));
@@ -7606,7 +7609,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"));
@@ -7619,7 +7622,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"));
@@ -7628,7 +7631,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 ca95004..1fb08c0 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:
if (STRNEQ_NULLABLE(newlisten->network, oldlisten->network)) {
@@ -2654,6 +2663,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:
@@ -2665,12 +2683,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"));
@@ -2708,13 +2720,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 7ce90f9..429cc45 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 c3dfc3f..8f0cc9e 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;
- graphics->data.spice.tlsPort = tlsPort;
+ if (!glisten->autoport)
+ glisten->portReserved = true;
+ }
- if (!graphics->data.spice.autoport)
- graphics->data.spice.tlsPortReserved = 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;
+ }
+
+ if (virPortAllocatorAcquire(driver->remotePorts, &tlsPort) <
0)
+ goto error;
+
+ glisten->tlsPort = tlsPort;
+
+ if (!glisten->autoport)
+ glisten->tlsPortReserved = true;
+ }
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
+ }
}
return 0;
@@ -4352,36 +4374,45 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- size_t i;
+ size_t i, j;
int ret = -1;
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)
- goto cleanup;
- 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)
- goto cleanup;
- graphics->data.spice.portReserved = true;
- }
- if (graphics->data.spice.tlsPort > 0) {
- if (virPortAllocatorSetUsed(driver->remotePorts,
- graphics->data.spice.tlsPort,
- true) < 0)
- goto cleanup;
- 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)
+ goto cleanup;
+ glisten->portReserved = true;
+ }
+ if (glisten->tlsPort > 0 &&
+ graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ if (virPortAllocatorSetUsed(driver->remotePorts,
+ glisten->tlsPort,
+ true) < 0)
+ goto cleanup;
+ 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;
}
}
@@ -6186,39 +6217,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 629fbf5..a12ee74 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,9 +701,12 @@ 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;
}
+
if (VIR_ALLOC_N(def->graphics, 1) < 0)
goto cleanup;
def->graphics[0] = graphics;
@@ -1631,7 +1636,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;
@@ -1639,19 +1644,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",
@@ -1677,17 +1683,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 381dbdc..616ab76 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)
@@ -962,14 +960,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");
@@ -979,13 +976,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)
@@ -1521,7 +1518,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) {
@@ -1542,16 +1539,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)
@@ -1577,7 +1578,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) {
@@ -1595,16 +1596,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 ab23c66..7f65832 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml
index 799e3ff..7f04d04 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml
index adc6b89..a880e61 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml
index 836f7e3..7cca138 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml
index 9c17ce4..b493b57 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
index 8d6a6a9..1b9d2ee 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml
index 4f4f16a..1915e59 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
index e9a60af..78ea16e 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' 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 ed53287..c8e5308 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' 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 d22719d..14c1736 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
index ea82206..fba05dc 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
index ac248b9..eae1f55 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
index 4942800..12f2484 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
index 358e544..ce3fd0a 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
index 5bded20..035aa0f 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' 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 b4447e2..dd2cc63 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
index 798117e..795fe0a 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
index 941457e..cb39e0e 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
index 7ae7f01..1eb7dbe 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
index efbded1..cd796e4 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 efbded1..cd796e4 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 f53d00e..40fa8f5 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
index 9b41231..a226b63 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
index 8eba88f..ec37507 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
index 8eba88f..ec37507 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv.xml b/tests/sexpr2xmldata/sexpr2xml-fv.xml
index 8eba88f..ec37507 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
b/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
index 89dd87f..fb06652 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' 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 dbdacf9..58b1b4c 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
index c415aab..44f5b51 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' 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 e8b1cd5..2b1e293 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' heads='1' primary='yes'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml
b/tests/sexpr2xmldata/sexpr2xml-vif-rate.xml
index 1e9d60b..0279419 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' 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 3d4868c..92efc4b 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' 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 402f479..fb28fb6 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' 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 686a409..df7b02c 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' 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 686a409..df7b02c 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' 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 686a409..df7b02c 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' heads='1' primary='yes'/>
diff --git a/tests/xlconfigdata/test-fullvirt-multiusb.xml
b/tests/xlconfigdata/test-fullvirt-multiusb.xml
index 5ec72c4..03ed011 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' heads='1' primary='yes'/>
diff --git a/tests/xlconfigdata/test-fullvirt-nohap.xml
b/tests/xlconfigdata/test-fullvirt-nohap.xml
index a997c7a..d1e7c14 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' heads='1' primary='yes'/>
diff --git a/tests/xlconfigdata/test-new-disk.xml b/tests/xlconfigdata/test-new-disk.xml
index 3d4868c..92efc4b 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' heads='1' primary='yes'/>
diff --git a/tests/xlconfigdata/test-rbd-multihost-noauth.xml
b/tests/xlconfigdata/test-rbd-multihost-noauth.xml
index f8f663f..c838dd6 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' heads='1' primary='yes'/>
diff --git a/tests/xlconfigdata/test-spice-features.xml
b/tests/xlconfigdata/test-spice-features.xml
index f9eb857..03096fb 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 fc2fa3f..1b19ebe 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 0e13f2e..ec97208 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-escape-paths.xml
b/tests/xmconfigdata/test-escape-paths.xml
index 6373fdf..1c9404d 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 6f4dae6..4eb2087 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-force-hpet.xml
b/tests/xmconfigdata/test-fullvirt-force-hpet.xml
index 6f4dae6..4eb2087 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-force-nohpet.xml
b/tests/xmconfigdata/test-fullvirt-force-nohpet.xml
index 6015405..194b49c 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-localtime.xml
b/tests/xmconfigdata/test-fullvirt-localtime.xml
index 5f81e25..f03aded 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-net-netfront.xml
b/tests/xmconfigdata/test-fullvirt-net-netfront.xml
index cb0615b..7d3f759 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-new-cdrom.xml
b/tests/xmconfigdata/test-fullvirt-new-cdrom.xml
index d29892e..8837849 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-nohap.xml
b/tests/xmconfigdata/test-fullvirt-nohap.xml
index f38366c..7f871d0 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml
b/tests/xmconfigdata/test-fullvirt-parallel-tcp.xml
index 3269aee..8fea426 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' 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 a20d6c8..5fb2c56 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' 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 8344da3..8a0cca4 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-file.xml
b/tests/xmconfigdata/test-fullvirt-serial-file.xml
index b9439d7..cb56f7e 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-null.xml
b/tests/xmconfigdata/test-fullvirt-serial-null.xml
index 6e8196b..777d94f 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-pipe.xml
b/tests/xmconfigdata/test-fullvirt-serial-pipe.xml
index da0c9bd..694d2cb 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-pty.xml
b/tests/xmconfigdata/test-fullvirt-serial-pty.xml
index acff588..3bbf9c2 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-stdio.xml
b/tests/xmconfigdata/test-fullvirt-serial-stdio.xml
index 6909053..47bd772 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' 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 a3fd449..2f6ae43 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-tcp.xml
b/tests/xmconfigdata/test-fullvirt-serial-tcp.xml
index 9dba76d..1a09cf5 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-udp.xml
b/tests/xmconfigdata/test-fullvirt-serial-udp.xml
index 3577f92..3bfd659 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-serial-unix.xml
b/tests/xmconfigdata/test-fullvirt-serial-unix.xml
index 919108b..f98a55d 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-sound.xml
b/tests/xmconfigdata/test-fullvirt-sound.xml
index 0e85953..ae9ebb5 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 8eb5aa5..94febd9 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-usbtablet.xml
b/tests/xmconfigdata/test-fullvirt-usbtablet.xml
index dcdd951..ab07741 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-fullvirt-utc.xml
b/tests/xmconfigdata/test-fullvirt-utc.xml
index d29892e..8837849 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-no-source-cdrom.xml
b/tests/xmconfigdata/test-no-source-cdrom.xml
index 61cfb75..464ee10 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-paravirt-net-e1000.xml
b/tests/xmconfigdata/test-paravirt-net-e1000.xml
index ad44d11..c4f59eb 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-paravirt-net-vifname.xml
b/tests/xmconfigdata/test-paravirt-net-vifname.xml
index e94b685..d01fed9 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' 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 3ca3023..886b0fd 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-paravirt-new-pvfb.xml
b/tests/xmconfigdata/test-paravirt-new-pvfb.xml
index d97799a..2830d2e 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' heads='1' primary='yes'/>
diff --git a/tests/xmconfigdata/test-pci-devs.xml b/tests/xmconfigdata/test-pci-devs.xml
index 3bc263f..3ccac93 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' heads='1' primary='yes'/>
--
2.8.2