From: Peter Krempa Date: Wed, 7 Mar 2018 16:41:21 +0000 (+0100) Subject: conf: Refactor seclabel formatting in virDomainDiskSourceFormatInternal X-Git-Tag: v4.2.0-rc1~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bec16975944e8da20c783711856aa4e3b4a908a;p=thirdparty%2Flibvirt.git conf: Refactor seclabel formatting in virDomainDiskSourceFormatInternal Call the formatter function only once. Signed-off-by: Peter Krempa --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ddabc77a9b..ebe1172fd2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -22836,19 +22836,11 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, case VIR_STORAGE_TYPE_FILE: virBufferEscapeString(&attrBuf, " file='%s'", src->path); virBufferEscapeString(&attrBuf, " startupPolicy='%s'", startupPolicy); - - virDomainDiskSourceDefFormatSeclabel(&childBuf, src->nseclabels, - src->seclabels, flags, - skipSeclabels); break; case VIR_STORAGE_TYPE_BLOCK: virBufferEscapeString(&attrBuf, " dev='%s'", src->path); virBufferEscapeString(&attrBuf, " startupPolicy='%s'", startupPolicy); - - virDomainDiskSourceDefFormatSeclabel(&childBuf, src->nseclabels, - src->seclabels, flags, - skipSeclabels); break; case VIR_STORAGE_TYPE_DIR: @@ -22873,9 +22865,6 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, } virBufferEscapeString(&attrBuf, " startupPolicy='%s'", startupPolicy); - virDomainDiskSourceDefFormatSeclabel(&childBuf, src->nseclabels, - src->seclabels, flags, - skipSeclabels); break; case VIR_STORAGE_TYPE_NONE: @@ -22885,6 +22874,12 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, goto error; } + if (src->type != VIR_STORAGE_TYPE_NETWORK) { + virDomainDiskSourceDefFormatSeclabel(&childBuf, src->nseclabels, + src->seclabels, flags, + skipSeclabels); + } + /* Storage Source formatting will not carry through the blunder * that disk source formatting had at one time to format the * for a volume source type. The information is