[libvirt] [PATCH 4/6] conf: Add invalid domain disk encryption test

John Ferlan jferlan at redhat.com
Thu Sep 14 18:03:08 UTC 2017


Add a test to prove checking for invalid luks disk formatting check

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 .../qemuxml2argv-luks-disk-invalid.xml             | 37 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-luks-disk-invalid.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-luks-disk-invalid.xml b/tests/qemuxml2argvdata/qemuxml2argv-luks-disk-invalid.xml
new file mode 100644
index 000000000..bea769584
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-luks-disk-invalid.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+  <name>encryptdisk</name>
+  <uuid>496898a6-e6ff-f7c8-5dc2-3cf410945ee9</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>524288</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-i440fx-2.1'>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-x86_64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/storage/guest_disks/encryptdisk'/>
+      <target dev='vda' bus='virtio'/>
+      <encryption format='luks'>
+        <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
+        <cipher name='serpent' size='256' mode='cbc' hash='sha256'/>
+      </encryption>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fd05155ef..c8c479cbd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1647,6 +1647,7 @@ mymain(void)
 # else
     DO_TEST_FAILURE("luks-disks", QEMU_CAPS_OBJECT_SECRET);
 # endif
+    DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
 
     DO_TEST("memtune", NONE);
     DO_TEST("memtune-unlimited", NONE);
-- 
2.13.5




More information about the libvir-list mailing list