[libgovirt] proxy; Don't try to set CA on VMs with no displays



commit 91f1b7611e85995eb550833c79f0592f9f9ff9f4
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed Apr 13 15:29:45 2016 +0200

    proxy; Don't try to set CA on VMs with no displays
    
    In some corner cases (unit tests...), we can have VM resources without
    an associated display. In such cases, do not try to set the display CA
    on the non-existent display.

 govirt/ovirt-proxy.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 9906a7c..fc0273f 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -598,10 +598,17 @@ static void ovirt_proxy_update_vm_display_ca(OvirtProxy *proxy)
         OvirtVmDisplay *display;
 
         g_object_get(G_OBJECT(vm), "display", &display, NULL);
-        g_object_set(G_OBJECT(display),
-                     "ca-cert", proxy->priv->display_ca,
-                     NULL);
-        g_object_unref(display);
+        if (display != NULL) {
+            g_object_set(G_OBJECT(display),
+                         "ca-cert", proxy->priv->display_ca,
+                         NULL);
+            g_object_unref(display);
+        } else {
+            char *name;
+            g_object_get(vm, "name", &name, NULL);
+            g_debug("Not setting display CA for '%s' since it has no display",  name);
+            g_free(name);
+        }
     }
     g_list_free(vms);
 }


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