[PATCH 35/35] tests: Add qemuxml2argv and qemuxml2xml test for <transient shareBacking='yes'>

Peter Krempa pkrempa at redhat.com
Fri May 21 12:47:35 UTC 2021


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 .../disk-transient.x86_64-4.1.0.err           |  2 +-
 .../disk-transient.x86_64-latest.args         |  4 +-
 tests/qemuxml2argvdata/disk-transient.xml     |  6 +++
 .../disk-transient.x86_64-latest.xml          | 48 +++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  1 +
 5 files changed, 58 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2xmloutdata/disk-transient.x86_64-latest.xml

diff --git a/tests/qemuxml2argvdata/disk-transient.x86_64-4.1.0.err b/tests/qemuxml2argvdata/disk-transient.x86_64-4.1.0.err
index eb5af4762d..493da051e3 100644
--- a/tests/qemuxml2argvdata/disk-transient.x86_64-4.1.0.err
+++ b/tests/qemuxml2argvdata/disk-transient.x86_64-4.1.0.err
@@ -1 +1 @@
-unsupported configuration: transient disk not supported by this QEMU binary (hda)
+unsupported configuration: transient disk not supported by this QEMU binary (vda)
diff --git a/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args b/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args
index 41f6400891..18f16c3489 100644
--- a/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-transient.x86_64-latest.args
@@ -29,8 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -blockdev '{"driver":"file","filename":"/tmp/QEMUGuest1.img","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \
--device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \
+-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,write-cache=on \
 -audiodev id=audio1,driver=none \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-transient.xml b/tests/qemuxml2argvdata/disk-transient.xml
index cffb325336..49613a88b2 100644
--- a/tests/qemuxml2argvdata/disk-transient.xml
+++ b/tests/qemuxml2argvdata/disk-transient.xml
@@ -14,6 +14,12 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-i386</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/tmp/QEMUGuest2.img'/>
+      <target dev='vda' bus='virtio'/>
+      <transient shareBacking='yes'/>
+    </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2' cache='none'/>
       <source file='/tmp/QEMUGuest1.img'/>
diff --git a/tests/qemuxml2xmloutdata/disk-transient.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-transient.x86_64-latest.xml
new file mode 100644
index 0000000000..988706002d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-transient.x86_64-latest.xml
@@ -0,0 +1,48 @@
+<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='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-i386</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/tmp/QEMUGuest2.img'/>
+      <target dev='vda' bus='virtio'/>
+      <transient shareBacking='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source file='/tmp/QEMUGuest1.img'/>
+      <target dev='hda' bus='ide'/>
+      <transient/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0' model='piix3-uhci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b2bf792743..da85e860a4 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -307,6 +307,7 @@ mymain(void)
     DO_TEST("disk-boot-disk", NONE);
     DO_TEST("disk-boot-cdrom", NONE);
     DO_TEST("disk-error-policy", NONE);
+    DO_TEST_CAPS_LATEST("disk-transient");
     DO_TEST("disk-fmt-qcow", NONE);
     DO_TEST_CAPS_VER("disk-cache", "2.12.0");
     DO_TEST_CAPS_LATEST("disk-cache");
-- 
2.31.1




More information about the libvir-list mailing list