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(a)redhat.com>
---
src/conf/domain_conf.c | 3 +--
tests/qemuxml2argvdata/disk-backing-chains.xml | 6 +++++-
tests/qemuxml2xmloutdata/disk-backing-chains-active.xml | 6 +++++-
tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml | 6 +++++-
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2bb4d6eafc..105ece2b7c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23892,8 +23892,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
virBufferAsprintf(&childBuf, "<format type='%s'/>\n",
virStorageFileFormatTypeToString(backingStore->format));
- /* We currently don't output seclabels for backing chain element */
- if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false,
+ if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, true,
false, true, xmlopt) < 0)
return -1;
diff --git a/tests/qemuxml2argvdata/disk-backing-chains.xml
b/tests/qemuxml2argvdata/disk-backing-chains.xml
index 703c60c439..2eaafb34e7 100644
--- a/tests/qemuxml2argvdata/disk-backing-chains.xml
+++ b/tests/qemuxml2argvdata/disk-backing-chains.xml
@@ -38,7 +38,11 @@
<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'/>
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml
index d1fd2442c3..e24956f106 100644
--- a/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml
@@ -39,7 +39,11 @@
<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'/>
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml
index c1af58ff6f..e39e218873 100644
--- a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml
@@ -39,7 +39,11 @@
<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'/>
--
2.20.1