]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage_util: Split preallocate set in storageBackendCreateQemuImgOpts
authorJohn Ferlan <jferlan@redhat.com>
Mon, 7 May 2018 14:15:33 +0000 (10:15 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 15 May 2018 20:57:24 +0000 (16:57 -0400)
The only way preallocate 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 cedec10403dab54cdb84e531777f243c83c4a5bd..bd8fb7ca928e235263100d6d51d4b3f216c40db9 100644 (file)
@@ -831,12 +831,13 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDefPtr enc,
     } else {
         if (info.encryption)
             virBufferAddLit(&buf, "encryption=on,");
-        if (info.preallocate) {
-            if (info.size_arg > info.allocation)
-                virBufferAddLit(&buf, "preallocation=metadata,");
-            else
-                virBufferAddLit(&buf, "preallocation=falloc,");
-        }
+    }
+
+    if (info.preallocate) {
+        if (info.size_arg > info.allocation)
+            virBufferAddLit(&buf, "preallocation=metadata,");
+        else
+            virBufferAddLit(&buf, "preallocation=falloc,");
     }
 
     if (info.nocow)