]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: use virXMLPropString for IOThread pin parsing
authorPavel Hrdina <phrdina@redhat.com>
Mon, 14 Aug 2017 12:31:52 +0000 (14:31 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 14 Aug 2017 15:46:21 +0000 (17:46 +0200)
XPath is good for random search of elements, not for accessing
attributes of one node.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
src/conf/domain_conf.c

index 6e424c96d877442cfbbd4b378d42f229e0c53d20..23ef46dc79c0dc8e9d4cb73dda08a41ae573e417 100644 (file)
@@ -16362,19 +16362,15 @@ virDomainVcpuPinDefParseXML(virDomainDefPtr def,
  */
 static int
 virDomainIOThreadPinDefParseXML(xmlNodePtr node,
-                                xmlXPathContextPtr ctxt,
                                 virDomainDefPtr def)
 {
     int ret = -1;
     virDomainIOThreadIDDefPtr iothrid;
     virBitmapPtr cpumask = NULL;
-    xmlNodePtr oldnode = ctxt->node;
     unsigned int iothreadid;
     char *tmp = NULL;
 
-    ctxt->node = node;
-
-    if (!(tmp = virXPathString("string(./@iothread)", ctxt))) {
+    if (!(tmp = virXMLPropString(node, "iothread"))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("missing iothread id in iothreadpin"));
         goto cleanup;
@@ -16430,7 +16426,6 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node,
  cleanup:
     VIR_FREE(tmp);
     virBitmapFree(cpumask);
-    ctxt->node = oldnode;
     return ret;
 }
 
@@ -17705,7 +17700,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     }
 
     for (i = 0; i < n; i++) {
-        if (virDomainIOThreadPinDefParseXML(nodes[i], ctxt, def) < 0)
+        if (virDomainIOThreadPinDefParseXML(nodes[i], def) < 0)
             goto error;
     }
     VIR_FREE(nodes);