Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/formatdomain.html.in | 2 +-
src/conf/domain_conf.c | 33 +++--
src/qemu/qemu_command.c | 134 +++++++++++----------
src/qemu/qemu_migration.c | 41 ++++---
...muxml2argv-graphics-spice-auto-unix-socket.args | 21 ++++
...emuxml2argv-graphics-spice-auto-unix-socket.xml | 30 +++++
.../qemuxml2argv-graphics-spice-unix-socket.args | 20 +++
.../qemuxml2argv-graphics-spice-unix-socket.xml | 30 +++++
tests/qemuxml2argvtest.c | 6 +
...uxml2xmlout-graphics-spice-auto-unix-socket.xml | 35 ++++++
.../qemuxml2xmlout-graphics-spice-unix-socket.xml | 35 ++++++
tests/qemuxml2xmltest.c | 2 +
12 files changed, 299 insertions(+), 90 deletions(-)
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.xml
create mode 100644
tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-unix-socket.xml
create mode 100644
tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-unix-socket.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c5cf107..08e45e2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5353,7 +5353,7 @@ qemu-kvm -net nic,model=? /dev/null
This listen type tells a graphics server to listen on unix socket.
Attribute <code>socket</code> contains a path to unix socket. If
this
attribute is omitted libvirt will generate this path for you.
- Supported by graphics type <code>vnc</code>.
+ Supported by graphics type <code>vnc</code> and
<code>spice</code>.
</p>
<p>
For <code>vnc</code> graphics be backward compatible
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5075fb5..e76c71d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10809,7 +10809,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr
def,
}
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("listen type 'socket' is not available for "
"graphics type '%s'"), graphicsType);
@@ -21584,19 +21585,29 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
- if (glisten->port)
- virBufferAsprintf(buf, " port='%d'",
- glisten->port);
+ switch (glisten->type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ if (glisten->port)
+ virBufferAsprintf(buf, " port='%d'",
+ glisten->port);
- if (glisten->tlsPort)
- virBufferAsprintf(buf, " tlsPort='%d'",
- glisten->tlsPort);
+ if (glisten->tlsPort)
+ virBufferAsprintf(buf, " tlsPort='%d'",
+ glisten->tlsPort);
- virBufferAsprintf(buf, " autoport='%s'",
- glisten->autoport ? "yes" : "no");
+ virBufferAsprintf(buf, " autoport='%s'",
+ glisten->autoport ? "yes" : "no");
- if (glisten->address && !glisten->fromConfig)
- virBufferAsprintf(buf, " listen='%s'",
glisten->address);
+ if (glisten->address && !glisten->fromConfig)
+ virBufferAsprintf(buf, " listen='%s'",
glisten->address);
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
+ }
if (def->data.spice.keymap)
virBufferEscapeString(buf, " keymap='%s'",
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 842679f..0664473 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7483,6 +7483,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
int ret;
int defaultMode = graphics->data.spice.defaultMode;
size_t i;
+ bool useTLS = false;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -7496,69 +7497,92 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
goto error;
}
- if (glisten->port > 0)
- virBufferAsprintf(&opt, "port=%u,", glisten->port);
-
- if (glisten->tlsPort > 0) {
- if (!cfg->spiceTLS) {
+ switch (glisten->type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE_UNIX)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("spice TLS port set in XML configuration,"
- " but TLS is disabled in qemu.conf"));
+ _("unix socket for spice graphics are not supported
"
+ "with this QEMU"));
goto error;
}
- virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort);
- }
+ virBufferAsprintf(&opt, "addr=%s,unix,", glisten->socket);
+ useTLS = cfg->spiceTLS;
+ break;
- if (cfg->spiceSASL) {
- virBufferAddLit(&opt, "sasl,");
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- if (cfg->spiceSASLdir)
- virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
- cfg->spiceSASLdir);
+ if (glisten->port > 0)
+ virBufferAsprintf(&opt, "port=%u,", glisten->port);
- /* TODO: Support ACLs later */
- }
+ if (glisten->tlsPort > 0) {
+ if (!cfg->spiceTLS) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("spice TLS port set in XML configuration,"
+ " but TLS is disabled in qemu.conf"));
+ goto error;
+ }
+ virBufferAsprintf(&opt, "tls-port=%u,", glisten->tlsPort);
+ useTLS = true;
+ }
- if (glisten->port > 0 || glisten->tlsPort > 0) {
+ if (cfg->spiceSASL) {
+ virBufferAddLit(&opt, "sasl,");
- switch (glisten->type) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- listenAddr = glisten->address;
- break;
+ if (cfg->spiceSASLdir)
+ virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
+ cfg->spiceSASLdir);
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- if (!glisten->network)
+ /* TODO: Support ACLs later */
+ }
+
+ if (glisten->port > 0 || glisten->tlsPort > 0) {
+
+ switch (glisten->type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ listenAddr = glisten->address;
break;
- ret = networkGetNetworkAddress(glisten->network, &netAddr);
- if (ret <= -2) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("network-based listen not possible,
"
- "network driver not present"));
- goto error;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ if (!glisten->network)
+ break;
+
+ ret = networkGetNetworkAddress(glisten->network, &netAddr);
+ if (ret <= -2) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("network-based listen not
possible, "
+ "network driver not present"));
+ goto error;
+ }
+ if (ret < 0)
+ goto error;
+
+ listenAddr = netAddr;
+ /* store the address we found in the <graphics> element so it will
+ * show up in status. */
+ if (VIR_STRDUP(glisten->address, listenAddr) < 0)
+ goto error;
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
}
- if (ret < 0)
- goto error;
- listenAddr = netAddr;
- /* store the address we found in the <graphics> element so it will
- * show up in status. */
- if (VIR_STRDUP(glisten->address, listenAddr) < 0)
- goto error;
- break;
+ if (!listenAddr)
+ listenAddr = cfg->spiceListen;
+ if (listenAddr)
+ virBufferAsprintf(&opt, "addr=%s,", listenAddr);
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
- break;
+ VIR_FREE(netAddr);
}
- if (!listenAddr)
- listenAddr = cfg->spiceListen;
- if (listenAddr)
- virBufferAsprintf(&opt, "addr=%s,", listenAddr);
+ break;
- VIR_FREE(netAddr);
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
}
if (graphics->data.spice.mousemode) {
@@ -7581,7 +7605,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
!cfg->spicePassword)
virBufferAddLit(&opt, "disable-ticketing,");
- if (glisten->tlsPort > 0)
+ if (useTLS)
virBufferAsprintf(&opt, "x509-dir=%s,",
cfg->spiceTLSx509certdir);
switch (defaultMode) {
@@ -7599,7 +7623,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 (glisten->tlsPort <= 0) {
+ if (!useTLS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("spice secure channels set in XML configuration,
"
"but TLS port is not provided"));
@@ -7610,12 +7634,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
break;
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
- if (glisten->port <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("spice insecure channels set in XML "
- "configuration, but plain port is not
provided"));
- goto error;
- }
virBufferAsprintf(&opt, "plaintext-channel=%s,",
virDomainGraphicsSpiceChannelNameTypeToString(i));
break;
@@ -7623,7 +7641,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
switch (defaultMode) {
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
- if (glisten->tlsPort <= 0) {
+ if (!useTLS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("spice defaultMode secure requested in XML
"
"configuration but TLS port not
provided"));
@@ -7632,12 +7650,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
break;
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
- if (glisten->port <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("spice defaultMode insecure requested in XML
"
- "configuration but plain port not
provided"));
- goto error;
- }
break;
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6440cf1..26c1201 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -315,23 +315,16 @@ qemuDomainExtractTLSSubject(const char *certdir)
static qemuMigrationCookieGraphicsPtr
qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
- virDomainGraphicsDefPtr def)
+ virDomainGraphicsListenDefPtr glisten)
{
qemuMigrationCookieGraphicsPtr mig = NULL;
const char *listenAddr;
- virDomainGraphicsListenDefPtr glisten = virDomainGraphicsGetListen(def, 0);
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
if (VIR_ALLOC(mig) < 0)
goto error;
- if (!glisten) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("missing listen element"));
- goto error;
- }
-
- mig->type = def->type;
+ mig->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE;
mig->port = glisten->port;
if (cfg->spiceTLS)
mig->tlsPort = glisten->tlsPort;
@@ -458,14 +451,28 @@ qemuMigrationCookieAddGraphics(qemuMigrationCookiePtr mig,
}
for (i = 0; i < dom->def->ngraphics; i++) {
- if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- if (!(mig->graphics =
- qemuMigrationCookieGraphicsSpiceAlloc(driver,
- dom->def->graphics[i])))
- return -1;
- mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
- break;
- }
+ if (dom->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virDomainGraphicsListenDefPtr glisten =
+ virDomainGraphicsGetListen(dom->def->graphics[i], 0);
+
+ if (!glisten) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("missing listen element"));
+ return -1;
+ }
+
+ /* Skip all listen types different than address or network because
+ * only those two are currently supported. */
+ if (glisten->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS &&
+ glisten->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK)
+ break;
+
+ if (!(mig->graphics =
+ qemuMigrationCookieGraphicsSpiceAlloc(driver, glisten)))
+ return -1;
+ mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
+ break;
+ }
}
return 0;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.args
new file mode 100644
index 0000000..8cc099f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-spice addr=/tmp/lib/domain--1-QEMUGuest1/spice.sock,unix,\
+x509-dir=/etc/pki/libvirt-spice \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.xml
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.xml
new file mode 100644
index 0000000..acb325a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-unix-socket.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='spice'>
+ <listen type='socket'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.args
new file mode 100644
index 0000000..ecaad91
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.args
@@ -0,0 +1,20 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-spice addr=/tmp/spice.sock,unix,x509-dir=/etc/pki/libvirt-spice \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.xml
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.xml
new file mode 100644
index 0000000..13bbef1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-unix-socket.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='spice'>
+ <listen type='socket' socket='/tmp/spice.sock'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d2517ad..bd31ec5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -941,6 +941,12 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL_VGA,
QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
+ DO_TEST("graphics-spice-unix-socket",
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_SPICE_UNIX);
+ DO_TEST("graphics-spice-auto-unix-socket",
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_SPICE_UNIX);
DO_TEST("input-usbmouse", NONE);
DO_TEST("input-usbtablet", NONE);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-unix-socket.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-unix-socket.xml
new file mode 100644
index 0000000..931ec0f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-unix-socket.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='spice'>
+ <listen type='socket'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'
primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-unix-socket.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-unix-socket.xml
new file mode 100644
index 0000000..dd672ed
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-unix-socket.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='spice'>
+ <listen type='socket' socket='/tmp/spice.sock'/>
+ </graphics>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'
primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index fa343d2..ca5ffa6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -440,6 +440,8 @@ mymain(void)
DO_TEST("graphics-spice");
DO_TEST("graphics-spice-compression");
DO_TEST("graphics-spice-qxl-vga");
+ DO_TEST("graphics-spice-unix-socket");
+ DO_TEST("graphics-spice-auto-unix-socket");
DO_TEST("nographics-vga");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
--
2.8.2