[virt-tools-list] [PATCH virt-viewer] Set guest name at the same time as uuid

Pavel Grunt pgrunt at redhat.com
Mon Jan 2 15:32:31 UTC 2017


Avoid showing the "Unknown" name in the guest detail dialog when
waiting for the domain to be started.
---
 src/virt-viewer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 3a3b64d..1121146 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -601,8 +601,6 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom, GError **error)
     virt_viewer_app_trace(app, "Guest %s is running, determining display",
                           priv->domkey);
 
-    g_object_set(app, "guest-name", virDomainGetName(dom), NULL);
-
     if (virt_viewer_app_has_session(app))
         return TRUE;
 
@@ -801,6 +799,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
     VirtViewer *self = VIRT_VIEWER(app);
     VirtViewerPrivate *priv = self->priv;
     char uuid_string[VIR_UUID_STRING_BUFLEN];
+    const char *guest_name;
     GError *err = NULL;
 
     g_debug("initial connect");
@@ -836,6 +835,10 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
     } else {
         g_object_set(app, "uuid", uuid_string, NULL);
     }
+    guest_name = virDomainGetName(dom);
+    if (guest_name != NULL) {
+        g_object_set(app, "guest-name", guest_name, NULL);
+    }
 
     virt_viewer_app_show_status(app, _("Checking guest domain status"));
     if (virDomainGetInfo(dom, &info) < 0) {
-- 
2.11.0




More information about the virt-tools-list mailing list