[virt-tools-list] [virt-viewer] Only wait for shutoff domains when --wait is used

Christophe Fergeau cfergeau at redhat.com
Tue Aug 5 09:40:49 UTC 2014


--wait is documented as:
     -w, --wait
         Wait for the domain to start up before attempting to connect to the
         console

However, running 'virt-viewer non-running-domain' currently shows a
"Waiting for guest domain to start" regardless of the --wait argument.
This commit makes virt-viewer error out on non-running domains when
--wait was not passed on the command line.
---
 src/virt-viewer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 8a1d8c5..22615cc 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -570,7 +570,14 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
     }
 
     if (info.state == VIR_DOMAIN_SHUTOFF) {
-        virt_viewer_app_show_status(app, _("Waiting for guest domain to start"));
+        if (priv->waitvm)
+            virt_viewer_app_show_status(app, _("Waiting for guest domain to start"));
+        else {
+            virt_viewer_app_simple_message_dialog(app, _("Guest domain %s is not running"),
+                                                  priv->domkey);
+            g_debug("Domain %s is not running", priv->domkey);
+            goto cleanup;
+        }
     } else {
         ret = virt_viewer_update_display(self, dom);
         if (ret)
-- 
1.9.3




More information about the virt-tools-list mailing list