[PATCH 4/4] libvirt: tests: test protected key mgmt ops support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tony Krowiak <aekrowia@xxxxxxxxxx>

Test the support for enabling/disabling CPACF protected key management
operations for a guest.

Signed-off-by: Tony Krowiak <akrowiak@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c                       |    9 ++
 src/qemu/qemu_capabilities.h                       |    2 +
 tests/qemuargv2xmltest.c                           |    6 +
 .../qemuxml2argv-machine-aeskeywrap-off-argv.args  |    6 +
 .../qemuxml2argv-machine-aeskeywrap-off-argv.xml   |   27 ++++
 .../qemuxml2argv-machine-aeskeywrap-off-cap.args   |    7 +
 .../qemuxml2argv-machine-aeskeywrap-off-cap.xml    |   28 +++++
 .../qemuxml2argv-machine-aeskeywrap-off-caps.args  |    7 +
 .../qemuxml2argv-machine-aeskeywrap-off-caps.xml   |   28 +++++
 .../qemuxml2argv-machine-aeskeywrap-on-argv.args   |    6 +
 .../qemuxml2argv-machine-aeskeywrap-on-argv.xml    |   27 ++++
 .../qemuxml2argv-machine-aeskeywrap-on-cap.args    |    7 +
 .../qemuxml2argv-machine-aeskeywrap-on-cap.xml     |   28 +++++
 .../qemuxml2argv-machine-aeskeywrap-on-caps.args   |    7 +
 .../qemuxml2argv-machine-aeskeywrap-on-caps.xml    |   27 ++++
 .../qemuxml2argv-machine-deakeywrap-off-argv.args  |    6 +
 .../qemuxml2argv-machine-deakeywrap-off-argv.xml   |   27 ++++
 .../qemuxml2argv-machine-deakeywrap-off-cap.args   |    7 +
 .../qemuxml2argv-machine-deakeywrap-off-cap.xml    |   28 +++++
 .../qemuxml2argv-machine-deakeywrap-off-caps.args  |    7 +
 .../qemuxml2argv-machine-deakeywrap-off-caps.xml   |   28 +++++
 .../qemuxml2argv-machine-deakeywrap-on-argv.args   |    6 +
 .../qemuxml2argv-machine-deakeywrap-on-argv.xml    |   27 ++++
 .../qemuxml2argv-machine-deakeywrap-on-cap.args    |    7 +
 .../qemuxml2argv-machine-deakeywrap-on-cap.xml     |   28 +++++
 .../qemuxml2argv-machine-deakeywrap-on-caps.args   |    7 +
 .../qemuxml2argv-machine-deakeywrap-on-caps.xml    |   28 +++++
 .../qemuxml2argv-machine-keywrap-none-argv.args    |    6 +
 .../qemuxml2argv-machine-keywrap-none-argv.xml     |   24 ++++
 .../qemuxml2argv-machine-keywrap-none-caps.args    |    7 +
 .../qemuxml2argv-machine-keywrap-none-caps.xml     |   25 ++++
 .../qemuxml2argv-machine-keywrap-none.args         |    7 +
 .../qemuxml2argv-machine-keywrap-none.xml          |   25 ++++
 tests/qemuxml2argvtest.c                           |  127 ++++++++++++++++++--
 34 files changed, 637 insertions(+), 12 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d1b9f6f..e5fd7cc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3558,6 +3558,15 @@ virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
 }
 
 
