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@xxxxxxxxxx> --- .../disk-source-fd.x86_64-latest.args | 36 +++++++++++-------- .../disk-source-fd.x86_64-latest.xml | 21 +++++++++-- tests/qemuxmlconfdata/disk-source-fd.xml | 16 +++++++-- tests/qemuxmlconftest.c | 3 ++ 4 files changed, 57 insertions(+), 19 deletions(-) diff --git a/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.args b/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.args index 1341b7d032..d77b3ca505 100644 --- a/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.args +++ b/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.args @@ -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 \ diff --git a/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.xml b/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.xml index 9ab5e9443f..d9917c7d53 100644 --- a/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/disk-source-fd.x86_64-latest.xml @@ -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'/> diff --git a/tests/qemuxmlconfdata/disk-source-fd.xml b/tests/qemuxmlconfdata/disk-source-fd.xml index d8c47fa364..93a3fcfbf7 100644 --- a/tests/qemuxmlconfdata/disk-source-fd.xml +++ b/tests/qemuxmlconfdata/disk-source-fd.xml @@ -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> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 99c4efc9d6..1f0068864a 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -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"); -- 2.48.1