libvirt currently always reports that USB is available as a bus
subsystem
type when running "virsh domcapabilities". However, this is not always
true, for example the qemu-system-s390x binary normally never has support
for USB. Thus we should only report that USB is available if there is
also a USB host controller available where we can attach USB devices.
Reported-by: Sebastian Mitterle <smitterl(a)redhat.com>
Buglink:
https://bugzilla.redhat.com/show_bug.cgi?id=1759849
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 13 ++++++++++++-
tests/domaincapsdata/qemu_2.10.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_2.7.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_2.8.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_2.9.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_4.0.0.s390x.xml | 1 -
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 -
10 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index da0c7a257f..261cca19a7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5674,10 +5674,21 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_STARTUP_POLICY_OPTIONAL);
VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
- VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_USB_UHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_EHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_USB_EHCI1) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VT82C686B_USB_UHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) {
+ VIR_DOMAIN_CAPS_ENUM_SET(hostdev->subsysType,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB);
A bit misaligned, but I will fix it before pushing.
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal