提交 954b52cd 编写于 作者: P Pavel Hrdina

conf: use virXMLPropString for IOThread parsing

XPath is good for random search of elements, not for accessing
attributes of one node.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 db755227
...@@ -16209,19 +16209,15 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, ...@@ -16209,19 +16209,15 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
* </iothreadids> * </iothreadids>
*/ */
static virDomainIOThreadIDDefPtr static virDomainIOThreadIDDefPtr
virDomainIOThreadIDDefParseXML(xmlNodePtr node, virDomainIOThreadIDDefParseXML(xmlNodePtr node)
xmlXPathContextPtr ctxt)
{ {
virDomainIOThreadIDDefPtr iothrid; virDomainIOThreadIDDefPtr iothrid;
xmlNodePtr oldnode = ctxt->node;
char *tmp = NULL; char *tmp = NULL;
if (VIR_ALLOC(iothrid) < 0) if (VIR_ALLOC(iothrid) < 0)
return NULL; return NULL;
ctxt->node = node; if (!(tmp = virXMLPropString(node, "id"))) {
if (!(tmp = virXPathString("string(./@id)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing 'id' attribute in <iothread> element")); _("Missing 'id' attribute in <iothread> element"));
goto error; goto error;
...@@ -16235,7 +16231,6 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node, ...@@ -16235,7 +16231,6 @@ virDomainIOThreadIDDefParseXML(xmlNodePtr node,
cleanup: cleanup:
VIR_FREE(tmp); VIR_FREE(tmp);
ctxt->node = oldnode;
return iothrid; return iothrid;
error: error:
...@@ -16275,7 +16270,7 @@ virDomainDefParseIOThreads(virDomainDefPtr def, ...@@ -16275,7 +16270,7 @@ virDomainDefParseIOThreads(virDomainDefPtr def,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainIOThreadIDDefPtr iothrid = NULL; virDomainIOThreadIDDefPtr iothrid = NULL;
if (!(iothrid = virDomainIOThreadIDDefParseXML(nodes[i], ctxt))) if (!(iothrid = virDomainIOThreadIDDefParseXML(nodes[i])))
goto error; goto error;
if (virDomainIOThreadIDFind(def, iothrid->iothread_id)) { if (virDomainIOThreadIDFind(def, iothrid->iothread_id)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册