]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: block: Don't skip creation of 'luks' formatted images
authorPeter Krempa <pkrempa@redhat.com>
Mon, 20 Jan 2020 12:02:58 +0000 (13:02 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2020 12:46:46 +0000 (13:46 +0100)
commitf4e7c792d58cbd7318fc30519c551e4fe0cd98de
treea102edcbbfc5b9230b7c3f4df88a4dfe87d9d362
parent7134f26b73162536b8bea2af860b32bad6a7f965
qemu: block: Don't skip creation of 'luks' formatted images

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@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_block.c