qemuxmlconftest: Add testing of FDs with 'writable' flag in 'disk-source-fd'

Add few examples of fd groups with the 'writable' flag set, when passing
a single FD. Notably as a top level image of a readonly disk (even when
that doesn't make much sense) and also as a base image of a chain.

Note that this documents a status quo of a bug fixed in upcoming patch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Peter Krempa 2025-02-06 15:55:37 +01:00
parent 500d985a13
commit 7a119483a3
4 changed files with 57 additions and 19 deletions

View File

@ -27,21 +27,27 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-no-shutdown \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-add-fd set=2,fd=200,opaque=libvirt-4-storage0 \
-add-fd set=2,fd=205,opaque=libvirt-4-storage1 \
-blockdev '{"driver":"file","filename":"/dev/fdset/2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-4-format","id":"virtio-disk4","bootindex":1}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/rhel7.1484071876","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"qcow2","file":"libvirt-3-storage","backing":null}' \
-add-fd set=1,fd=247,opaque=libvirt-2-storage0 \
-add-fd set=1,fd=248,opaque=libvirt-2-storage1 \
-blockdev '{"driver":"file","filename":"/dev/fdset/1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2","file":"libvirt-2-storage","backing":"libvirt-3-format"}' \
-add-fd set=0,fd=204,opaque=libvirt-1-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/0","node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-1-format","id":"virtio-disk5"}' \
-add-fd set=5,fd=200,opaque=libvirt-6-storage0 \
-add-fd set=5,fd=205,opaque=libvirt-6-storage1 \
-blockdev '{"driver":"file","filename":"/dev/fdset/5","node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"qcow2","file":"libvirt-6-storage"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-6-format","id":"virtio-disk4","bootindex":1}' \
-add-fd set=4,fd=209,opaque=libvirt-5-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/4","node-name":"libvirt-5-storage","read-only":true}' \
-add-fd set=3,fd=247,opaque=libvirt-4-storage0 \
-add-fd set=3,fd=248,opaque=libvirt-4-storage1 \
-blockdev '{"driver":"file","filename":"/dev/fdset/3","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-4-format","read-only":true,"driver":"qcow2","file":"libvirt-4-storage","backing":"libvirt-5-storage"}' \
-add-fd set=2,fd=204,opaque=libvirt-3-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/2","node-name":"libvirt-3-storage","read-only":false,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"qcow2","file":"libvirt-3-storage","backing":"libvirt-4-format"}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-3-format","id":"virtio-disk5"}' \
-add-fd set=1,fd=207,opaque=libvirt-2-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/1","node-name":"libvirt-2-storage","read-only":true}' \
-device '{"driver":"ide-cd","bus":"ide.0","unit":0,"drive":"libvirt-2-storage","id":"ide0-0-0"}' \
-add-fd set=0,fd=208,opaque=libvirt-1-storage0 \
-blockdev '{"driver":"file","filename":"/dev/fdset/0","node-name":"libvirt-1-storage","read-only":true}' \
-device '{"driver":"ide-cd","bus":"ide.0","unit":1,"drive":"libvirt-1-storage","id":"ide0-0-1"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x4"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \

View File

@ -30,18 +30,35 @@
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071877' fdgroup='testgroup6'/>
<backingStore type='file'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071876'/>
<format type='raw'/>
<source file='/var/lib/libvirt/images/rhel7.1484071876' fdgroup='raw-rw-base'/>
<backingStore/>
</backingStore>
</backingStore>
<target dev='vdf' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/path/to/cdimage-ro' fdgroup='cdimage-ro'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/path/to/cdimage-rw' fdgroup='cdimage-rw'/>
<target dev='hdb' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</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'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>

View File

@ -19,6 +19,18 @@
<source file='/path/to/blah' fdgroup='testgroup2'/>
<target dev='vde' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/path/to/cdimage-ro' fdgroup='cdimage-ro'/>
<readonly/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/path/to/cdimage-rw' fdgroup='cdimage-rw'/>
<readonly/>
<target dev='hdb' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071880' fdgroup='testgroup5'/>
@ -26,8 +38,8 @@
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071877' fdgroup='testgroup6'/>
<backingStore type='file'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071876'/>
<format type='raw'/>
<source file='/var/lib/libvirt/images/rhel7.1484071876' fdgroup='raw-rw-base'/>
<backingStore/>
</backingStore>
</backingStore>

View File

@ -1657,6 +1657,9 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST_FULL("disk-source-fd", "x86_64",
ARG_FD_GROUP, "testgroup2", false, 2, 200, 205,
ARG_FD_GROUP, "testgroup5", false, 1, 204,
ARG_FD_GROUP, "cdimage-ro", false, 1, 207,
ARG_FD_GROUP, "cdimage-rw", true, 1, 208,
ARG_FD_GROUP, "raw-rw-base", true, 1, 209,
ARG_FD_GROUP, "testgroup6", false, 2, 247, 248);
DO_TEST_CAPS_LATEST("disk-slices");