[libvirt] [PATCH 3/3] conf: domain: Restore XPath context after virSecurityDeviceLabelDefParseXML

Peter Krempa pkrempa at redhat.com
Mon Jun 24 16:27:13 UTC 2019


The function modifies the context but did not care to restore it back.
If a <seclabel> was used on a disk, the <privateData> would not be
parsed.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c                     |  1 +
 tests/qemustatusxml2xmldata/modern-out.xml | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 33253edfdd..3323c9a5b1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8872,6 +8872,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
                                   xmlXPathContextPtr ctxt,
                                   unsigned int flags)
 {
+    VIR_XPATH_NODE_AUTORESTORE(ctxt);
     virSecurityDeviceLabelDefPtr *seclabels = NULL;
     size_t nseclabels = 0;
     int n;
diff --git a/tests/qemustatusxml2xmldata/modern-out.xml b/tests/qemustatusxml2xmldata/modern-out.xml
index 108e07eee0..f7104efa01 100644
--- a/tests/qemustatusxml2xmldata/modern-out.xml
+++ b/tests/qemustatusxml2xmldata/modern-out.xml
@@ -318,7 +318,17 @@
               <source type='unix' path='/somepath/ux.sck' mode='client'/>
             </reservations>
             <privateData>
-              <reservations mgralias='(null)'/>
+              <nodenames>
+                <nodename type='storage' name='test-storage'/>
+                <nodename type='format' name='test-format'/>
+              </nodenames>
+              <reservations mgralias='test-alias'/>
+              <relPath>base.qcow2</relPath>
+              <objects>
+                <secret type='auth' alias='test-auth-alias'/>
+                <secret type='encryption' alias='test-encryption-alias'/>
+                <TLSx509 alias='transport-alias'/>
+              </objects>
             </privateData>
           </source>
           <backingStore/>
-- 
2.21.0




More information about the libvir-list mailing list