|
|
546e1e |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
546e1e |
From: Christophe Fergeau <cfergeau@redhat.com>
|
|
|
546e1e |
Date: Mon, 11 Sep 2017 14:59:08 +0200
|
|
|
546e1e |
Subject: [PATCH] resource: Update xml node in
|
|
|
546e1e |
ovirt_resource_init_from_xml_real
|
|
|
546e1e |
|
|
|
546e1e |
ovirt_resource_init_from_xml_real is called indirectly when
|
|
|
546e1e |
ovirt_resource_refresh() is used. For some reason, it updates
|
|
|
546e1e |
the various OvirtResource properties with the new XML node content, but
|
|
|
546e1e |
OvirtResource::xml-node is not set to be the new node.
|
|
|
546e1e |
This commit fixes this inconsistent state by making sure
|
|
|
546e1e |
OvirtResource::xml-node is changed to point to the new node.
|
|
|
546e1e |
---
|
|
|
546e1e |
govirt/ovirt-resource.c | 19 +++++++++++++------
|
|
|
546e1e |
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
|
546e1e |
|
|
|
546e1e |
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
|
|
|
546e1e |
index ad5e8ca..1984b1d 100644
|
|
|
546e1e |
--- a/govirt/ovirt-resource.c
|
|
|
546e1e |
+++ b/govirt/ovirt-resource.c
|
|
|
546e1e |
@@ -97,6 +97,15 @@ static void ovirt_resource_get_property(GObject *object,
|
|
|
546e1e |
}
|
|
|
546e1e |
}
|
|
|
546e1e |
|
|
|
546e1e |
+static void ovirt_resource_set_xml_node(OvirtResource *resource,
|
|
|
546e1e |
+ RestXmlNode *node)
|
|
|
546e1e |
+{
|
|
|
546e1e |
+ g_clear_pointer(&resource->priv->xml, &rest_xml_node_unref);
|
|
|
546e1e |
+ if (node != NULL) {
|
|
|
546e1e |
+ resource->priv->xml = rest_xml_node_ref(node);
|
|
|
546e1e |
+ }
|
|
|
546e1e |
+}
|
|
|
546e1e |
+
|
|
|
546e1e |
static void ovirt_resource_set_property(GObject *object,
|
|
|
546e1e |
guint prop_id,
|
|
|
546e1e |
const GValue *value,
|
|
|
546e1e |
@@ -121,13 +130,10 @@ static void ovirt_resource_set_property(GObject *object,
|
|
|
546e1e |
g_free(resource->priv->description);
|
|
|
546e1e |
resource->priv->description = g_value_dup_string(value);
|
|
|
546e1e |
break;
|
|
|
546e1e |
- case PROP_XML_NODE: {
|
|
|
546e1e |
- if (resource->priv->xml != NULL) {
|
|
|
546e1e |
- g_boxed_free(REST_TYPE_XML_NODE, resource->priv->xml);
|
|
|
546e1e |
- }
|
|
|
546e1e |
- resource->priv->xml = g_value_dup_boxed(value);
|
|
|
546e1e |
+ case PROP_XML_NODE:
|
|
|
546e1e |
+ ovirt_resource_set_xml_node(OVIRT_RESOURCE(object),
|
|
|
546e1e |
+ g_value_get_boxed(value));
|
|
|
546e1e |
break;
|
|
|
546e1e |
- }
|
|
|
546e1e |
default:
|
|
|
546e1e |
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
546e1e |
}
|
|
|
546e1e |
@@ -438,6 +444,7 @@ static gboolean ovirt_resource_init_from_xml_real(OvirtResource *resource,
|
|
|
546e1e |
return FALSE;
|
|
|
546e1e |
}
|
|
|
546e1e |
|
|
|
546e1e |
+ ovirt_resource_set_xml_node(resource, node);
|
|
|
546e1e |
g_object_set(G_OBJECT(resource), "guid", guid, "href", href, NULL);
|
|
|
546e1e |
|
|
|
546e1e |
ovirt_resource_set_name_from_xml(resource, node);
|