[PATCH v3 2/4] Allow controller XML parsing to use XPath context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virDomainParseScaledValue requires it.
---
 src/conf/domain_conf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4e24101..fece93a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5659,6 +5659,7 @@ virDomainControllerModelTypeFromString(const virDomainControllerDefPtr def,
  */
 static virDomainControllerDefPtr
 virDomainControllerDefParseXML(xmlNodePtr node,
+                               xmlXPathContextPtr ctxt,
                                unsigned int flags)
 {
     virDomainControllerDefPtr def;
@@ -5667,6 +5668,9 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     char *idx = NULL;
     char *model = NULL;
     char *queues = NULL;
+    xmlNodePtr saved = ctxt->node;
+
+    ctxt->node = node;
 
     if (VIR_ALLOC(def) < 0)
         return NULL;
@@ -5808,6 +5812,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     }
 
 cleanup:
+    ctxt->node = saved;
     VIR_FREE(type);
     VIR_FREE(idx);
     VIR_FREE(model);
@@ -9479,7 +9484,8 @@ virDomainDeviceDefParse(const char *xmlStr,
             goto error;
         break;
     case VIR_DOMAIN_DEVICE_CONTROLLER:
-        if (!(dev->data.controller = virDomainControllerDefParseXML(node, flags)))
+        if (!(dev->data.controller = virDomainControllerDefParseXML(node, ctxt,
+                                                                    flags)))
             goto error;
         break;
     case VIR_DOMAIN_DEVICE_GRAPHICS:
@@ -11690,6 +11696,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 
     for (i = 0; i < n; i++) {
         virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i],
+                                                                              ctxt,
                                                                               flags);
         if (!controller)
             goto error;
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]