[libvirt] [RFC PATCH 2/4] tests: qemu: Modernize/remove qcow2 encryption from tests not related to storage

Peter Krempa pkrempa at redhat.com
Tue May 22 14:04:55 UTC 2018


Remove the storage encryption completely from interface-server.xml as it
serves no purpose there.

For the user-alias test use the 'luks' encryption type for qcow to test
that the names of the secret objects are generated properly.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemuxml2argvdata/interface-server.xml   | 3 ---
 tests/qemuxml2argvdata/user-aliases.args      | 8 +++++++-
 tests/qemuxml2argvdata/user-aliases.xml       | 2 +-
 tests/qemuxml2argvtest.c                      | 3 ++-
 tests/qemuxml2xmloutdata/interface-server.xml | 3 ---
 tests/qemuxml2xmltest.c                       | 2 +-
 6 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/qemuxml2argvdata/interface-server.xml b/tests/qemuxml2argvdata/interface-server.xml
index a92aff4218..7bf119197a 100644
--- a/tests/qemuxml2argvdata/interface-server.xml
+++ b/tests/qemuxml2argvdata/interface-server.xml
@@ -53,9 +53,6 @@
       <driver name='qemu' type='qcow2'/>
       <source file='/var/lib/libvirt/images/OtherDemo.img'/>
       <target dev='vdb' bus='virtio'/>
-      <encryption format='qcow'>
-        <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
-      </encryption>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='cdrom'>
diff --git a/tests/qemuxml2argvdata/user-aliases.args b/tests/qemuxml2argvdata/user-aliases.args
index 5ef52fc556..293dc919d5 100644
--- a/tests/qemuxml2argvdata/user-aliases.args
+++ b/tests/qemuxml2argvdata/user-aliases.args
@@ -7,6 +7,8 @@ QEMU_AUDIO_DRV=none \
 /usr/bin/qemu-system-x86_64 \
 -name gentoo \
 -S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-gentoo/master-key.aes \
 -machine pc-i440fx-1.4,accel=kvm,usb=off,dump-guest-core=off \
 -m 4096 \
 -smp 4,sockets=4,cores=1,threads=1 \
@@ -43,7 +45,11 @@ id=drive-ua-myDisk1,cache=none \
 -drive file=/var/lib/libvirt/images/gentoo.qcow2,format=qcow2,if=none,\
 id=drive-ua-myDisk2 \
 -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-ua-myDisk2,id=ua-myDisk2 \
--drive file=/var/lib/libvirt/images/OtherDemo.img,format=qcow2,if=none,\
+-object secret,id=ua-myEncryptedDisk1-luks-secret0,\
+data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
+keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
+-drive file=/var/lib/libvirt/images/OtherDemo.img,encrypt.format=luks,\
+encrypt.key-secret=ua-myEncryptedDisk1-luks-secret0,format=qcow2,if=none,\
 id=drive-ua-myEncryptedDisk1 \
 -device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-ua-myEncryptedDisk1,\
 id=ua-myEncryptedDisk1 \
diff --git a/tests/qemuxml2argvdata/user-aliases.xml b/tests/qemuxml2argvdata/user-aliases.xml
index 9ce123b477..98b4845e52 100644
--- a/tests/qemuxml2argvdata/user-aliases.xml
+++ b/tests/qemuxml2argvdata/user-aliases.xml
@@ -55,7 +55,7 @@
       <driver name='qemu' type='qcow2'/>
       <source file='/var/lib/libvirt/images/OtherDemo.img'/>
       <target dev='vdb' bus='virtio'/>
-      <encryption format='qcow'>
+      <encryption format='luks'>
         <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
       </encryption>
       <alias name='ua-myEncryptedDisk1'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 78454acb1a..ee2b0ccff8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2819,7 +2819,8 @@ mymain(void)
             QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
             QEMU_CAPS_DEVICE_ISA_SERIAL,
             QEMU_CAPS_HDA_DUPLEX,
-            QEMU_CAPS_CCID_EMULATED);
+            QEMU_CAPS_CCID_EMULATED,
+            QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
     DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
     DO_TEST("user-aliases-usb", QEMU_CAPS_KVM,
             QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
diff --git a/tests/qemuxml2xmloutdata/interface-server.xml b/tests/qemuxml2xmloutdata/interface-server.xml
index 049b1472a8..75b12bf96f 100644
--- a/tests/qemuxml2xmloutdata/interface-server.xml
+++ b/tests/qemuxml2xmloutdata/interface-server.xml
@@ -53,9 +53,6 @@
       <driver name='qemu' type='qcow2'/>
       <source file='/var/lib/libvirt/images/OtherDemo.img'/>
       <target dev='vdb' bus='virtio'/>
-      <encryption format='qcow'>
-        <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
-      </encryption>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </disk>
     <disk type='file' device='cdrom'>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7cedc2b999..5755800dcf 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1171,7 +1171,7 @@ mymain(void)
     DO_TEST("pseries-cpu-exact",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);

-    DO_TEST("user-aliases", NONE);
+    DO_TEST("user-aliases", QEMU_CAPS_QCOW2_LUKS);
     DO_TEST("input-virtio-ccw",
             QEMU_CAPS_CCW,
             QEMU_CAPS_VIRTIO_KEYBOARD,
-- 
2.16.2




More information about the libvir-list mailing list