+int
+virQEMUCacheCapsForBinary(virQEMUCapsCachePtr cache, const char *binary,
+                          virQEMUCapsPtr qemuCaps)
+{
+    return virHashAddEntry(cache->binaries, binary,
+                           virQEMUCapsNewCopy(qemuCaps));
+}
+
+
 virQEMUCapsCachePtr
 virQEMUCapsCacheNew(const char *libDir,
                     const char *cacheDir,
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 31e0494..8c3042d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -293,6 +293,8 @@ void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
 virQEMUCapsCachePtr virQEMUCapsCacheNew(const char *libDir,
                                         const char *cacheDir,
                                         uid_t uid, gid_t gid);
+int virQEMUCacheCapsForBinary(virQEMUCapsCachePtr cache, const char *binary,
+                              virQEMUCapsPtr qemuCaps);
 virQEMUCapsPtr virQEMUCapsCacheLookup(virQEMUCapsCachePtr cache,
                                       const char *binary);
 virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache,
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index d6df116..ea85913 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -292,6 +292,12 @@ mymain(void)
 
     DO_TEST_FULL("qemu-ns-no-env", FLAG_EXPECT_WARNING);
 
+    DO_TEST("machine-aeskeywrap-on-argv");
+    DO_TEST("machine-aeskeywrap-off-argv");
+    DO_TEST("machine-deakeywrap-on-argv");
+    DO_TEST("machine-deakeywrap-off-argv");
+    DO_TEST("machine-keywrap-none-argv");
+
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.args
new file mode 100644
index 0000000..4ef9fc0
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=off \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=virtio,index=0,id=drive-virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.xml
new file mode 100644
index 0000000..0975d4a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-argv.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.args
new file mode 100644
index 0000000..80caba7
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=off \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.xml
new file mode 100644
index 0000000..a0c0037
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-cap.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.args
new file mode 100644
index 0000000..a20e49a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=off,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.xml
new file mode 100644
index 0000000..a0c0037
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-off-caps.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.args
new file mode 100644
index 0000000..2b238d5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=virtio,index=0,id=drive-virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.xml
new file mode 100644
index 0000000..8aa8f8e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-argv.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.args
new file mode 100644
index 0000000..6f6366b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.xml
new file mode 100644
index 0000000..768eed1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-cap.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.args
new file mode 100644
index 0000000..ad8d7b4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.xml
new file mode 100644
index 0000000..1702e6e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-aeskeywrap-on-caps.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='aes' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.args
new file mode 100644
index 0000000..f38c914
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,dea-key-wrap=off \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=virtio,index=0,id=drive-virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.xml
new file mode 100644
index 0000000..90b6d9f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-argv.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.args
new file mode 100644
index 0000000..e379f15
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,dea-key-wrap=off \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.xml
new file mode 100644
index 0000000..dbc22fc
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-cap.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.args
new file mode 100644
index 0000000..861b46b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on,dea-key-wrap=off \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.xml
new file mode 100644
index 0000000..dbc22fc
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-off-caps.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='off'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.args
new file mode 100644
index 0000000..f64e57f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=virtio,index=0,id=drive-virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.xml
new file mode 100644
index 0000000..76a6a51
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-argv.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.args
new file mode 100644
index 0000000..9c4b513
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.xml
new file mode 100644
index 0000000..c0a063b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-cap.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.args
new file mode 100644
index 0000000..ad8d7b4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.xml
new file mode 100644
index 0000000..c0a063b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-deakeywrap-on-caps.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+  <keywrap>
+    <cipher name='dea' state='on'/>
+  </keywrap>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.args
new file mode 100644
index 0000000..9264ec4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=virtio,index=0,id=drive-virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.xml
new file mode 100644
index 0000000..0a963a1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-argv.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.args
new file mode 100644
index 0000000..ad8d7b4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg,aes-key-wrap=on,dea-key-wrap=on \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.xml
new file mode 100644
index 0000000..9727686
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none-caps.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.args
new file mode 100644
index 0000000..f4bd156
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x -S \
+-machine s390-ccw-virtio,accel=tcg \
+-m 214 -smp 1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.xml
new file mode 100644
index 0000000..9727686
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-keywrap-none.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </disk>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0763068..5d72b92 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -520,7 +520,7 @@ mymain(void)
     if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
         return EXIT_FAILURE;
 
-# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, ...)         \
+# define DO_TEST_FULL(name, migrateFrom, migrateFd, binary, flags, ...) \
     do {                                                                \
         static struct testInfo info = {                                 \
             name, NULL, migrateFrom, migrateFd, (flags)                 \
@@ -530,6 +530,15 @@ mymain(void)
         if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0)      \
             return EXIT_FAILURE;                                        \
         virQEMUCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);\
+        if (binary) {                                                          \
+            driver.qemuCapsCache = virQEMUCapsCacheNew(driver.config->libDir,  \
+                                                       driver.config->cacheDir,\
+                                                       driver.config->user,    \
+                                                       driver.config->group);  \
+            if (virQEMUCacheCapsForBinary(driver.qemuCapsCache,         \
+                                          binary, info.extraFlags) < 0) \
+                return EXIT_FAILURE;                                    \
+        }                                                               \
         if (virtTestRun("QEMU XML-2-ARGV " name,                        \
                         testCompareXMLToArgvHelper, &info) < 0)         \
             ret = -1;                                                   \
@@ -537,16 +546,19 @@ mymain(void)
     } while (0)
 
 # define DO_TEST(name, ...)                                             \
