]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage_util: Split backing_fmt set in storageBackendCreateQemuImgOpts
authorJohn Ferlan <jferlan@redhat.com>
Mon, 7 May 2018 14:17:43 +0000 (10:17 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 15 May 2018 20:57:24 +0000 (16:57 -0400)
The only way backing_fmts could be set is if the info->format was
not RAW (see storageBackendCreateQemuImgSetBacking), so let's just
extract it from the if/else surrounding the application of the
encryption options.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/storage/storage_util.c

index c72fd47024555f56313f335e5e8da398dc1e0475..cedec10403dab54cdb84e531777f243c83c4a5bd 100644 (file)
@@ -822,12 +822,13 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc,
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
+    if (info.backingPath)
+        virBufferAsprintf(&buf, "backing_fmt=%s,",
+                          virStorageFileFormatTypeToString(info.backingFormat));
+
     if (info.format == VIR_STORAGE_FILE_RAW && enc) {
         virQEMUBuildQemuImgKeySecretOpts(&buf, enc, info.secretAlias);
     } else {
-        if (info.backingPath)
-            virBufferAsprintf(&buf, "backing_fmt=%s,",
-                              virStorageFileFormatTypeToString(info.backingFormat));
         if (info.encryption)
             virBufferAddLit(&buf, "encryption=on,");
         if (info.preallocate) {