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 bhyve: add tests for wiring memory 2018-05-13 13:38:31 +04:00
bhyvexml2argvdata bhyve: tests: Add missing data files 2018-06-08 21:53:36 +04:00
bhyvexml2xmloutdata bhyve: add tests for wiring memory 2018-05-13 13:38:31 +04:00
capabilityschemadata schema: Fix capability grammar for pagesElem 2018-05-25 09:36:42 -04:00
commanddata tests: fix typo 2017-11-20 13:22:48 +01:00
cputestdata cputest: New test for Intel Core i5-650 2018-04-18 11:39:53 +02:00
domaincapsschemadata conf: Fix formatting of <sev> element in domain capabilities XML 2018-06-15 10:49:13 +02:00
domainconfdata
domainschemadata
domainsnapshotxml2xmlin storage: Store RBD image name as pool and image name 2017-11-07 14:58:04 +01:00
domainsnapshotxml2xmlout tests: domainsnapshotxml2xml: Remove testing with allowed format detection 2018-03-13 13:54:06 +01:00
fchostdata/fc_host
genericxml2xmlindata conf: prefer camelCase for launchSecurity 2018-06-13 14:42:17 +02:00
genericxml2xmloutdata tests: Add test for properly removing cachetune entries 2018-02-02 14:51:32 +01:00
interfaceschemadata
libxlxml2domconfigdata tests: check CPU features handling in libxl driver 2018-04-17 21:15:27 -06:00
lxcconf2xmldata lxc: support <interface type='ethernet'> 2016-05-24 15:21:05 -04:00
lxcxml2xmldata
lxcxml2xmloutdata
networkxml2confdata
networkxml2firewalldata
networkxml2xmlin
networkxml2xmlout
networkxml2xmlupdatein
networkxml2xmlupdateout
nodedevschemadata schema: Add missing block data for nodedev 2018-05-25 09:36:42 -04:00
nssdata
nwfilterxml2firewalldata nwfilter: remove bogus 'protocolid' attribute on arp/rarp fields 2017-12-07 09:21:04 +00:00
nwfilterxml2xmlin nwfilter: remove bogus 'protocolid' attribute on arp/rarp fields 2017-12-07 09:21:04 +00:00
nwfilterxml2xmlout
qemuagentdata test: Drop useless prefix for qemuagent test data 2017-12-05 14:52:49 +01:00
qemuargv2xmldata conf: introduce virDomainDefBootOrderPostParse 2018-05-29 10:22:08 +02:00
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 virQEMUCapsHasPCIMultiBus: use def->os.arch 2017-11-30 16:49:05 +01:00
qemuhotplugtestdevices qemuhotplugtest: Test user supplied alias 2017-10-27 14:43:21 +02:00
qemuhotplugtestdomains qemu: Don't assign alias to disabled balloon device 2018-03-19 21:22:43 +01:00
qemumemlockdata
qemumigparamsdata qemumigparamstest: Add test data for TLS parameters 2018-04-17 10:46:23 +02:00
qemumonitorjsondata tests: add testcase for s390 query-cpus-fast 2018-04-17 12:45:26 -04:00
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 qemu: domain: Move initialization of disk cachemode for <shareable> disks 2018-04-03 15:48:38 +02:00
qemuxml2xmloutdata conf: Parse and format HPT maxpagesize 2018-06-26 10:15:52 +02:00
secretxml2xmlin
securityselinuxhelperdata
securityselinuxlabeldata
sexpr2xmldata conf: introduce virDomainDefBootOrderPostParse 2018-05-29 10:22:08 +02:00
storagepoolschemadata
storagepoolxml2xmlin
storagepoolxml2xmlout
storagevolschemadata schema: Add physical sizing element for storagevol grammar 2018-05-25 09:32:37 -04:00
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 virsysinfo: Use more virSkipSpacesBackwards() 2018-03-14 17:43:40 +01:00
vboxsnapshotxmldata
vircaps2xmldata capabilities: Extend capabilities with iommu_support 2018-06-05 08:33:13 +02:00
vircgroupdata
virconfdata Use https:// links for most sites 2017-10-16 10:22:34 +01:00
virfilecachedata
virfiledata
virhostcpudata tests: Break symlink loop 2018-01-11 14:23:09 +01:00
virjsondata
virmacmaptestdata
virnetdaemondata tests: validate private data / pre / post exec hooks for RPC APIs 2018-02-02 13:00:48 +00:00
virnetdevtestdata/sys/class/net
virnwfilterbindingxml2xmldata conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
virpcitestdata
virresctrldata tests: Clean up and modify some vircaps2xmldata 2018-01-25 17:16:08 +01:00
virscsidata
virstorageutildata
virusbtestdata/sys_bus_usb/devices
vmwareverdata
vmx2xmldata vmx: convert cpuid.coresPerSocket for CPU topology 2018-04-20 09:09:29 +02:00
xlconfigdata tests: add test case for CPUID in xenconfig driver 2018-04-17 21:15:27 -06:00
xmconfigdata tests: xmconfigtest: add tests for cmdline formating 2018-06-04 20:59:16 -06:00
xml2sexprdata tests: move xml2sexpr tests to WITH_LIBXL 2018-04-09 11:33:30 -06:00
xml2vmxdata vmx: write cpuid.coresPerSocket back from CPU topology 2018-04-20 09:11:01 +02:00
.valgrind.supp
bhyveargv2xmlmock.c conf: move 'generated' member from virMacAddr to virDomainNetDef 2018-02-19 13:15:00 -05:00
bhyveargv2xmltest.c bhyve: add tests for wiring memory 2018-05-13 13:38:31 +04:00
bhyvexml2argvmock.c port allocator: drop skip bind check flag 2018-02-22 13:52:45 +01:00
bhyvexml2argvtest.c bhyve: Add CPU topology support 2018-06-07 19:26:26 +04:00
bhyvexml2xmltest.c bhyve: add tests for wiring memory 2018-05-13 13:38:31 +04:00
check-file-access.pl perl: Don't hardcode interpreter path 2017-09-19 16:04:53 +02:00
commandhelper.c tests: Return failure if log not fopen'd 2018-04-19 14:24:12 -04:00
commandtest.c all: Replace virGetLastError with virGetLastErrorCode where we can 2018-06-05 18:44:05 +02:00
cputest.c cpu: Add optional list of allowed features to virCPUBaseline 2018-05-28 15:59:11 +02:00
domaincapsmock.c
domaincapstest.c tests: qemucapabilities: Drop mostly duplicated data 2018-03-23 20:27:52 +01:00
domainconftest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
domainsnapshotxml2xmltest.c tests: domainsnapshotxml2xml: Remove testing with allowed format detection 2018-03-13 13:54:06 +01:00
esxutilstest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
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 syntax-check: pass srcdir to group-qemu-caps.pl 2018-04-26 13:39:10 +02:00
interfacexml2xmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
libvirtd-fail
libvirtd-pool
libxlxml2domconfigtest.c test: Check return status for libxlxml2domconfigtest 2018-06-11 18:33:13 -04:00
lxcconf2xmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
lxcxml2xmltest.c tests: util: Remove callback from testCompareDomXML2XMLFiles 2018-03-13 13:54:11 +01:00
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 Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
networkxml2firewalltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
networkxml2xmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
networkxml2xmlupdatetest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
nodedevxml2xmltest.c schema: Add missing block data for nodedev 2018-05-25 09:36:42 -04:00
nsslinktest.c
nssmock.c tests: Fix mode_t usage with va_arg() 2018-05-03 18:23:30 +02:00
nsstest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
nwfilterebiptablestest.c
nwfilterxml2firewalltest.c nwfilter: remove virNWFilterHashTable typedefs entirely 2018-05-03 17:00:57 +01:00
nwfilterxml2xmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
objecteventtest.c tests: initialize some variables 2018-05-30 15:54:58 +02:00
objectlocking.ml
oomtrace.pl perl: Don't hardcode interpreter path 2017-09-19 16:04:53 +02:00
openvzutilstest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
openvzutilstest.conf
pkix_asn1_tab.c
qemuagenttest.c tests: replace references to yajl 2018-05-11 13:28:35 +02:00
qemuargv2xmltest.c test: Drop useless prefix for qemuargv2xml test data 2017-12-05 14:52:49 +01:00
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 tests: replace references to yajl 2018-05-11 13:28:35 +02:00
qemucapsfixreplies tests: Fix qemucapsfixreplies 2018-06-19 14:01:14 +02:00
qemucapsprobe.c Force QMP capability probing 2018-04-10 15:16:23 +02:00
qemucapsprobemock.c tests: qemucapsprobemock: Prepare 'qemucapsprobe' for the new format 2018-06-12 10:27:50 +02:00
qemucommandutiltest.c tests: replace references to yajl 2018-05-11 13:28:35 +02:00
qemucpumock.c
qemuhotplugtest.c qemu_hotplug: Allow asynchronous detach 2018-05-28 13:08:52 +02:00
qemumemlocktest.c qemu: Complete PCI command checks to controller def validate 2018-02-02 14:52:23 -05:00
qemumigparamstest.c tests: replace references to yajl 2018-05-11 13:28:35 +02:00
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 tests: add qemumonitorjson tests for query-cpus-fast 2018-04-17 12:45:26 -04:00
qemuqapischema.json tests: Add data file with QEMU QAPI schema 2018-03-23 14:52:07 +01:00
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 Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
securityselinuxhelper.c
securityselinuxlabeltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
securityselinuxtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
sexpr2xmltest.c tests: move sexpr2xml tests to WITH_LIBXL 2018-04-09 11:34:35 -06:00
shunloadhelper.c
shunloadtest.c
sockettest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
ssh.c
storagebackendsheepdogtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
storagepoolxml2xmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
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 Fix build with clang 6.0.0 2018-03-12 20:04:08 +04:00
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 tests: Create full host NUMA topology in more cases 2018-04-19 17:57:52 +02:00
testutilshostcpus.h
testutilslxc.c
testutilslxc.h
testutilsqemu.c tests: Create full host NUMA topology in more cases 2018-04-19 17:57:52 +02:00
testutilsqemu.h tests: qemu: Add helper code to lookup latest capability file 2018-04-19 11:20:34 +02:00
testutilsqemuschema.c util: Clean up consumers of virJSONValueArraySize 2018-05-10 14:59:15 -04:00
testutilsqemuschema.h tests: qemu: Add infrastructure for QAPI schema testing 2018-03-23 14:52:07 +01:00
testutilsxen.c Remove xencaps tests and data files 2018-04-09 11:37:15 -06:00
testutilsxen.h Remove xencaps tests and data files 2018-04-09 11:37:15 -06:00
utiltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
vboxsnapshotxmltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
viralloctest.c
viratomictest.c
virauthconfigtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virbitmaptest.c util: bitmap: Use VIR_SHRINK_N in virBitmapShrink 2018-02-05 16:08:57 +01:00
virbuftest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
vircaps2xmltest.c build: Fix make dist 2017-11-22 11:27:40 +01:00
vircapstest.c tests: Create full host NUMA topology in more cases 2018-04-19 17:57:52 +02:00
vircgroupmock.c tests: Fix mode_t usage with va_arg() 2018-05-03 18:23:30 +02:00
vircgrouptest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virconftest.c virconf: properly set the end of content 2017-11-09 08:04:26 -07:00
vircryptotest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virdbusmock.c
virdbustest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virdeterministichashmock.c
virdrivermoduletest.c driver: add option to make missing drivers a fatal problem 2018-04-24 17:01:48 +01:00
virendiantest.c
virfilecachemock.c
virfilecachetest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virfiletest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virfilewrapper.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virfilewrapper.h
virfirewalltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virhashdata.h
virhashtest.c util: don't check for parallel iteration in hash-related functions 2018-04-11 11:18:37 +02:00
virhostcpumock.c
virhostcputest.c all: Replace virGetLastError with virGetLastErrorCode where we can 2018-06-05 18:44:05 +02:00
virhostdevtest.c qemu: Remove private hostdev 2017-11-24 11:47:26 -05:00
viridentitytest.c
viriscsitest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virjsontest.c virjsontest: Use a more stable floating point number for testing 2018-04-04 15:08:32 +02:00
virkeycodetest.c keycodemapdb: Update submodule 2018-03-12 16:30:49 +01:00
virkeyfiletest.c
virkmodtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virlockspacetest.c
virlogtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virmacmaptest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virmock.h Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virmocklibxl.c virmocklibxl.c: Fix include of virfile.h 2018-04-18 09:59:52 +02:00
virnetdaemonmock.c
virnetdaemontest.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virnetdevbandwidthmock.c
virnetdevbandwidthtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virnetdevmock.c
virnetdevtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
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 tests: force use of "NORMAL" TLS priority in test suite 2018-03-06 10:09:44 +00:00
virnettlshelpers.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virnettlshelpers.h
virnettlssessiontest.c tests: force use of "NORMAL" TLS priority in test suite 2018-03-06 10:09:44 +00:00
virnumamock.c virNumaGetHugePageInfo: Return page_avail and page_free as ULL 2018-04-24 11:02:28 +02:00
virnwfilterbindingxml2xmltest.c conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
virpcimock.c tests: Build virpcimock on FreeBSD too 2018-05-03 18:23:30 +02:00
virpcitest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virpolkittest.c
virportallocatormock.c
virportallocatortest.c port allocator: drop skip bind check flag 2018-02-22 13:52:45 +01:00
virrandommock.c src: Drop most of #ifdef WITH_GNUTLS 2018-06-05 14:32:36 +02:00
virresctrltest.c tests: Add virresctrltest 2018-01-25 17:16:08 +01:00
virrotatingfiletest.c
virschematest.c schemas: add schema for nwfilter binding XML document 2018-06-26 11:22:07 +01:00
virscsitest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
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 tests: run virshtest independent of current pwd 2018-02-13 10:27:32 -05:00
virstoragetest.c util: storage: remove 'allow_probe' from virStorageFileGetMetadata 2018-06-08 09:26:38 +02:00
virstorageutiltest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virstringtest.c virstringtest: Fix alignment of backslashes 2018-01-04 09:29:49 +01:00
virsystemdtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virt-aa-helper-test virt-aa-helper: test: check for expected profile content 2018-03-23 07:14:58 +01:00
virt-admin-self-test
virtestmock.c tests: Fix mode_t usage with va_arg() 2018-05-03 18:23:30 +02:00
virtimetest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virtypedparamtest.c
viruritest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
virusbmock.c tests: Fix build with clang 2017-10-05 09:09:50 +02:00
virusbtest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
vmwarevertest.c Remove backslash alignment attempts 2017-11-03 13:24:12 +01:00
vmx2xmltest.c schema,tests: Use vpxmigr for host migrate transport capability 2018-05-25 09:33:39 -04:00
xlconfigtest.c xenconfig: remove my name and email from files 2018-05-08 13:45:51 +01:00
xmconfigtest.c tests: xmconfigtest: add tests for cmdline formating 2018-06-04 20:59:16 -06:00
xml2sexprtest.c tests: move xml2sexpr tests to WITH_LIBXL 2018-04-09 11:33:30 -06:00
xml2vmxtest.c vmx: write cpuid.coresPerSocket back from CPU topology 2018-04-20 09:11:01 +02:00