]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: domain: Restore XPath context after virSecurityDeviceLabelDefParseXML
authorPeter Krempa <pkrempa@redhat.com>
Mon, 24 Jun 2019 16:12:48 +0000 (18:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 25 Jun 2019 14:42:28 +0000 (16:42 +0200)
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.

Use VIR_XPATH_NODE_AUTORESTORE and add a test case to validate that
everything works.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
tests/qemustatusxml2xmldata/modern-in.xml

index 33253edfddfd3f9e2695d0bb0ebf0fac0173759b..3323c9a5b14a1d2c95d65aa81b16d0d13c2c1783 100644 (file)
@@ -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;
index 08f7f40761d8b1926be2dfcf1c969bce22e7893e..f7104efa017a40530a85c0f3af0e1467a68c6373 100644 (file)
         <backingStore type='file' index='1'>
           <format type='qcow2'/>
           <source file='/var/lib/libvirt/images/base.qcow2'>
+            <seclabel model='dac' relabel='yes'>
+              <label>qemu:qemu</label>
+            </seclabel>
             <reservations managed='yes'>
               <source type='unix' path='/somepath/ux.sck' mode='client'/>
             </reservations>