Add test data for nested backing chains with/without indexes (used in
status XMLs) which will excercise blockdev and the related work.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../disk-backing-chains-index.x86_64-2.12.0.args | 1 +
.../disk-backing-chains-index.x86_64-latest.args | 1 +
.../qemuxml2argvdata/disk-backing-chains-index.xml | 145 +++++++++++++++++++++
.../disk-backing-chains-noindex.x86_64-2.12.0.args | 58 +++++++++
.../disk-backing-chains-noindex.x86_64-latest.args | 58 +++++++++
.../disk-backing-chains-noindex.xml | 145 +++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 +
.../disk-backing-chains-index-active.xml | 76 +++++++++++
.../disk-backing-chains-index-inactive.xml | 76 +++++++++++
.../disk-backing-chains-noindex-active.xml | 76 +++++++++++
.../disk-backing-chains-noindex-inactive.xml | 76 +++++++++++
tests/qemuxml2xmltest.c | 2 +
12 files changed, 718 insertions(+)
create mode 120000 tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
create mode 120000 tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-backing-chains-index.xml
create mode 100644 tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-2.12.0.args
create mode 100644 tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-backing-chains-noindex.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
b/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
new file mode 120000
index 0000000000..3f4cd9040d
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-2.12.0.args
@@ -0,0 +1 @@
+disk-backing-chains-noindex.x86_64-2.12.0.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
new file mode 120000
index 0000000000..549eb65512
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-index.x86_64-latest.args
@@ -0,0 +1 @@
+disk-backing-chains-noindex.x86_64-latest.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-index.xml
b/tests/qemuxml2argvdata/disk-backing-chains-index.xml
new file mode 100644
index 0000000000..95b8a64cf8
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-index.xml
@@ -0,0 +1,145 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <backingStore type='file' index='1'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <backingStore type='block' index='8'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file' index='7'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file' index='6'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file' index='5'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'>
+ </source>
+ <backingStore type='file' index='4'>
+ <source file='/tmp/image5.qcow'/>
+ <format type='qcow2'/>
+ <backingStore type='file' index='3'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <backingStore/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <backingStore type='file' index='11'>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ <format type='qcow2'/>
+ </backingStore>
+ <target dev='vdd' bus='virtio'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file' index='24'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file' index='23'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file' index='22'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file' index='21'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file' index='20'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file' index='19'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file' index='18'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file' index='17'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file' index='16'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file' index='15'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file' index='14'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ <target dev='vdf' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-2.12.0.args
b/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-2.12.0.args
new file mode 100644
index 0000000000..dea109b13a
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-2.12.0.args
@@ -0,0 +1,58 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=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 \
+-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
+format=qcow2,if=none,id=drive-virtio-disk0' \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-drive file=nbd:unix:/var/run/nbdsock:exportname=bar,format=qcow2,if=none,\
+id=drive-virtio-disk1 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
+id=virtio-disk1 \
+-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\
+if=none,id=drive-virtio-disk2 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk2,\
+id=virtio-disk2 \
+-object secret,id=virtio-disk3-secret0,\
+data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
+keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
+-drive 'file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
+mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:\
+6322,file.password-secret=virtio-disk3-secret0,format=qcow2,if=none,\
+id=drive-virtio-disk3' \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk3,\
+id=virtio-disk3 \
+-drive file=/dev/HostVG/QEMUGuest11,format=qcow2,if=none,id=drive-virtio-disk4 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk4,\
+id=virtio-disk4 \
+-drive file=/var/lib/libvirt/images/rhel7.1484071880,format=qcow2,if=none,\
+id=drive-virtio-disk5 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk5,\
+id=virtio-disk5 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-latest.args
new file mode 100644
index 0000000000..afe078adcc
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-noindex.x86_64-latest.args
@@ -0,0 +1,58 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-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 \
+-m 214 \
+-realtime mlock=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 \
+-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
+format=qcow2,if=none,id=drive-virtio-disk0' \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
+id=virtio-disk0,bootindex=1 \
+-drive file=nbd:unix:/var/run/nbdsock:exportname=bar,format=qcow2,if=none,\
+id=drive-virtio-disk1 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
+id=virtio-disk1 \
+-drive file=gluster://example.org:6000/Volume1/Image,file.debug=4,format=raw,\
+if=none,id=drive-virtio-disk2 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk2,\
+id=virtio-disk2 \
+-object secret,id=virtio-disk3-secret0,\
+data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
+keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
+-drive 'file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
+mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:\
+6322,file.password-secret=virtio-disk3-secret0,format=qcow2,if=none,\
+id=drive-virtio-disk3' \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk3,\
+id=virtio-disk3 \
+-drive file=/dev/HostVG/QEMUGuest11,format=qcow2,if=none,id=drive-virtio-disk4 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk4,\
+id=virtio-disk4 \
+-drive file=/var/lib/libvirt/images/rhel7.1484071880,format=qcow2,if=none,\
+id=drive-virtio-disk5 \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk5,\
+id=virtio-disk5 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-backing-chains-noindex.xml
b/tests/qemuxml2argvdata/disk-backing-chains-noindex.xml
new file mode 100644
index 0000000000..1336d0fdd6
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-backing-chains-noindex.xml
@@ -0,0 +1,145 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <backingStore type='block'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'>
+ </source>
+ <backingStore type='file'>
+ <source file='/tmp/image5.qcow'/>
+ <format type='qcow2'/>
+ <backingStore type='file'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <backingStore/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <backingStore type='file'>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ <format type='qcow2'/>
+ </backingStore>
+ <target dev='vdd' bus='virtio'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source
file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ <target dev='vdf' 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 068a6421e4..b043274c8e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1185,6 +1185,10 @@ mymain(void)
QEMU_CAPS_ICH9_AHCI);
DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address",
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST_CAPS_VER("disk-backing-chains-index", "2.12.0");
+ DO_TEST_CAPS_LATEST("disk-backing-chains-index");
+ DO_TEST_CAPS_VER("disk-backing-chains-noindex", "2.12.0");
+ DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
DO_TEST("graphics-egl-headless",
QEMU_CAPS_EGL_HEADLESS,
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml
new file mode 100644
index 0000000000..db70ae2b53
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml
@@ -0,0 +1,76 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x06' function='0x0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x08' 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='0x09' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml
new file mode 100644
index 0000000000..db70ae2b53
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml
@@ -0,0 +1,76 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x06' function='0x0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x08' 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='0x09' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml
new file mode 100644
index 0000000000..db70ae2b53
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml
@@ -0,0 +1,76 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x06' function='0x0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x08' 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='0x09' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml
b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml
new file mode 100644
index 0000000000..db70ae2b53
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml
@@ -0,0 +1,76 @@
+<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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x05' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x06' function='0x0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x08' 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='0x09' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7fe5043519..c1efd821b3 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -989,6 +989,8 @@ mymain(void)
DO_TEST("panic-no-address", NONE);
DO_TEST("disk-backing-chains", NONE);
+ DO_TEST("disk-backing-chains-index", NONE);
+ DO_TEST("disk-backing-chains-noindex", NONE);
DO_TEST("chardev-label", NONE);
--
2.16.2