From: John Ferlan Date: Mon, 7 May 2018 14:15:33 +0000 (-0400) Subject: storage_util: Split preallocate set in storageBackendCreateQemuImgOpts X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b5c8c547b73db0cec593ba87e483aafeb290f51e;p=libvirt.git storage_util: Split preallocate set in storageBackendCreateQemuImgOpts 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 --- diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index cedec10403..bd8fb7ca92 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -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)