From b3285cc15d305161dd0f3730690d6a441c906456 Mon Sep 17 00:00:00 2001 Message-Id: From: Peter Krempa Date: Tue, 4 Feb 2020 15:07:45 +0100 Subject: [PATCH] qemu: block: Don't skip creation of 'luks' formatted images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libvirt treats 'luks' images as raw+encryption. The logic in qemuBlockStorageSourceCreateFormat skipped the creation if the requested image was raw but didn't take into account the encryption. This manifested itself e.g. when attempting to do a virsh blockcopy with the following XML: Where qemu would report the following error: unable to execute QEMU command 'blockdev-add': Volume is not in LUKS format rather than actually formatting the image first. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake (cherry picked from commit f4e7c792d58cbd7318fc30519c551e4fe0cd98de) https://bugzilla.redhat.com/show_bug.cgi?id=1371022 Message-Id: <1a89d76526af86e4d0437852802a5da0d2aed701.1580824112.git.pkrempa@redhat.com> Reviewed-by: Ján Tomko --- src/qemu/qemu_block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index eab21bc107..22f03da485 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2479,7 +2479,8 @@ qemuBlockStorageSourceCreateFormat(virDomainObjPtr vm, g_autoptr(virJSONValue) createformatprops = NULL; int ret; - if (src->format == VIR_STORAGE_FILE_RAW) + if (src->format == VIR_STORAGE_FILE_RAW && + !src->encryption) return 0; if (qemuBlockStorageSourceCreateGetFormatProps(src, backingStore, -- 2.25.0