mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu_validate: Reject virtiofs with bootindex on s390x with CCW
The CCW variant of the 'vhost-user-fs' device in qemu doesn't deliberately support the 'bootindex' attribute as the machine is unable to boot from such device. Reject '<boot order' on non-PCI virtiofs, add tests validating that it's rejected as well as that virtiofs on PCI-based hosts but without address specified will be accepted. Resolves: https://issues.redhat.com/browse/RHEL-22728 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
This commit is contained in:
parent
33cd1922ab
commit
4690058b6d
@ -4495,12 +4495,21 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
|
|||||||
if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "virtiofs") < 0) {
|
if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "virtiofs") < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (fs->info.bootIndex &&
|
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_USER_FS_BOOTINDEX)) {
|
if (fs->info.bootIndex) {
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_USER_FS_BOOTINDEX)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("setting virtiofs boot order is not supported with this QEMU binary"));
|
_("setting virtiofs boot order is not supported with this QEMU binary"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fs->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("setting virtiofs boot order is supported only with PCI bus"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
unsupported configuration: setting virtiofs boot order is supported only with PCI bus
|
38
tests/qemuxmlconfdata/vhost-user-fs-ccw-bootindex.xml
Normal file
38
tests/qemuxmlconfdata/vhost-user-fs-ccw-bootindex.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<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>
|
||||||
|
<memoryBacking>
|
||||||
|
<access mode='shared'/>
|
||||||
|
</memoryBacking>
|
||||||
|
<os>
|
||||||
|
<type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||||||
|
</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-s390x</emulator>
|
||||||
|
<disk type='block' device='disk'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||||
|
<target dev='hda' bus='virtio'/>
|
||||||
|
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||||||
|
</disk>
|
||||||
|
<audio id='1' type='none'/>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
|
||||||
|
</memballoon>
|
||||||
|
<panic model='s390'/>
|
||||||
|
<filesystem type="mount" accessmode="passthrough">
|
||||||
|
<target dir="mount_tag"/>
|
||||||
|
<source dir="/tmp"/>
|
||||||
|
<binary path="/usr/libexec/virtiofsd"/>
|
||||||
|
<boot order="2"/>
|
||||||
|
<driver type="virtiofs" />
|
||||||
|
</filesystem>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -36,6 +36,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
|
|||||||
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}' \
|
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}' \
|
||||||
-chardev socket,id=chr-vu-fs0,path=/var/lib/libvirt/qemu/domain--1-guest/fs0-fs.sock \
|
-chardev socket,id=chr-vu-fs0,path=/var/lib/libvirt/qemu/domain--1-guest/fs0-fs.sock \
|
||||||
-device '{"driver":"vhost-user-fs-pci","id":"fs0","chardev":"chr-vu-fs0","tag":"mount_tag","bootindex":2,"bus":"pci.1","addr":"0x0"}' \
|
-device '{"driver":"vhost-user-fs-pci","id":"fs0","chardev":"chr-vu-fs0","tag":"mount_tag","bootindex":2,"bus":"pci.1","addr":"0x0"}' \
|
||||||
|
-chardev socket,id=chr-vu-fs1,path=/var/lib/libvirt/qemu/domain--1-guest/fs1-fs.sock \
|
||||||
|
-device '{"driver":"vhost-user-fs-pci","id":"fs1","chardev":"chr-vu-fs1","tag":"mount_tag2","bootindex":3,"bus":"pci.2","addr":"0x0"}' \
|
||||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||||
-global ICH9-LPC.noreboot=off \
|
-global ICH9-LPC.noreboot=off \
|
||||||
-watchdog-action reset \
|
-watchdog-action reset \
|
||||||
|
@ -69,6 +69,14 @@
|
|||||||
<boot order='2'/>
|
<boot order='2'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<driver type='virtiofs'/>
|
||||||
|
<binary path='/usr/libexec/virtiofsd'/>
|
||||||
|
<source dir='/path'/>
|
||||||
|
<target dir='mount_tag2'/>
|
||||||
|
<boot order='3'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
|
||||||
|
</filesystem>
|
||||||
<input type='mouse' bus='ps2'/>
|
<input type='mouse' bus='ps2'/>
|
||||||
<input type='keyboard' bus='ps2'/>
|
<input type='keyboard' bus='ps2'/>
|
||||||
<audio id='1' type='none'/>
|
<audio id='1' type='none'/>
|
||||||
|
@ -69,6 +69,14 @@
|
|||||||
<boot order='2'/>
|
<boot order='2'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
|
<!-- following virtiofs is deliberately without address to prove bootindex validation -->
|
||||||
|
<filesystem type='mount' accessmode='passthrough'>
|
||||||
|
<driver type='virtiofs'/>
|
||||||
|
<binary path='/usr/libexec/virtiofsd'/>
|
||||||
|
<source dir='/path'/>
|
||||||
|
<target dir='mount_tag2'/>
|
||||||
|
<boot order='3'/>
|
||||||
|
</filesystem>
|
||||||
<input type='mouse' bus='ps2'/>
|
<input type='mouse' bus='ps2'/>
|
||||||
<input type='keyboard' bus='ps2'/>
|
<input type='keyboard' bus='ps2'/>
|
||||||
<audio id='1' type='none'/>
|
<audio id='1' type='none'/>
|
||||||
|
@ -2855,6 +2855,7 @@ mymain(void)
|
|||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("vhost-user-fs-readonly");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("vhost-user-fs-readonly");
|
||||||
|
|
||||||
DO_TEST_CAPS_ARCH_LATEST("vhost-user-fs-ccw", "s390x");
|
DO_TEST_CAPS_ARCH_LATEST("vhost-user-fs-ccw", "s390x");
|
||||||
|
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("vhost-user-fs-ccw-bootindex", "s390x");
|
||||||
|
|
||||||
DO_TEST_CAPS_LATEST("virtio-transitional");
|
DO_TEST_CAPS_LATEST("virtio-transitional");
|
||||||
DO_TEST_CAPS_LATEST("virtio-non-transitional");
|
DO_TEST_CAPS_LATEST("virtio-non-transitional");
|
||||||
|
Loading…
Reference in New Issue
Block a user