]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Format seclabels for <backingStore>
authorPeter Krempa <pkrempa@redhat.com>
Mon, 18 Mar 2019 14:31:28 +0000 (15:31 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Apr 2019 09:58:09 +0000 (11:58 +0200)
We parse the seclabels and use them internally so omitting them when
formatting would be misleading. Additionally our schema actually allows
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
tests/qemuxml2argvdata/disk-backing-chains.xml
tests/qemuxml2xmloutdata/disk-backing-chains-active.xml
tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml

index 5f2b1f68b57bebf264725089fdd216b6d6e6219b..ed8e5c37d4eb017e52618ceb0d06d97b6518eefc 100644 (file)
@@ -23876,8 +23876,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
     virBufferAdjustIndent(buf, 2);
 
     virBufferAsprintf(buf, "<format type='%s'/>\n", format);
-    /* We currently don't output seclabels for backing chain element */
-    if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, false,
+    if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, true,
                                           false, xmlopt) < 0 ||
         virDomainDiskBackingStoreFormat(buf, backingStore->backingStore,
                                         xmlopt, flags) < 0)
index 703c60c439d035b4f28a95567d9ce68ce10db5ec..2eaafb34e74226f97e68864945b280e8a80e03fe 100644 (file)
           <source file='/tmp/image2.qcow'/>
           <backingStore type='file' index='3'>
             <format type='qcow2'/>
-            <source file='/tmp/image3.qcow'/>
+            <source file='/tmp/image3.qcow'>
+              <seclabel model='selinux' relabel='yes'>
+                <label>system_u:system_r:public_content_t:s0</label>
+              </seclabel>
+            </source>
             <backingStore type='file' index='4'>
               <format type='qcow2'/>
               <source file='/tmp/image4.qcow'/>
index d1fd2442c35cf7c49cb9f3f919d36349186cc39e..e24956f106a1088f0e6eaa42a522618cf115d26a 100644 (file)
           <source file='/tmp/image2.qcow'/>
           <backingStore type='file' index='3'>
             <format type='qcow2'/>
-            <source file='/tmp/image3.qcow'/>
+            <source file='/tmp/image3.qcow'>
+              <seclabel model='selinux' relabel='yes'>
+                <label>system_u:system_r:public_content_t:s0</label>
+              </seclabel>
+            </source>
             <backingStore type='file' index='4'>
               <format type='qcow2'/>
               <source file='/tmp/image4.qcow'/>
index c1af58ff6f57fb223ca0b8024621aef1fee7e716..e39e218873d761ea6b575cf80d25c19036b1803e 100644 (file)
           <source file='/tmp/image2.qcow'/>
           <backingStore type='file'>
             <format type='qcow2'/>
-            <source file='/tmp/image3.qcow'/>
+            <source file='/tmp/image3.qcow'>
+              <seclabel model='selinux' relabel='yes'>
+                <label>system_u:system_r:public_content_t:s0</label>
+              </seclabel>
+            </source>
             <backingStore type='file'>
               <format type='qcow2'/>
               <source file='/tmp/image4.qcow'/>