提交 f4e7c792 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 7134f26b
...@@ -2479,7 +2479,8 @@ qemuBlockStorageSourceCreateFormat(virDomainObjPtr vm, ...@@ -2479,7 +2479,8 @@ qemuBlockStorageSourceCreateFormat(virDomainObjPtr vm,
g_autoptr(virJSONValue) createformatprops = NULL; g_autoptr(virJSONValue) createformatprops = NULL;
int ret; int ret;
if (src->format == VIR_STORAGE_FILE_RAW) if (src->format == VIR_STORAGE_FILE_RAW &&
!src->encryption)
return 0; return 0;
if (qemuBlockStorageSourceCreateGetFormatProps(src, backingStore, if (qemuBlockStorageSourceCreateGetFormatProps(src, backingStore,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册