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 <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2018-05-07 10:15:33 -04:00
parent c46fc572be
commit b5c8c547b7

View 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)