[libvirt] [PATCH] libxl: add default VNC listen address

Jim Fehlig jfehlig at suse.com
Wed May 17 21:38:48 UTC 2017


If a VNC listen address is not specified in domXML, libxl will
default to 127.0.0.1, but this is never reflected in the domXML.
If not specified, set the listen address in virDomainGraphicsDef
struct to the libxl default when creating the frame buffer device.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334562
Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---
 src/libxl/libxl_conf.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 56bc09719..0c5d7a700 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1227,12 +1227,16 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
             }
             x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN;
 
-            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 = virDomainGraphicsGetListen(l_vfb, 0))) {
+                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;
+                } else {
+                    if (VIR_STRDUP(glisten->address, "127.0.0.1") < 0)
+                        return -1;
+                }
             }
             if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0)
                 return -1;
-- 
2.11.0




More information about the libvir-list mailing list