1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00
libvirt/tests/storagevolxml2xmlin
John Ferlan 39cef12a95 storage: Add support for using inputvol for encryption
Starting with QEMU 2.9, encryption convert processing requires
a multi-step process in order to generate an encrypted image from
some non encrypted raw image.

Processing requires to first create an encrypted image using the
sizing parameters from the input source and second to use the
--image-opts, -n, and --target-image-opts options along with inline
driver options to describe the input and output files, generating
two commands such as:

  $ qemu-img create -f luks \
      --object secret,id=demo.img_encrypt0,file=/path/to/secretFile \
      -o key-secret=demo.img_encrypt0 \
      demo.img 500K
  Formatting 'demo.img', fmt=luks size=512000 key-secret=demo.img_encrypt0
  $ qemu-img convert --image-opts -n --target-image-opts \
      --object secret,id=demo.img_encrypt0,file=/path/to/secretFile \
      driver=raw,file.filename=sparse.img \
      driver=luks,file.filename=demo.img,key-secret=demo.img_encrypt0
  $

This patch handles the convert processing by running the processing
in a do..while loop essentially reusing the existing create logic and
arguments to create the target vol from the inputvol and then converting
the inputvol using new arguments.

This then allows the following virsh command to work properly:

  virsh vol-create-from default encrypt1-luks.xml data.img --inputpool default

where encrypt1-luks.xml would provided the path and secret for
the new image, while data.img would be the source image.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-06-26 14:02:43 -04:00
..
vol-file-backing.xml storage: allow interleave in volume XML 2013-11-25 07:51:14 -07:00
vol-file-iso.xml tests: Add storagevol tests for format=iso 2017-03-08 13:22:33 -05:00
vol-file-naming.xml storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
vol-file.xml
vol-gluster-dir-neg-uid.xml storage: unify permission formatting 2014-12-16 15:47:56 +01:00
vol-gluster-dir.xml storage: improve directory support in gluster pool 2013-11-25 12:46:19 -07:00
vol-logical-backing.xml storage: expose volume meta-type in XML 2013-11-25 10:55:19 -07:00
vol-logical.xml storage: expose volume meta-type in XML 2013-11-25 10:55:19 -07:00
vol-luks-cipher.xml storage: remove "luks" storage volume type 2016-07-27 18:59:15 +01:00
vol-luks-convert.xml storage: Add support for using inputvol for encryption 2018-06-26 14:02:43 -04:00
vol-luks.xml storage: remove "luks" storage volume type 2016-07-27 18:59:15 +01:00
vol-partition.xml storage: expose volume meta-type in XML 2013-11-25 10:55:19 -07:00
vol-qcow2-0.10-lazy.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-1.1.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-encryption.xml storage: Disallow create/resize of qcow2 encrypted images 2018-06-26 14:02:43 -04:00
vol-qcow2-lazy.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-nobacking.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-nocapacity-backing.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-nocapacity.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-nocow.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-qcow2-zerocapacity.xml tests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest 2015-07-24 11:23:45 -04:00
vol-qcow2.xml tests: Remove qcow2 encryption from storagevol tests 2018-06-26 14:02:43 -04:00
vol-sheepdog.xml storage: expose volume meta-type in XML 2013-11-25 10:55:19 -07:00