libgovirt/SOURCES/0030-resource-Fix-ovirt_resource_init_from_xml_real-preco.patch

30 lines
1.1 KiB
Diff
Raw Normal View History

2019-05-07 13:10:27 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
Date: Mon, 11 Sep 2017 15:01:59 +0200
Subject: [PATCH] resource: Fix ovirt_resource_init_from_xml_real precondition
When ovirt_resource_init_from_xml_real is called, the current value of
OvirtResource::xml-node is not very relevant, what matters is whether
the passed in xml node is NULL or not.
This updates the test-govirt test case to call
ovirt_resource_refresh(ovirt_vm_get_cluster()) as this triggers this
precondition failure.
---
govirt/ovirt-resource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index 0f4a129..ad5e8ca 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -422,7 +422,7 @@ static gboolean ovirt_resource_init_from_xml_real(OvirtResource *resource,
*/
is_api = OVIRT_IS_API(resource);
- g_return_val_if_fail(resource->priv->xml != NULL, FALSE);
+ g_return_val_if_fail(node != NULL, FALSE);
guid = rest_xml_node_get_attr(node, "id");
if ((guid == NULL) && !is_api) {