diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2016-04-13 15:35:27 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2016-04-13 15:37:49 +0200 |
commit | 505faa6c17031a6a04cb847d492cd332b8efeab0 (patch) | |
tree | fe7dad14eb1b1ed6a14cb615af2da853cd227ced | |
parent | 91f1b7611e85995eb550833c79f0592f9f9ff9f4 (diff) |
vm: Be more tolerant with missing nodes during <vm> parsing
It's possible that these nodes are missing in test cases for example.
Since we don't control what the other end is going to send us, it's
better not to warn too loudly when this happens.
-rw-r--r-- | govirt/ovirt-vm-xml.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/govirt/ovirt-vm-xml.c b/govirt/ovirt-vm-xml.c index 22d50af..9990262 100644 --- a/govirt/ovirt-vm-xml.c +++ b/govirt/ovirt-vm-xml.c @@ -50,7 +50,10 @@ static gboolean vm_set_display_from_xml(OvirtVm *vm, return FALSE; } root = g_hash_table_lookup(root->children, display_key); - g_return_val_if_fail(root != NULL, FALSE); + if (root == NULL) { + g_debug("Could not find 'display' node"); + return FALSE; + } display = ovirt_vm_display_new(); node = g_hash_table_lookup(root->children, type_key); @@ -140,6 +143,10 @@ static gboolean vm_set_state_from_xml(OvirtVm *vm, RestXmlNode *node) RestXmlNode *state_node; state_node = rest_xml_node_find(node, "status"); + if (state_node == NULL) { + g_debug("Could not find 'status' node"); + return FALSE; + } state_node = rest_xml_node_find(state_node, "state"); if (state_node != NULL) { int state; |