diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9e547b43f2..d2cf8d556e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10741,7 +10741,8 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, if (STREQ_NULLABLE(listenAddr, "")) VIR_FREE(listenAddr); - if (address && STRNEQ_NULLABLE(address->address, listenAddr)) { + if (address && listenAddr && + STRNEQ_NULLABLE(address->address, listenAddr)) { virReportError(VIR_ERR_XML_ERROR, _("graphics listen attribute %s must match address " "attribute of first listen element (found %s)"), diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.args new file mode 100644 index 0000000000..f374cff7a0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-vnc '[2001:1:2:3:4:5:1234:1234]:3' \ +-vga cirrus diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.xml new file mode 100644 index 0000000000..f80a010959 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-no-listen-attr.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f1b2a8d9f7..975e3580ce 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -891,6 +891,7 @@ mymain(void) DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC); DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET); DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY); + DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC); driver.config->vncSASL = 1; VIR_FREE(driver.config->vncSASLdir); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml new file mode 100644 index 0000000000..0627bbd1dd --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-no-listen-attr.xml @@ -0,0 +1,41 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + +
+ + +
+ + +
+ + + + + + + +