Blob Blame History Raw
From 0164165daed6a694dc28d693f3d6333879dcd6ba 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) {
-- 
2.13.6