[virt-viewer][PATCH 2/5 v2] virt-viewer: Add a GError arg to update_display()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is part of a small re-factoring that will have all connection
errors, when we won't be able to connect regardless of what changes on
the remote host, being treated by virt_viewer_app_initial_connect(),
avoiding weird behaviors as we have nowadays (like more than one error
dialog being shown or having the virt-viewer waiting forever for a guest
that will never show up).

Related: rhbz#1085216
---
 src/virt-viewer.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 8858c16..962bdd9 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -520,7 +520,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
 }
 
 static gboolean
-virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
+virt_viewer_update_display(VirtViewer *self, virDomainPtr dom, GError **error)
 {
     VirtViewerPrivate *priv = self->priv;
     VirtViewerApp *app = VIRT_VIEWER_APP(self);
@@ -536,7 +536,7 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
     g_object_set(app, "guest-name", virDomainGetName(dom), NULL);
 
     if (!virt_viewer_app_has_session(app)) {
-        if (!virt_viewer_extract_connect_info(self, dom, NULL))
+        if (!virt_viewer_extract_connect_info(self, dom, error))
             return FALSE;
     }
 
@@ -611,7 +611,10 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
         break;
 
     case VIR_DOMAIN_EVENT_STARTED:
-        virt_viewer_update_display(self, dom);
+        virt_viewer_update_display(self, dom, &error);
+        if (error)
+            g_clear_error(&error);
+
         virt_viewer_app_activate(app, &error);
         if (error) {
             /* we may want to consolidate error reporting in
@@ -778,7 +781,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
         goto wait;
     }
 
-    if (!virt_viewer_update_display(self, dom))
+    if (!virt_viewer_update_display(self, dom, &err))
         goto wait;
 
     ret = VIRT_VIEWER_APP_CLASS(virt_viewer_parent_class)->initial_connect(app, &err);
-- 
2.3.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux