[virt-tools-list] [PATCH virt-viewer 8/9] virt-viewer: allow connection to unix socket only server

Marc-André Lureau marcandre.lureau at gmail.com
Thu Nov 13 17:20:44 UTC 2014


Even when the server doesn't provide a display connection address,
virt-viewer is able to connect to guest with libvirt attach.
---
 src/virt-viewer.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 517aab8..e294c34 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -378,17 +378,18 @@ virt_viewer_extract_connect_info(VirtViewer *self,
         ghost = virt_viewer_extract_xpath_string(xmldesc, xpath);
     } else {
         xpath = g_strdup_printf("string(/domain/devices/graphics[@type='%s']/@socket)", type);
-        if ((unixsock = virt_viewer_extract_xpath_string(xmldesc, xpath)) == NULL) {
-            virt_viewer_app_simple_message_dialog(app, _("Cannot determine the graphic address for the guest %s"),
-                                                  priv->domkey);
-            goto cleanup;
-        }
+        unixsock = virt_viewer_extract_xpath_string(xmldesc, xpath);
     }
 
     if (ghost && gport)
         g_debug("Guest graphics address is %s:%s", ghost, gport);
     else if (unixsock)
         g_debug("Guest graphics address is %s", unixsock);
+    else {
+        g_debug("Using direct libvirt connection");
+        retval = TRUE;
+        goto cleanup;
+    }
 
     uri = virConnectGetURI(priv->conn);
     if (virt_viewer_util_extract_host(uri, NULL, &host, &transport, &user, &port) < 0) {
-- 
1.9.3




More information about the virt-tools-list mailing list