[virt-tools-list] [virt-viewer] ovirt: Set host subject if needed
Christophe Fergeau
cfergeau at redhat.com
Tue Jun 11 14:15:14 UTC 2013
For some VMs, setting host subject on SpiceSession is needed to
be able to connect to it using SPICE/SSL. Until recently, this
was not exposed in oVirt REST API/libgovirt. Since
oVirt 3.2/libgovirt 0.1.0, the host subject is available, this
patch makes use of it.
This should fix connection to oVirt VMs that were migrated to a
different host than the one they were started on.
---
configure.ac | 2 +-
src/remote-viewer.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index c7fb5c8..4cf6a60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,7 +178,7 @@ AC_ARG_WITH([ovirt],
AS_HELP_STRING([--without-ovirt], [Ignore presence of librest and disable oVirt support]))
AS_IF([test "x$with_ovirt" != "xno"],
- [PKG_CHECK_MODULES([OVIRT], [govirt-1.0],
+ [PKG_CHECK_MODULES([OVIRT], [govirt-1.0 >= 0.1.0],
[have_ovirt=yes], [have_ovirt=no])],
[have_ovirt=no])
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 2bb4192..d0e70eb 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -730,6 +730,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
gchar *gtlsport = NULL;
gchar *ghost = NULL;
gchar *ticket = NULL;
+ gchar *host_subject = NULL;
g_return_val_if_fail(VIRT_VIEWER_IS_APP(app), FALSE);
@@ -777,6 +778,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
"port", &port,
"secure-port", &secure_port,
"ticket", &ticket,
+ "host-subject", &host_subject,
NULL);
gport = g_strdup_printf("%d", port);
gtlsport = g_strdup_printf("%d", secure_port);
@@ -806,6 +808,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
g_object_set(G_OBJECT(session),
"ca", ca_cert,
"password", ticket,
+ "cert-subject", host_subject,
NULL);
g_byte_array_unref(ca_cert);
}
@@ -820,6 +823,7 @@ error:
g_free(gport);
g_free(gtlsport);
g_free(ghost);
+ g_free(host_subject);
if (error != NULL)
g_error_free(error);
--
1.8.2.1
More information about the virt-tools-list
mailing list