diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2016-05-09 15:50:54 +0200 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2016-05-17 10:41:45 +0200 |
commit | b33c14b342e5c2abeeee91c852ef2032327cb355 (patch) | |
tree | 97ba3c9c11d1833dd396f23a465940cbe6cd8af4 /src | |
parent | 38c9973f36ce962079fd2f717ad358fe82d246f4 (diff) | |
download | libvirt-b33c14b342e5c2abeeee91c852ef2032327cb355.tar.gz |
graphics: make address attribute for listen type='address' optional
We support omitting listen attribute of graphics element so we should
also support omitting address attribute of listen element. This patch
also updates libvirt to always add a listen element into domain XML
except for VNC graphics if socket attribute is specified.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/conf/domain_conf.c | 3 | ||||
-rw-r--r-- | src/qemu/qemu_process.c | 16 | ||||
-rw-r--r-- | src/vbox/vbox_common.c | 6 | ||||
-rw-r--r-- | src/vmx/vmx.c | 8 | ||||
-rw-r--r-- | src/xenconfig/xen_common.c | 12 | ||||
-rw-r--r-- | src/xenconfig/xen_sxpr.c | 6 | ||||
-rw-r--r-- | src/xenconfig/xen_xl.c | 3 |
7 files changed, 29 insertions, 25 deletions
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b6f02677e7..0967e32366 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10800,8 +10800,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDefPtr def, if (STREQ_NULLABLE(newListen.address, "")) VIR_FREE(newListen.address); - if (newListen.address && - VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) + if (VIR_APPEND_ELEMENT(def->listens, def->nListens, newListen) < 0) goto error; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index eddf3a7b09..f4bf6c1663 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4394,7 +4394,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); bool allocate = !(flags & VIR_QEMU_PROCESS_START_PRETEND); - size_t i; + size_t i, j; int ret = -1; if (allocate && qemuProcessGraphicsReservePorts(driver, vm) < 0) @@ -4426,12 +4426,16 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver, break; } - if (graphics->nListens == 0 && listenAddr) { - if (virDomainGraphicsListenAppendAddress(graphics, - listenAddr) < 0) - goto cleanup; + for (j = 0; j < graphics->nListens; j++) { + virDomainGraphicsListenDefPtr glisten = &graphics->listens[j]; - graphics->listens[0].fromConfig = true; + if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS && + !glisten->address && listenAddr) { + if (VIR_STRDUP(glisten->address, listenAddr) < 0) + goto cleanup; + + glisten->fromConfig = true; + } } } diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index ed22724779..13c3fec98d 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3385,8 +3385,10 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VBOX_UTF16_FREE(netAddressUtf16); } - if (STRNEQ_NULLABLE(netAddressUtf8, "") && - virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8) < 0) + if (netAddressUtf8 && STREQ(netAddressUtf8, "")) + VBOX_UTF8_FREE(netAddressUtf8); + + if (virDomainGraphicsListenAppendAddress(graphics, netAddressUtf8) < 0) goto cleanup; gVBoxAPI.UIVRDxServer.GetAllowMultiConnection(VRDxServer, &allowMultiConnection); diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 5e57c3902e..6505dd789f 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1875,11 +1875,9 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) goto failure; } - if (listenAddr) { - if (virDomainGraphicsListenAppendAddress(*def, listenAddr) < 0) - goto failure; - VIR_FREE(listenAddr); - } + if (virDomainGraphicsListenAppendAddress(*def, listenAddr) < 0) + goto failure; + VIR_FREE(listenAddr); if (port < 0) { VIR_WARN("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' " diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index c6aee69254..c753fa8de0 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -594,8 +594,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (xenConfigCopyStringOpt(conf, "vnclisten", &listenAddr) < 0) goto cleanup; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto cleanup; VIR_FREE(listenAddr); @@ -664,8 +663,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) if (STREQ(key + 10, "1")) graphics->data.vnc.autoport = true; } else if (STRPREFIX(key, "vnclisten=")) { - if (virDomainGraphicsListenAppendAddress(graphics, - key+10) < 0) + if (VIR_STRDUP(listenAddr, key+10) < 0) goto cleanup; } else if (STRPREFIX(key, "vncpasswd=")) { if (VIR_STRDUP(graphics->data.vnc.auth.passwd, key + 10) < 0) @@ -699,6 +697,12 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) nextkey++; key = nextkey; } + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + if (virDomainGraphicsListenAppendAddress(graphics, + listenAddr) < 0) + goto cleanup; + VIR_FREE(listenAddr); + } if (VIR_ALLOC_N(def->graphics, 1) < 0) goto cleanup; def->graphics[0] = graphics; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index d4aa5e99f0..8b5e06326d 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -867,8 +867,7 @@ xenParseSxprGraphicsOld(virDomainDefPtr def, graphics->data.vnc.autoport = true; graphics->data.vnc.port = port; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) @@ -988,8 +987,7 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, port += 5900; graphics->data.vnc.port = port; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto error; if (VIR_STRDUP(graphics->data.vnc.auth.passwd, vncPasswd) < 0) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 889dd400fc..7d41e0504e 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -186,8 +186,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE; if (xenConfigCopyStringOpt(conf, "spicehost", &listenAddr) < 0) goto cleanup; - if (listenAddr && - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0) goto cleanup; VIR_FREE(listenAddr); |