libvirt/tests
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
..
bhyveargv2xmldata
bhyvexml2argvdata bhyve: tests: Add missing data files 2018-06-08 21:53:36 +04:00
bhyvexml2xmloutdata
capabilityschemadata
commanddata
cputestdata
domaincapsschemadata conf: Fix formatting of <sev> element in domain capabilities XML 2018-06-15 10:49:13 +02:00
domainconfdata
domainschemadata
domainsnapshotxml2xmlin
domainsnapshotxml2xmlout
fchostdata/fc_host
genericxml2xmlindata conf: prefer camelCase for launchSecurity 2018-06-13 14:42:17 +02:00
genericxml2xmloutdata
interfaceschemadata
libxlxml2domconfigdata
lxcconf2xmldata
lxcxml2xmldata
lxcxml2xmloutdata
networkxml2confdata
networkxml2firewalldata
networkxml2xmlin
networkxml2xmlout network: don't add "no-resolv" if we still need DNS servers from resolv.conf 2017-03-21 11:25:59 -04:00
networkxml2xmlupdatein
networkxml2xmlupdateout
nodedevschemadata
nssdata
nwfilterxml2firewalldata
nwfilterxml2xmlin
nwfilterxml2xmlout
qemuagentdata
qemuargv2xmldata
qemublocktestdata/xml2json tests: qemublock: Test NBD with TLS in the JSON generator 2018-06-05 08:14:00 +02:00
qemucapabilitiesdata qemu: Add capability for the HPT maxpagesize feature 2018-06-26 10:15:44 +02:00
qemucaps2xmldata capabilities: Extend capabilities with iommu_support 2018-06-05 08:33:13 +02:00
qemuhotplugtestcpus
qemuhotplugtestdevices
qemuhotplugtestdomains
qemumemlockdata
qemumigparamsdata
qemumonitorjsondata
qemustatusxml2xmldata qemu: domain: Regenerate alias for the TLS x509 credential object 2018-06-05 08:13:57 +02:00
qemuxml2argvdata qemu: Escape commas for qemuBuildSCSIiSCSIHostdevDrvStr 2018-06-26 11:04:38 -04:00
qemuxml2startupxmloutdata
qemuxml2xmloutdata conf: Parse and format HPT maxpagesize 2018-06-26 10:15:52 +02:00
secretxml2xmlin
securityselinuxhelperdata
securityselinuxlabeldata
sexpr2xmldata
storagepoolschemadata
storagepoolxml2xmlin
storagepoolxml2xmlout conf: do not steal pointers from the pool source 2017-03-29 10:36:55 +02:00
storagevolschemadata
storagevolxml2argvdata storage: Add support for using inputvol for encryption 2018-06-26 14:02:43 -04:00
storagevolxml2xmlin storage: Add support for using inputvol for encryption 2018-06-26 14:02:43 -04:00
storagevolxml2xmlout storage: Disallow create/resize of qcow2 encrypted images 2018-06-26 14:02:43 -04:00
sysinfodata
vboxsnapshotxmldata
vircaps2xmldata capabilities: Extend capabilities with iommu_support 2018-06-05 08:33:13 +02:00
vircgroupdata
virconfdata
virfilecachedata
virfiledata
virhostcpudata
virjsondata
virmacmaptestdata
virnetdaemondata
virnetdevtestdata/sys/class/net
virnwfilterbindingxml2xmldata conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
virpcitestdata
virresctrldata
virscsidata
virstorageutildata
virusbtestdata/sys_bus_usb/devices
vmwareverdata
vmx2xmldata
xlconfigdata
xmconfigdata tests: xmconfigtest: add tests for cmdline formating 2018-06-04 20:59:16 -06:00
xml2sexprdata
xml2vmxdata
.valgrind.supp
bhyveargv2xmlmock.c
bhyveargv2xmltest.c
bhyvexml2argvmock.c
bhyvexml2argvtest.c bhyve: Add CPU topology support 2018-06-07 19:26:26 +04:00
bhyvexml2xmltest.c
check-file-access.pl
commandhelper.c
commandtest.c all: Replace virGetLastError with virGetLastErrorCode where we can 2018-06-05 18:44:05 +02:00
cputest.c
domaincapsmock.c
domaincapstest.c
domainconftest.c
domainsnapshotxml2xmltest.c
esxutilstest.c
eventtest.c
fchosttest.c
fdstreamtest.c
file_access_whitelist.txt
genericxml2xmltest.c conf: Introduce launch-security element in domain 2018-06-12 10:00:49 +02:00
group-qemu-caps.pl
interfacexml2xmltest.c
libvirtd-fail
libvirtd-pool
libxlxml2domconfigtest.c test: Check return status for libxlxml2domconfigtest 2018-06-11 18:33:13 -04:00
lxcconf2xmltest.c
lxcxml2xmltest.c
Makefile.am conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
metadatatest.c tests: initialize some variables 2018-05-30 15:54:58 +02:00
networkxml2conftest.c
networkxml2firewalltest.c
networkxml2xmltest.c
networkxml2xmlupdatetest.c
nodedevxml2xmltest.c
nsslinktest.c
nssmock.c
nsstest.c
nwfilterebiptablestest.c
nwfilterxml2firewalltest.c
nwfilterxml2xmltest.c
objecteventtest.c tests: initialize some variables 2018-05-30 15:54:58 +02:00
objectlocking.ml
oomtrace.pl
openvzutilstest.c
openvzutilstest.conf
pkix_asn1_tab.c
qemuagenttest.c
qemuargv2xmltest.c
qemublocktest.c tests: qemublock: Test NBD with TLS in the JSON generator 2018-06-05 08:14:00 +02:00
qemucapabilitiestest.c tests: Add replies for QEMU 3.0.0 on ppc64 2018-06-26 10:15:36 +02:00
qemucaps2xmlmock.c
qemucaps2xmltest.c
qemucapsfixreplies tests: Fix qemucapsfixreplies 2018-06-19 14:01:14 +02:00
qemucapsprobe.c
qemucapsprobemock.c tests: qemucapsprobemock: Prepare 'qemucapsprobe' for the new format 2018-06-12 10:27:50 +02:00
qemucommandutiltest.c
qemucpumock.c
qemuhotplugtest.c
qemumemlocktest.c
qemumigparamstest.c
qemumonitorjsontest.c test: Fix resource leak in qemumonitorjsontest 2018-06-11 18:33:13 -04:00
qemumonitortestutils.c tests: qemumonitor: Optimize control flow when concatenating replies 2018-06-12 10:27:50 +02:00
qemumonitortestutils.h
qemuqapischema.json
qemuxml2argvmock.c qemu: support passing pre-opened UNIX socket listen FD 2018-06-05 17:30:28 +01:00
qemuxml2argvtest.c qemu: Escape commas for qemuBuildSCSIiSCSIHostdevDrvStr 2018-06-26 11:04:38 -04:00
qemuxml2xmltest.c conf: Parse and format HPT maxpagesize 2018-06-26 10:15:52 +02:00
scsihosttest.c
seclabeltest.c
secretxml2xmltest.c
securityselinuxhelper.c
securityselinuxlabeltest.c
securityselinuxtest.c
sexpr2xmltest.c
shunloadhelper.c
shunloadtest.c
sockettest.c
ssh.c
storagebackendsheepdogtest.c
storagepoolxml2xmltest.c
storagevolxml2argvtest.c storage: Add support for using inputvol for encryption 2018-06-26 14:02:43 -04:00
storagevolxml2xmltest.c storage: Disallow create/resize of qcow2 encrypted images 2018-06-26 14:02:43 -04:00
sysinfotest.c
test-lib.sh
test-wrap-argv.pl
testutils.c all: Replace virGetLastError with virGetLastErrorCode where we can 2018-06-05 18:44:05 +02:00
testutils.h
testutilshostcpus.h
testutilslxc.c
testutilslxc.h
testutilsqemu.c
testutilsqemu.h
testutilsqemuschema.c
testutilsqemuschema.h
testutilsxen.c
testutilsxen.h
utiltest.c
vboxsnapshotxmltest.c
viralloctest.c
viratomictest.c
virauthconfigtest.c
virbitmaptest.c
virbuftest.c
vircaps2xmltest.c
vircapstest.c
vircgroupmock.c
vircgrouptest.c
virconftest.c
vircryptotest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virdbusmock.c
virdbustest.c
virdeterministichashmock.c
virdrivermoduletest.c
virendiantest.c
virfilecachemock.c
virfilecachetest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virfiletest.c
virfilewrapper.c
virfilewrapper.h
virfirewalltest.c
virhashdata.h
virhashtest.c
virhostcpumock.c
virhostcputest.c all: Replace virGetLastError with virGetLastErrorCode where we can 2018-06-05 18:44:05 +02:00
virhostdevtest.c
viridentitytest.c
viriscsitest.c
virjsontest.c
virkeycodetest.c
virkeyfiletest.c
virkmodtest.c
virlockspacetest.c
virlogtest.c
virmacmaptest.c
virmock.h
virmocklibxl.c
virnetdaemonmock.c
virnetdaemontest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virnetdevbandwidthmock.c
virnetdevbandwidthtest.c
virnetdevmock.c
virnetdevtest.c
virnetmessagetest.c
virnetserverclientmock.c
virnetserverclienttest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virnetsockettest.c
virnettlscontexttest.c
virnettlshelpers.c
virnettlshelpers.h
virnettlssessiontest.c
virnumamock.c
virnwfilterbindingxml2xmltest.c conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
virpcimock.c
virpcitest.c
virpolkittest.c
virportallocatormock.c
virportallocatortest.c
virrandommock.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virresctrltest.c
virrotatingfiletest.c
virschematest.c schemas: add schema for nwfilter binding XML document 2018-06-26 11:22:07 +01:00
virscsitest.c
virsh-cpuset
virsh-define-dev-segfault
virsh-int-overflow
virsh-optparse
virsh-read-bufsiz
virsh-read-non-seekable
virsh-schedinfo
virsh-self-test
virsh-start
virsh-undefine
virsh-uriprecedence
virsh-vcpupin
virshtest.c
virstoragetest.c util: storage: remove 'allow_probe' from virStorageFileGetMetadata 2018-06-08 09:26:38 +02:00
virstorageutiltest.c
virstringtest.c
virsystemdtest.c
virt-aa-helper-test
virt-admin-self-test
virtestmock.c
virtimetest.c
virtypedparamtest.c
viruritest.c
virusbmock.c
virusbtest.c
vmwarevertest.c
vmx2xmltest.c
xlconfigtest.c
xmconfigtest.c tests: xmconfigtest: add tests for cmdline formating 2018-06-04 20:59:16 -06:00
xml2sexprtest.c
xml2vmxtest.c