storage: add support for qcow2 LUKS encryption

The storage driver was wired up to support creating raw volumes in LUKS
format, but was never adapted to support LUKS-in-qcow2. This is trivial
as it merely requires the encryption properties to be prefixed with
the "encrypt." prefix, and "encrypt.format=luks" when creating the
volume.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2020-09-15 16:30:37 +01:00
parent 093ee8b3e2
commit ecfc4094d8
12 changed files with 234 additions and 22 deletions

View File

@@ -0,0 +1,8 @@
qemu-img \
create \
-f qcow2 \
-b /dev/null \
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
-o backing_fmt=raw,encrypt.format=luks,\
encrypt.key-secret=OtherDemoLuks.img_encrypt0,\
compat=0.10 /var/lib/libvirt/images/OtherDemoLuks.img 5242880K