Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../disk-slices.x86_64-latest.args | 53 ++++++++++++++++++
tests/qemuxml2argvdata/disk-slices.xml | 45 +++++++++++++++
tests/qemuxml2argvtest.c | 2 +
.../disk-slices.x86_64-latest.xml | 56 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
5 files changed, 158 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-slices.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
new file mode 100644
index 0000000000..49daa293a4
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
@@ -0,0 +1,53 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i386 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-cpu qemu64 \
+-m 214 \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\
+"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-3-format","read-only":false,"driver":"raw",\
+"offset":1234,"size":321,"file":"libvirt-3-storage"}'
\
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=libvirt-3-format,\
+id=virtio-disk0,bootindex=1 \
+-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\
+"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"driver":"raw","node-name":"libvirt-2-slice-sto","offset":9876,\
+"size":123456789,"file":"libvirt-2-storage","auto-read-only":true,\
+"discard":"unmap"}' \
+-blockdev
'{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2",\
+"file":"libvirt-2-slice-sto","backing":null}' \
+-blockdev
'{"driver":"file","filename":"/var/lib/libvirt/images/overlay.qcow2",\
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2",\
+"file":"libvirt-1-storage","backing":"libvirt-2-format"}'
\
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-1-format,\
+id=virtio-disk1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-slices.xml
b/tests/qemuxml2argvdata/disk-slices.xml
new file mode 100644
index 0000000000..cff7cc7ee4
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-slices.xml
@@ -0,0 +1,45 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>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-i386</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='/var/lib/libvirt/images/raw.img'>
+ <slices>
+ <slice type='storage' offset='1234' size='321'/>
+ </slices>
+ </source>
+ <backingStore/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/overlay.qcow2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/raw.img'>
+ <slices>
+ <slice type='storage' offset='9876'
size='123456789'/>
+ </slices>
+ </source>
+ <backingStore/>
+ </backingStore>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <controller type='usb'/>
+ <controller type='pci' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 028364a06c..0dbaab4c32 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1165,6 +1165,8 @@ mymain(void)
DO_TEST_CAPS_VER("disk-backing-chains-noindex", "2.12.0");
DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
+ DO_TEST_CAPS_LATEST("disk-slices");
+
DO_TEST("graphics-egl-headless",
QEMU_CAPS_EGL_HEADLESS,
QEMU_CAPS_DEVICE_CIRRUS_VGA);
diff --git a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
new file mode 100644
index 0000000000..65590df417
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml
@@ -0,0 +1,56 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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='raw'/>
+ <source file='/var/lib/libvirt/images/raw.img'>
+ <slices>
+ <slice type='storage' offset='1234' size='321'/>
+ </slices>
+ </source>
+ <backingStore/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/overlay.qcow2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/raw.img'>
+ <slices>
+ <slice type='storage' offset='9876'
size='123456789'/>
+ </slices>
+ </source>
+ <backingStore/>
+ </backingStore>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <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='0x04' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index ecd12c3d30..b6072075c7 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -530,6 +530,8 @@ mymain(void)
DO_TEST("pci-rom-disabled-invalid", NONE);
DO_TEST("pci-serial-dev-chardev", NONE);
+ DO_TEST_CAPS_LATEST("disk-slices");
+
DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS);
DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS);
DO_TEST("luks-disks", NONE);
--
2.24.1