Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/conf/domain_conf.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index df7079c7e6..5ac15fe9e8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11063,16 +11063,18 @@ virDomainChrTargetModelFromString(int devtype,
static int
virDomainChrDefParseTargetXML(virDomainChrDef *def,
xmlNodePtr cur,
- xmlXPathContextPtr ctxt G_GNUC_UNUSED,
+ xmlXPathContextPtr ctxt,
unsigned int flags)
{
- xmlNodePtr child;
unsigned int port;
g_autofree char *targetType = virXMLPropString(cur, "type");
g_autofree char *targetModel = NULL;
g_autofree char *addrStr = NULL;
g_autofree char *portStr = NULL;
g_autofree char *stateStr = NULL;
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
+
+ ctxt->node = cur;
if ((def->targetType =
virDomainChrTargetTypeFromString(def->deviceType,
@@ -11083,14 +11085,7 @@ virDomainChrDefParseTargetXML(virDomainChrDef *def,
return -1;
}
- child = cur->children;
- while (child != NULL) {
- if (child->type == XML_ELEMENT_NODE &&
- virXMLNodeNameEqual(child, "model")) {
- targetModel = virXMLPropString(child, "name");
- }
- child = child->next;
- }
+ targetModel = virXPathString("string(./model/@name)", ctxt);
if ((def->targetModel =
virDomainChrTargetModelFromString(def->deviceType,
--
2.30.2