Some of the further changes will propagate seclabels from a disk source
element into the backing store elements. This would change the XML
output of the backing store as the seclabels would be formatted for each
backing store element. Skip the seclabels formatting until we decide
that it's necessary.
---
src/conf/domain_conf.c | 59 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 17 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b7aa4f5..da9dd04 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14871,14 +14871,15 @@ virDomainDiskBlockIoDefFormat(virBufferPtr buf,
* possible seclabels.
*/
static void
-virDomainSourceDefFormatSeclabel(virBufferPtr buf,
- size_t nseclabels,
- virSecurityDeviceLabelDefPtr *seclabels,
- unsigned int flags)
+virDomainDiskSourceDefFormatSeclabel(virBufferPtr buf,
+ size_t nseclabels,
+ virSecurityDeviceLabelDefPtr *seclabels,
+ unsigned int flags,
+ bool skipSeclables)
{
size_t n;
- if (nseclabels) {
+ if (nseclabels && !skipSeclables) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
for (n = 0; n < nseclabels; n++)
@@ -14890,11 +14891,21 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf,
}
}
-int
-virDomainDiskSourceFormat(virBufferPtr buf,
- virStorageSourcePtr src,
- int policy,
- unsigned int flags)
+static void
+virDomainSourceDefFormatSeclabel(virBufferPtr buf,
+ size_t nseclabels,
+ virSecurityDeviceLabelDefPtr *seclabels,
+ unsigned int flags)
+{
+ virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags, false);
+}
+
+static int
+virDomainDiskSourceFormatInternal(virBufferPtr buf,
+ virStorageSourcePtr src,
+ int policy,
+ unsigned int flags,
+ bool skipSeclabels)
{
size_t n;
char *path = NULL;
@@ -14910,8 +14921,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
virBufferEscapeString(buf, " file='%s'", src->path);
virBufferEscapeString(buf, " startupPolicy='%s'",
startupPolicy);
- virDomainSourceDefFormatSeclabel(buf, src->nseclabels,
- src->seclabels, flags);
+ virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
+ src->seclabels, flags,
+ skipSeclabels);
break;
case VIR_STORAGE_TYPE_BLOCK:
@@ -14919,8 +14931,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
virBufferEscapeString(buf, " dev='%s'", src->path);
virBufferEscapeString(buf, " startupPolicy='%s'",
startupPolicy);
- virDomainSourceDefFormatSeclabel(buf, src->nseclabels,
- src->seclabels, flags);
+ virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
+ src->seclabels, flags,
+ skipSeclabels);
break;
case VIR_STORAGE_TYPE_DIR:
@@ -14983,8 +14996,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
}
virBufferEscapeString(buf, " startupPolicy='%s'",
startupPolicy);
- virDomainSourceDefFormatSeclabel(buf, src->nseclabels,
- src->seclabels, flags);
+ virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
+ src->seclabels, flags,
+ skipSeclabels);
break;
case VIR_STORAGE_TYPE_NONE:
@@ -14999,6 +15013,16 @@ virDomainDiskSourceFormat(virBufferPtr buf,
}
+int
+virDomainDiskSourceFormat(virBufferPtr buf,
+ virStorageSourcePtr src,
+ int policy,
+ unsigned int flags)
+{
+ return virDomainDiskSourceFormatInternal(buf, src, policy, flags, false);
+}
+
+
static int
virDomainDiskBackingStoreFormat(virBufferPtr buf,
virStorageSourcePtr backingStore,
@@ -15035,7 +15059,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, 2);
virBufferAsprintf(buf, "<format type='%s'/>\n", format);
- if (virDomainDiskSourceFormat(buf, backingStore, 0, 0) < 0 ||
+ /* We currently don't output seclabels for backing chain element */
+ if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, 0, true) < 0 ||
virDomainDiskBackingStoreFormat(buf,
backingStore->backingStore,
backingStore->backingStoreRaw,
--
1.9.3