Rather that getting the XML, parsing it, and grabbing the parent name
field, just call the virNodeDeviceGetParent which is far more efficient.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/util/virvhba.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/util/virvhba.c b/src/util/virvhba.c
index 8c4da3a..2ad3520 100644
--- a/src/util/virvhba.c
+++ b/src/util/virvhba.c
@@ -577,16 +577,10 @@ virVHBAGetParent(virConnectPtr conn,
goto cleanup;
}
- if (!(xml = virNodeDeviceGetXMLDesc(device, 0)))
- goto cleanup;
-
- if (!(def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL)))
- goto cleanup;
-
/* The caller checks whether the returned value is NULL or not
* before continuing
*/
- ignore_value(VIR_STRDUP(vhba_parent, def->parent));
+ ignore_value(VIR_STRDUP(vhba_parent, virNodeDeviceGetParent(device)));
cleanup:
VIR_FREE(nodedev_name);
--
2.7.4