提交 f2b26dff 编写于 作者: P Peter Krempa

conf: Don't output seclabels for backingStore elements

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.
上级 96e00c4f
...@@ -14830,14 +14830,15 @@ virDomainDiskBlockIoDefFormat(virBufferPtr buf, ...@@ -14830,14 +14830,15 @@ virDomainDiskBlockIoDefFormat(virBufferPtr buf,
* possible seclabels. * possible seclabels.
*/ */
static void static void
virDomainSourceDefFormatSeclabel(virBufferPtr buf, virDomainDiskSourceDefFormatSeclabel(virBufferPtr buf,
size_t nseclabels, size_t nseclabels,
virSecurityDeviceLabelDefPtr *seclabels, virSecurityDeviceLabelDefPtr *seclabels,
unsigned int flags) unsigned int flags,
bool skipSeclables)
{ {
size_t n; size_t n;
if (nseclabels) { if (nseclabels && !skipSeclables) {
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (n = 0; n < nseclabels; n++) for (n = 0; n < nseclabels; n++)
...@@ -14849,11 +14850,21 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf, ...@@ -14849,11 +14850,21 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf,
} }
} }
int static void
virDomainDiskSourceFormat(virBufferPtr buf, virDomainSourceDefFormatSeclabel(virBufferPtr buf,
size_t nseclabels,
virSecurityDeviceLabelDefPtr *seclabels,
unsigned int flags)
{
virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags, false);
}
static int
virDomainDiskSourceFormatInternal(virBufferPtr buf,
virStorageSourcePtr src, virStorageSourcePtr src,
int policy, int policy,
unsigned int flags) unsigned int flags,
bool skipSeclabels)
{ {
size_t n; size_t n;
char *path = NULL; char *path = NULL;
...@@ -14869,8 +14880,9 @@ virDomainDiskSourceFormat(virBufferPtr buf, ...@@ -14869,8 +14880,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
virBufferEscapeString(buf, " file='%s'", src->path); virBufferEscapeString(buf, " file='%s'", src->path);
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
virDomainSourceDefFormatSeclabel(buf, src->nseclabels, virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
src->seclabels, flags); src->seclabels, flags,
skipSeclabels);
break; break;
case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_BLOCK:
...@@ -14878,8 +14890,9 @@ virDomainDiskSourceFormat(virBufferPtr buf, ...@@ -14878,8 +14890,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
virBufferEscapeString(buf, " dev='%s'", src->path); virBufferEscapeString(buf, " dev='%s'", src->path);
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
virDomainSourceDefFormatSeclabel(buf, src->nseclabels, virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
src->seclabels, flags); src->seclabels, flags,
skipSeclabels);
break; break;
case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_DIR:
...@@ -14942,8 +14955,9 @@ virDomainDiskSourceFormat(virBufferPtr buf, ...@@ -14942,8 +14955,9 @@ virDomainDiskSourceFormat(virBufferPtr buf,
} }
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
virDomainSourceDefFormatSeclabel(buf, src->nseclabels, virDomainDiskSourceDefFormatSeclabel(buf, src->nseclabels,
src->seclabels, flags); src->seclabels, flags,
skipSeclabels);
break; break;
case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_NONE:
...@@ -14958,6 +14972,16 @@ virDomainDiskSourceFormat(virBufferPtr buf, ...@@ -14958,6 +14972,16 @@ virDomainDiskSourceFormat(virBufferPtr buf,
} }
int
virDomainDiskSourceFormat(virBufferPtr buf,
virStorageSourcePtr src,
int policy,
unsigned int flags)
{
return virDomainDiskSourceFormatInternal(buf, src, policy, flags, false);
}
static int static int
virDomainDiskBackingStoreFormat(virBufferPtr buf, virDomainDiskBackingStoreFormat(virBufferPtr buf,
virStorageSourcePtr backingStore, virStorageSourcePtr backingStore,
...@@ -14994,7 +15018,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, ...@@ -14994,7 +15018,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
virBufferAsprintf(buf, "<format type='%s'/>\n", format); 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, virDomainDiskBackingStoreFormat(buf,
backingStore->backingStore, backingStore->backingStore,
backingStore->backingStoreRaw, backingStore->backingStoreRaw,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册