[virt-tools-list] [PATCH virt-viewer 9/9] Report error on attach-only display

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


Provide error details if the display can only be access through libvirt
--attach method.
---
 src/virt-viewer-app.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index e2d9636..5d5c217 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1201,12 +1201,15 @@ virt_viewer_app_default_activate(VirtViewerApp *self, GError **error)
     } else if (priv->guri) {
         virt_viewer_app_trace(self, "Opening connection to display at %s", priv->guri);
         return virt_viewer_session_open_uri(VIRT_VIEWER_SESSION(priv->session), priv->guri, error);
-    } else {
+    } else if (priv->ghost) {
         virt_viewer_app_trace(self, "Opening direct TCP connection to display at %s:%s:%s",
                               priv->ghost, priv->gport, priv->gtlsport ? priv->gtlsport : "-1");
         return virt_viewer_session_open_host(VIRT_VIEWER_SESSION(priv->session),
                                              priv->ghost, priv->gport, priv->gtlsport);
-    }
+    } else {
+        g_set_error_literal(error, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,
+                            _("Display can only be attached through libvirt with --attach"));
+   }
 
     return FALSE;
 }
-- 
1.9.3




More information about the virt-tools-list mailing list