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