-    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)
+    DO_TEST_FULL(name, NULL, -1, NULL, 0, __VA_ARGS__)
+
+# define DO_TEST_CACHE_CAPS(name, binary, ...)                          \
+    DO_TEST_FULL(name, NULL, -1, binary, 0, __VA_ARGS__)
 
 # define DO_TEST_ERROR(name, ...)                                       \
-    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_ERROR, __VA_ARGS__)
+    DO_TEST_FULL(name, NULL, -1, NULL, FLAG_EXPECT_ERROR, __VA_ARGS__)
 
 # define DO_TEST_FAILURE(name, ...)                                     \
-    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, __VA_ARGS__)
+    DO_TEST_FULL(name, NULL, -1, NULL,  FLAG_EXPECT_FAILURE, __VA_ARGS__)
 
 # define DO_TEST_PARSE_ERROR(name, ...)                                 \
-    DO_TEST_FULL(name, NULL, -1,                                        \
+    DO_TEST_FULL(name, NULL, -1, NULL,                                  \
                  FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_ERROR,           \
                  __VA_ARGS__)
 
@@ -557,7 +569,7 @@ mymain(void)
      * predictable NUMA topology and so on). On non-Linux
      * platforms the macro just consume its argument. */
 #  define DO_TEST_LINUX(name, ...)                                      \
-    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)
+    DO_TEST_FULL(name, NULL, -1, NULL, 0, __VA_ARGS__)
 # else  /* __linux__ */
 #  define DO_TEST_LINUX(name, ...)                                      \
     do {                                                                \
@@ -1204,12 +1216,12 @@ mymain(void)
             QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_PCI_ROMBAR);
 
-    DO_TEST_FULL("restore-v1", "stdio", 7, 0, QEMU_CAPS_MIGRATE_KVM_STDIO);
-    DO_TEST_FULL("restore-v2", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
-    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
-    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
-    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
-    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0,
+    DO_TEST_FULL("restore-v1", "stdio", 7, NULL, 0, QEMU_CAPS_MIGRATE_KVM_STDIO);
+    DO_TEST_FULL("restore-v2", "stdio", 7, NULL, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+    DO_TEST_FULL("restore-v2", "exec:cat", 7, NULL, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+    DO_TEST_FULL("restore-v2-fd", "stdio", 7, NULL, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
+    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, NULL, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
+    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, NULL, 0,
             QEMU_CAPS_MIGRATE_QEMU_TCP);
 
     DO_TEST("qemu-ns", NONE);
@@ -1565,6 +1577,97 @@ mymain(void)
     DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
             QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM);
 
+    DO_TEST_CACHE_CAPS("machine-aeskeywrap-on-caps",
+                       "/usr/bin/qemu-system-s390x",
+                       QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
+                       QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-aeskeywrap-on-cap",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-aeskeywrap-off-caps",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
+                       QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-aeskeywrap-off-cap",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-deakeywrap-on-caps",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
+                       QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-on-caps", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DRIVE,
+                    QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-deakeywrap-on-cap",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-on-cap", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-deakeywrap-off-caps",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
+                       QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-deakeywrap-off-cap",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
+                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_FAILURE("machine-deakeywrap-off-cap", NONE);
+
+    DO_TEST_CACHE_CAPS("machine-keywrap-none-caps",
+                       "/usr/bin/qemu-system-s390x", QEMU_CAPS_MACHINE_OPT,
+                       QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
+                       QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_CACHE_CAPS("machine-keywrap-none", "/usr/bin/qemu-system-s390x",
+                       QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DRIVE,
+                       QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
+                       QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]