From 0fceae5b08888ae04d0f984aaa2583ca39756880 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Thu, 3 Oct 2019 15:30:46 -0300 Subject: [PATCH] vm-display: Add support for parsing certificate data Certificate data is stored as GByteArray, thus requiring support for G_TYPE_BYTE_ARRAY in ovirt-utils. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1402909 Signed-off-by: Eduardo Lima (Etrunko) --- govirt/ovirt-utils.c | 5 +++++ govirt/ovirt-vm-display.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/govirt/ovirt-utils.c b/govirt/ovirt-utils.c index 56ce2e1..7789296 100644 --- a/govirt/ovirt-utils.c +++ b/govirt/ovirt-utils.c @@ -181,6 +181,7 @@ _set_property_value_from_type(GValue *value, const char *value_str; GType type = prop->value_type; + /* These types do not require a value associated */ if (g_type_is_a(type, OVIRT_TYPE_RESOURCE)) { OvirtResource *resource_value = ovirt_resource_new_from_xml(type, node, NULL); g_value_set_object(value, resource_value); @@ -210,6 +211,10 @@ _set_property_value_from_type(GValue *value, int enum_value = ovirt_utils_genum_get_value(type, value_str, enum_prop->default_value); g_value_set_enum(value, enum_value); goto end; + } else if (g_type_is_a(type, G_TYPE_BYTE_ARRAY)) { + GByteArray *array = g_byte_array_new_take((guchar *)g_strdup(value_str), strlen(value_str)); + g_value_take_boxed(value, array); + goto end; } ret = _set_property_value_from_basic_type(value, type, value_str); diff --git a/govirt/ovirt-vm-display.c b/govirt/ovirt-vm-display.c index ebb04c2..a8a946a 100644 --- a/govirt/ovirt-vm-display.c +++ b/govirt/ovirt-vm-display.c @@ -336,6 +336,9 @@ static gboolean ovirt_vm_display_set_from_xml(OvirtVmDisplay *display, RestXmlNo { .prop_name = "proxy-url", .xml_path = "proxy", }, + { .prop_name = "ca-cert", + .xml_path = "certificate/content", + }, { NULL, }, }; -- 2.21.0