[ovirt-devel] spice proxy support in govirt
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 15 13:04:37 UTC 2015
Hey,
On Sun, Dec 28, 2014 at 02:34:10AM -0600, i iordanov wrote:
> Hello,
>
> My apologies for the partial mail sent out, I hit a strange key
> combination by mistake :). As I was saying, this bug got closed not
> long ago:
Sorry for the late reply, was on holidays for a while, came back just now :)
> I looked into the latest code of govirt, and I don't see support for
> SpiceProxy in there. Would you be so kind as to add this feature?
I quickly cooked/compile-tested the attached patch, if you have time to
test it, let me know how it works, otherwise I'll get back to that later
(need to get lot of email under control first ;)
Christophe
-------------- next part --------------
diff --git a/govirt/ovirt-vm-display.c b/govirt/ovirt-vm-display.c
index a8a0942..0a8adc6 100644
--- a/govirt/ovirt-vm-display.c
+++ b/govirt/ovirt-vm-display.c
@@ -39,6 +39,7 @@ struct _OvirtVmDisplayPrivate {
char *host_subject;
gboolean smartcard;
gboolean allow_override;
+ char *proxy_url;
};
G_DEFINE_TYPE(OvirtVmDisplay, ovirt_vm_display, G_TYPE_OBJECT);
@@ -55,6 +56,7 @@ enum {
PROP_HOST_SUBJECT,
PROP_SMARTCARD,
PROP_ALLOW_OVERRIDE,
+ PROP_PROXY_URL,
};
static void ovirt_vm_display_get_property(GObject *object,
@@ -95,6 +97,9 @@ static void ovirt_vm_display_get_property(GObject *object,
case PROP_ALLOW_OVERRIDE:
g_value_set_boolean(value, display->priv->allow_override);
break;
+ case PROP_PROXY_URL:
+ g_value_set_string(value, display->priv->proxy_url);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -141,6 +146,9 @@ static void ovirt_vm_display_set_property(GObject *object,
case PROP_ALLOW_OVERRIDE:
display->priv->allow_override = g_value_get_boolean(value);
break;
+ case PROP_PROXY_URL:
+ g_free(display->priv->proxy_url);
+ display->priv->proxy_url = g_value_dup_string(value);
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -153,6 +161,7 @@ static void ovirt_vm_display_finalize(GObject *object)
g_free(display->priv->address);
g_free(display->priv->ticket);
g_free(display->priv->host_subject);
+ g_free(display->priv->proxy_url);
G_OBJECT_CLASS(ovirt_vm_display_parent_class)->finalize(object);
}
@@ -252,6 +261,14 @@ static void ovirt_vm_display_class_init(OvirtVmDisplayClass *klass)
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property(object_class,
+ PROP_PROXY_URL,
+ g_param_spec_string("proxy-url",
+ "Proxy URL",
+ "URL of the proxy to use to access the VM",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
static void ovirt_vm_display_init(G_GNUC_UNUSED OvirtVmDisplay *display)
diff --git a/govirt/ovirt-vm-xml.c b/govirt/ovirt-vm-xml.c
index 7790887..22d50af 100644
--- a/govirt/ovirt-vm-xml.c
+++ b/govirt/ovirt-vm-xml.c
@@ -44,6 +44,7 @@ static gboolean vm_set_display_from_xml(OvirtVm *vm,
const char *certificate_key = g_intern_string("certificate");
const char *smartcard_key = g_intern_string("smartcard_enabled");
const char *allow_override_key = g_intern_string("allow_override");
+ const char *proxy_key = g_intern_string("proxy");
if (root == NULL) {
return FALSE;
@@ -120,6 +121,11 @@ static gboolean vm_set_display_from_xml(OvirtVm *vm,
}
}
+ node = g_hash_table_lookup(root->children, proxy_key);
+ if (node != NULL) {
+ g_object_set(G_OBJECT(display), "proxy-url", node->content, NULL);
+ }
+
/* FIXME: this overrides the ticket/expiry which may
* already be set
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20150115/36b5451d/attachment.sig>
More information about the Devel
mailing list