Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_domain.c | 12 +++++++++---
.../qemuxml2xmlout-graphics-vnc-autosocket.xml | 4 +++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0cec340..65dfa37 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1995,7 +1995,7 @@ qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr
qemuCaps)
}
-static void
+static int
qemuDomainRecheckInternalPaths(virDomainDefPtr def,
virQEMUDriverConfigPtr cfg,
unsigned int flags)
@@ -2008,12 +2008,17 @@ qemuDomainRecheckInternalPaths(virDomainDefPtr def,
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
graphics->data.vnc.socket &&
STRPREFIX(graphics->data.vnc.socket, cfg->libDir)) {
- if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
+ if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) {
VIR_FREE(graphics->data.vnc.socket);
+ if (virDomainGraphicsListenAppendAddress(graphics, NULL) < 0)
+ return -1;
+ }
else
graphics->data.vnc.socketAutogenerated = true;
}
}
+
+ return 0;
}
@@ -2066,7 +2071,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def, qemuCaps);
- qemuDomainRecheckInternalPaths(def, cfg, parseFlags);
+ if (qemuDomainRecheckInternalPaths(def, cfg, parseFlags) < 0)
+ goto cleanup;
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
index 7440533..5718041 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
@@ -29,7 +29,9 @@
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
- <graphics type='vnc' port='-1' autoport='yes'/>
+ <graphics type='vnc' port='-1' autoport='yes'>
+ <listen type='address'/>
+ </graphics>
<video>
<model type='cirrus' vram='16384' heads='1'
primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
--
2.8.2