]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Refactor seclabel formatting in virDomainDiskSourceFormatInternal
authorPeter Krempa <pkrempa@redhat.com>
Wed, 7 Mar 2018 16:41:21 +0000 (17:41 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 14 Mar 2018 11:19:44 +0000 (12:19 +0100)
Call the formatter function only once.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index ddabc77a9b2d681b8150e11f9e812cd8bd4e0e5c..ebe1172fd22a8c0d3eb7520d8814946c39988c0a 100644 (file)
@@ -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
      * <auth> for a volume source type. The <auth> information is