[virt-tools-list] [virt-viewer] ovirt: Take into account SPICE proxy

Christophe Fergeau cfergeau at redhat.com
Thu Jan 22 16:24:13 UTC 2015


VMs managed by oVirt can be hidden behind a proxy. This commit allows
remote-viewer to make use of this information when it's available
A recent oVirt instance is needed so that it's available through the
REST API, as well as libgovirt 0.3.3 or newer.
With older oVirt/libgovirt versions, the worst that can happen is a
runtime warning in the console, and an impossibility to connect to VMs
behind a proxy.
---
 src/remote-viewer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 818c421..e7ce1a4 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -826,6 +826,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err)
     gboolean success = FALSE;
     guint port;
     guint secure_port;
+    char *proxy_url = NULL;
     OvirtVmDisplayType type;
     const char *session_type;
 
@@ -902,6 +903,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err)
                  "secure-port", &secure_port,
                  "ticket", &ticket,
                  "host-subject", &host_subject,
+                 "proxy-url", &proxy_url,
                  NULL);
     gport = g_strdup_printf("%d", port);
     gtlsport = g_strdup_printf("%d", secure_port);
@@ -940,6 +942,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err)
         g_object_set(G_OBJECT(session),
                      "password", ticket,
                      "cert-subject", host_subject,
+                     "proxy", proxy_url,
                      NULL);
         g_object_get(G_OBJECT(proxy), "ca-cert", &ca_cert, NULL);
         if (ca_cert != NULL) {
@@ -963,6 +966,7 @@ error:
     g_free(ghost);
     g_free(host_subject);
     g_free(guid);
+    g_free(proxy_url);
 
     if (error != NULL)
         g_propagate_error(err, error);
-- 
2.1.0




More information about the virt-tools-list mailing list