diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index c72fd47024555f56313f335e5e8da398dc1e0475..cedec10403dab54cdb84e531777f243c83c4a5bd 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -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) {