Re: [PATCH] qemu: block: Don't skip creation of 'luks' formatted images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/23/20 11:05 AM, Peter Krempa wrote:
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:

     <disk type='file' device='disk'>
       <driver name='qemu' type='raw'/>
       <source file='/tmp/enccpy'>
         <encryption format='luks'>
           <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
         </encryption>
       </source>
     </disk>

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 <pkrempa@xxxxxxxxxx>
---
  src/qemu/qemu_block.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)


Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>

(Looks like we're going to encounter lots of blockdev corner cases that need little fixups like this...)

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,


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux