From: Peter Krempa <[email protected]>

Add test cases for all three options 'off'/'on'/'unmap' as well as add
backing store for each image to show how the configuration behaves.

Signed-off-by: Peter Krempa <[email protected]>
---
 .../disk-detect-zeroes.x86_64-latest.args     | 20 +++++++++---
 tests/qemuxmlconfdata/disk-detect-zeroes.xml  | 31 +++++++++++++++++--
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/tests/qemuxmlconfdata/disk-detect-zeroes.x86_64-latest.args 
b/tests/qemuxmlconfdata/disk-detect-zeroes.x86_64-latest.args
index 07acc46113..d959d4a717 100644
--- a/tests/qemuxmlconfdata/disk-detect-zeroes.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/disk-detect-zeroes.x86_64-latest.args
@@ -27,10 +27,22 @@ 
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \
 -no-shutdown \
 -boot menu=on,strict=on \
 -device 
'{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/f14.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
 \
--blockdev 
'{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","detect-zeroes":"unmap","driver":"qcow2","file":"libvirt-2-storage"}'
 \
--device 
'{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-2-format","id":"virtio-disk0","bootindex":2}'
 \
--blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso","node-name":"libvirt-1-storage","read-only":true,"discard":"ignore","detect-zeroes":"on"}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-unmap-back.img","node-name":"libvirt-7-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-7-format","read-only":true,"discard":"unmap","driver":"qcow2","file":"libvirt-7-storage","backing":null}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-unmap.img","node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-6-format","read-only":false,"discard":"unmap","detect-zeroes":"unmap","driver":"qcow2","file":"libvirt-6-storage","backing":"libvirt-7-format"}'
 \
+-device 
'{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-6-format","id":"virtio-disk0","bootindex":2}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-on-back.img","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-5-format","read-only":true,"discard":"unmap","driver":"qcow2","file":"libvirt-5-storage","backing":null}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-on.img","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-4-format","read-only":false,"discard":"unmap","detect-zeroes":"on","driver":"qcow2","file":"libvirt-4-storage","backing":"libvirt-5-format"}'
 \
+-device 
'{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-4-format","id":"virtio-disk1"}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-off-back.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-3-format","read-only":true,"discard":"unmap","driver":"qcow2","file":"libvirt-3-storage","backing":null}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/images/detect-zeroes-off.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev 
'{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","detect-zeroes":"off","driver":"qcow2","file":"libvirt-2-storage","backing":"libvirt-3-format"}'
 \
+-device 
'{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk2"}'
 \
+-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/detect-zeroes-cdrom.iso","node-name":"libvirt-1-storage","read-only":true,"discard":"ignore","detect-zeroes":"on"}'
 \
 -device 
'{"driver":"ide-cd","bus":"ide.1","unit":0,"drive":"libvirt-1-storage","id":"ide0-1-0","bootindex":1}'
 \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device 
'{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
diff --git a/tests/qemuxmlconfdata/disk-detect-zeroes.xml 
b/tests/qemuxmlconfdata/disk-detect-zeroes.xml
index ca3732c391..3ea15c3a46 100644
--- a/tests/qemuxmlconfdata/disk-detect-zeroes.xml
+++ b/tests/qemuxmlconfdata/disk-detect-zeroes.xml
@@ -21,13 +21,40 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2' discard='unmap' detect_zeroes='unmap'/>
-      <source file='/var/lib/libvirt/images/f14.img'/>
+      <source file='/var/lib/libvirt/images/detect-zeroes-unmap.img'/>
+      <backingStore type='file'>
+        <format type='qcow2'/>
+        <source file='/var/lib/libvirt/images/detect-zeroes-unmap-back.img'/>
+        <backingStore/>
+      </backingStore>
       <target dev='vda' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
     </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' discard='unmap' detect_zeroes='on'/>
+      <source file='/var/lib/libvirt/images/detect-zeroes-on.img'/>
+      <backingStore type='file'>
+        <format type='qcow2'/>
+        <source file='/var/lib/libvirt/images/detect-zeroes-on-back.img'/>
+        <backingStore/>
+      </backingStore>
+      <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 
function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2' discard='unmap' detect_zeroes='off'/>
+      <source file='/var/lib/libvirt/images/detect-zeroes-off.img'/>
+      <backingStore type='file'>
+        <format type='qcow2'/>
+        <source file='/var/lib/libvirt/images/detect-zeroes-off-back.img'/>
+        <backingStore/>
+      </backingStore>
+      <target dev='vdc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
function='0x0'/>
+    </disk>
     <disk type='file' device='cdrom'>
       <driver name='qemu' type='raw' discard='ignore' detect_zeroes='unmap'/>
-      <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+      <source file='/var/lib/libvirt/detect-zeroes-cdrom.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
-- 
2.51.1

Reply via email to