Right now we call qemuValidateDomainDeviceDefControllerUSB()
quite late, just as we're generating the QEMU command line.
The original intention was likely to prevent configurations
from being rejected, even though a default USB controller
model could not be found, because using -usb could be used
as a last resort.
As it turns out, this premise was always flawed: in order
for -usb to work, the underlying device still needs to be
compiled into QEMU, and if that was the case then the
earlier code would have detected its presence and set the
model name accordingly.
More recently, we have dropped the use of -usb altogether
so there's simply no longer anything to fall back to.
With all this in mind, we can move the validation step much
earlier, making for a better user experience as any issues
will be reported when the domain is defined rather than when
an attempt is made to start it.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 114 +-----------------
src/qemu/qemu_validate.c | 112 ++++++++++++++++-
...ilable-pseries.ppc64-latest.abi-update.xml | 31 -----
...matic-unavailable-pseries.ppc64-latest.xml | 31 -----
...ic-unavailable-realview.aarch64-latest.xml | 25 ----
...-unavailable-versatilepb.armv7l-latest.xml | 27 -----
...controller-default-isapc.x86_64-latest.err | 2 +-
...controller-default-isapc.x86_64-latest.xml | 26 ----
...ntroller-default-microvm.x86_64-latest.err | 2 +-
...ntroller-default-microvm.x86_64-latest.xml | 24 ----
...ontroller-default-nousb.aarch64-latest.err | 2 +-
...ontroller-default-nousb.aarch64-latest.xml | 22 ----
...fault-unavailable-g3beige.ppc64-latest.xml | 27 -----
...fault-unavailable-i440fx.x86_64-latest.xml | 29 -----
...default-unavailable-mac99.ppc64-latest.xml | 27 -----
...efault-unavailable-mac99ppc.ppc-latest.xml | 24 ----
...ault-unavailable-powernv9.ppc64-latest.xml | 27 -----
...fault-unavailable-pseries.ppc64-latest.xml | 31 -----
...-default-unavailable-q35.x86_64-latest.xml | 47 --------
...lt-unavailable-realview.aarch64-latest.xml | 25 ----
...-unavailable-versatilepb.armv7l-latest.xml | 27 -----
...navailable-virt-aarch64.aarch64-latest.xml | 43 -------
...le-virt-loongarch64.loongarch64-latest.xml | 40 ------
...navailable-virt-riscv64.riscv64-latest.xml | 41 -------
...ler-nec-xhci-unavailable.x86_64-latest.xml | 33 -----
tests/qemuxmlconftest.c | 40 +++---
26 files changed, 136 insertions(+), 743 deletions(-)
delete mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.abi-update.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-automatic-unavailable-versatilepb.armv7l-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-g3beige.ppc64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99.ppc64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99ppc.ppc-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-powernv9.ppc64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-q35.x86_64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-versatilepb.armv7l-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-aarch64.aarch64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-loongarch64.loongarch64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-riscv64.riscv64-latest.xml
delete mode 100644 tests/qemuxmlconfdata/usb-controller-nec-xhci-unavailable.x86_64-latest.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d43c0fd21d..08e2a5147d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2558,112 +2558,6 @@ qemuBuildFilesystemCommandLine(virCommand *cmd,
}
-static bool
-qemuDomainControllerUSBIsPCI(const virDomainControllerDef *controller)
-{
- switch ((virDomainControllerModelUSB)controller->model) {
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
- /* The models above are PCI devices */
- return true;
-
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2:
- /* The models above are not relevant to the QEMU driver */
- return false;
-
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST:
- default:
- return false;
- }
-}
-
-
-static int
-qemuControllerModelUSBToCaps(int model)
-{
- switch (model) {
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI:
- return QEMU_CAPS_PIIX3_USB_UHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI:
- return QEMU_CAPS_PIIX4_USB_UHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
- return QEMU_CAPS_USB_EHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
- return QEMU_CAPS_ICH9_USB_EHCI1;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI:
- return QEMU_CAPS_VT82C686B_USB_UHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
- return QEMU_CAPS_PCI_OHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
- return QEMU_CAPS_NEC_USB_XHCI;
- case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
- return QEMU_CAPS_DEVICE_QEMU_XHCI;
- default:
- return -1;
- }
-}
-
-
-static int
-qemuValidateDomainDeviceDefControllerUSB(const virDomainControllerDef *controller,
- const virDomainDef *def,
- virQEMUCaps *qemuCaps)
-{
- if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
- return 0;
-
- if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to determine model for USB controller idx=%1$d"),
- controller->idx);
- return -1;
- }
-
- if (qemuDomainControllerUSBIsPCI(controller) &&
- !qemuDomainSupportsPCI(def)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("USB controller model '%1$s' requires PCI but machine type '%2$s' does not support PCI"),
- virDomainControllerModelUSBTypeToString(controller->model),
- def->os.machine);
- return -1;
- }
-
- if (!virQEMUCapsGet(qemuCaps, qemuControllerModelUSBToCaps(controller->model))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("USB controller model '%1$s' not supported in this QEMU binary"),
- virDomainControllerModelUSBTypeToString(controller->model));
- return -1;
- }
-
- if (controller->opts.usbopts.ports != -1) {
- if (controller->model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI &&
- controller->model != VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("usb controller type '%1$s' doesn't support 'ports' with this QEMU binary"),
- virDomainControllerModelUSBTypeToString(controller->model));
- return -1;
- }
- }
-
- return 0;
-}
-
-
static const char *
qemuBuildUSBControllerFindMasterAlias(const virDomainDef *domainDef,
const virDomainControllerDef *def)
@@ -2691,14 +2585,10 @@ qemuBuildUSBControllerFindMasterAlias(const virDomainDef *domainDef,
static virJSONValue *
qemuBuildUSBControllerDevProps(const virDomainDef *domainDef,
- virDomainControllerDef *def,
- virQEMUCaps *qemuCaps)
+ virDomainControllerDef *def)
{
g_autoptr(virJSONValue) props = NULL;
- if (qemuValidateDomainDeviceDefControllerUSB(def, domainDef, qemuCaps) < 0)
- return NULL;
-
if (virJSONValueObjectAdd(&props,
"s:driver", qemuControllerModelUSBTypeToString(def->model),
"k:p2", def->opts.usbopts.ports,
@@ -2994,7 +2884,7 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
- if (!(props = qemuBuildUSBControllerDevProps(domainDef, def, qemuCaps)))
+ if (!(props = qemuBuildUSBControllerDevProps(domainDef, def)))
return -1;
break;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 456f9ee2f2..7f3ffe8bd5 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3864,6 +3864,112 @@ qemuValidateDomainDeviceDefControllerSCSI(const virDomainControllerDef *controll
}
+static bool
+qemuDomainControllerUSBIsPCI(const virDomainControllerDef *controller)
+{
+ switch ((virDomainControllerModelUSB)controller->model) {
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
+ /* The models above are PCI devices */
+ return true;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QUSB2:
+ /* The models above are not relevant to the QEMU driver */
+ return false;
+
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST:
+ default:
+ return false;
+ }
+}
+
+
+static int
+qemuControllerModelUSBToCaps(int model)
+{
+ switch (model) {
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI:
+ return QEMU_CAPS_PIIX3_USB_UHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI:
+ return QEMU_CAPS_PIIX4_USB_UHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI:
+ return QEMU_CAPS_USB_EHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
+ return QEMU_CAPS_ICH9_USB_EHCI1;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI:
+ return QEMU_CAPS_VT82C686B_USB_UHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI:
+ return QEMU_CAPS_PCI_OHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI:
+ return QEMU_CAPS_NEC_USB_XHCI;
+ case VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI:
+ return QEMU_CAPS_DEVICE_QEMU_XHCI;
+ default:
+ return -1;
+ }
+}
+
+
+static int
+qemuValidateDomainDeviceDefControllerUSB(const virDomainControllerDef *controller,
+ const virDomainDef *def,
+ virQEMUCaps *qemuCaps)
+{
+ if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
+ return 0;
+
+ if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to determine model for USB controller idx=%1$d"),
+ controller->idx);
+ return -1;
+ }
+
+ if (qemuDomainControllerUSBIsPCI(controller) &&
+ !qemuDomainSupportsPCI(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("USB controller model '%1$s' requires PCI but machine type '%2$s' does not support PCI"),
+ virDomainControllerModelUSBTypeToString(controller->model),
+ def->os.machine);
+ return -1;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, qemuControllerModelUSBToCaps(controller->model))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("USB controller model '%1$s' not supported in this QEMU binary"),
+ virDomainControllerModelUSBTypeToString(controller->model));
+ return -1;
+ }
+
+ if (controller->opts.usbopts.ports != -1) {
+ if (controller->model != VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI &&
+ controller->model != VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("usb controller type '%1$s' doesn't support 'ports' with this QEMU binary"),
+ virDomainControllerModelUSBTypeToString(controller->model));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
/**
* virValidateControllerPCIModelNameToQEMUCaps:
* @modelName: model name
@@ -4533,10 +4639,14 @@ qemuValidateDomainDeviceDefController(const virDomainControllerDef *controller,
qemuCaps);
break;
+ case VIR_DOMAIN_CONTROLLER_TYPE_USB:
+ ret = qemuValidateDomainDeviceDefControllerUSB(controller, def,
+ qemuCaps);
+ break;
+
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
- case VIR_DOMAIN_CONTROLLER_TYPE_USB:
case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS:
case VIR_DOMAIN_CONTROLLER_TYPE_ISA:
case VIR_DOMAIN_CONTROLLER_TYPE_LAST:
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.abi-update.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.abi-update.xml
deleted file mode 100644
index 2b71e447e8..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.abi-update.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='pseries'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>POWER10</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'>
- <model name='spapr-pci-host-bridge'/>
- <target index='0'/>
- </controller>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- <panic model='pseries'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.xml
deleted file mode 100644
index 2b71e447e8..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-pseries.ppc64-latest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='pseries'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>POWER10</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'>
- <model name='spapr-pci-host-bridge'/>
- <target index='0'/>
- </controller>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- <panic model='pseries'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml
deleted file mode 100644
index 128a7d420e..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-realview.aarch64-latest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='realview-eb'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough' check='none'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-versatilepb.armv7l-latest.xml b/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-versatilepb.armv7l-latest.xml
deleted file mode 100644
index 93bf8dcd0a..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-automatic-unavailable-versatilepb.armv7l-latest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='qemu'>
- <name>armv7ltest</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='armv7l' machine='versatilepb'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>arm926</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-armv7l</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.err
index a0ca4fba5d..167955f7d6 100644
--- a/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.err
+++ b/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.err
@@ -1 +1 @@
-XML error: No PCI buses available
+unsupported configuration: USB controller model 'piix3-uhci' requires PCI but machine type 'isapc' does not support PCI
diff --git a/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.xml
deleted file mode 100644
index c18e2b1b0d..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-isapc.x86_64-latest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<domain type='qemu'>
- <name>q35-test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='isapc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>486</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0' model='piix3-uhci'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.err
index a0ca4fba5d..4f8460a8a6 100644
--- a/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.err
+++ b/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.err
@@ -1 +1 @@
-XML error: No PCI buses available
+unsupported configuration: USB controller model 'piix3-uhci' requires PCI but machine type 'microvm' does not support PCI
diff --git a/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.xml
deleted file mode 100644
index b8e55a7044..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-microvm.x86_64-latest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<domain type='qemu'>
- <name>q35-test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='microvm'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0' model='piix3-uhci'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.err b/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.err
index a0ca4fba5d..75de46ff93 100644
--- a/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.err
+++ b/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.err
@@ -1 +1 @@
-XML error: No PCI buses available
+unsupported configuration: USB controller model 'qemu-xhci' requires PCI but machine type 'collie' does not support PCI
diff --git a/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.xml
deleted file mode 100644
index fa258c5671..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-nousb.aarch64-latest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='collie'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough' check='none'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0' model='qemu-xhci'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-g3beige.ppc64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-g3beige.ppc64-latest.xml
deleted file mode 100644
index 409aeffe87..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-g3beige.ppc64-latest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='g3beige'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>g3</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
deleted file mode 100644
index b2847caee7..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-i440fx.x86_64-latest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<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='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <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'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99.ppc64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99.ppc64-latest.xml
deleted file mode 100644
index 4ee8c59607..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99.ppc64-latest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='mac99'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>ppc64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99ppc.ppc-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99ppc.ppc-latest.xml
deleted file mode 100644
index 22ec793ffa..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-mac99ppc.ppc-latest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc' machine='mac99'>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-ppc</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-powernv9.ppc64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-powernv9.ppc64-latest.xml
deleted file mode 100644
index c27af33c06..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-powernv9.ppc64-latest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='powernv9'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>POWER9</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.xml
deleted file mode 100644
index 2b71e447e8..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219100</memory>
- <currentMemory unit='KiB'>219100</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='ppc64' machine='pseries'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>POWER10</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'>
- <model name='spapr-pci-host-bridge'/>
- <target index='0'/>
- </controller>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- <panic model='pseries'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-q35.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-q35.x86_64-latest.xml
deleted file mode 100644
index e46489882a..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-q35.x86_64-latest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<domain type='qemu'>
- <name>q35-test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='q35'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
- </controller>
- <controller type='sata' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='1' port='0x8'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
- </controller>
- <controller type='pci' index='2' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='3' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='3' port='0x9'/>
- <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'/>
- <watchdog model='itco' action='reset'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml
deleted file mode 100644
index 128a7d420e..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-realview.aarch64-latest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='realview-eb'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='host-passthrough' check='none'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-versatilepb.armv7l-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-versatilepb.armv7l-latest.xml
deleted file mode 100644
index 93bf8dcd0a..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-versatilepb.armv7l-latest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type='qemu'>
- <name>armv7ltest</name>
- <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='armv7l' machine='versatilepb'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>arm926</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-armv7l</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-aarch64.aarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-aarch64.aarch64-latest.xml
deleted file mode 100644
index 81ddb4e5d9..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-aarch64.aarch64-latest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<domain type='qemu'>
- <name>test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
- <boot dev='hd'/>
- </os>
- <features>
- <gic version='2'/>
- </features>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>cortex-a15</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='1' port='0x8'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
- </controller>
- <controller type='pci' index='2' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='3' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='3' port='0x9'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
- </controller>
- <audio id='1' type='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-loongarch64.loongarch64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-loongarch64.loongarch64-latest.xml
deleted file mode 100644
index b3f84257b4..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-loongarch64.loongarch64-latest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<domain type='qemu'>
- <name>test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='loongarch64' machine='virt'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>la464</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-loongarch64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='1' port='0x8'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
- </controller>
- <controller type='pci' index='2' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='3' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='3' port='0x9'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
- </controller>
- <audio id='1' type='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-riscv64.riscv64-latest.xml b/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-riscv64.riscv64-latest.xml
deleted file mode 100644
index 686363457e..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-virt-riscv64.riscv64-latest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<domain type='qemu'>
- <name>test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='riscv64' machine='virt'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>rv64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-riscv64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='1' port='0x8'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
- </controller>
- <controller type='pci' index='2' model='pcie-to-pci-bridge'>
- <model name='pcie-pci-bridge'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
- </controller>
- <controller type='pci' index='3' model='pcie-root-port'>
- <model name='pcie-root-port'/>
- <target chassis='3' port='0x9'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
- </controller>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconfdata/usb-controller-nec-xhci-unavailable.x86_64-latest.xml b/tests/qemuxmlconfdata/usb-controller-nec-xhci-unavailable.x86_64-latest.xml
deleted file mode 100644
index 9039037ab7..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-nec-xhci-unavailable.x86_64-latest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<domain type='qemu'>
- <name>q35-test</name>
- <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
- <memory unit='KiB'>2097152</memory>
- <currentMemory unit='KiB'>2097152</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='q35'>hvm</type>
- <boot dev='hd'/>
- </os>
- <cpu mode='custom' match='exact' check='none'>
- <model fallback='forbid'>qemu64</model>
- </cpu>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0' model='nec-xhci'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
- </controller>
- <controller type='sata' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pcie-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <audio id='1' type='none'/>
- <watchdog model='itco' action='reset'/>
- <memballoon model='none'/>
- </devices>
-</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 4635c28dc3..03fc3b0fd8 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2075,7 +2075,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-automatic-unavailable-versatilepb", ".armv7l-latest",
ARG_CAPS_ARCH, "armv7l",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2083,26 +2083,26 @@ mymain(void)
DO_TEST_FULL("usb-controller-automatic-unavailable-realview", ".aarch64-latest",
ARG_CAPS_ARCH, "aarch64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
DO_TEST_FULL("usb-controller-automatic-unavailable-pseries", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
DO_TEST_FULL("usb-controller-automatic-unavailable-pseries", ".ppc64-latest.abi-update",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
- DO_TEST_CAPS_LATEST_FAILURE("usb-controller-default-isapc");
- DO_TEST_CAPS_LATEST_FAILURE("usb-controller-default-microvm");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-isapc");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-controller-default-microvm");
DO_TEST_CAPS_LATEST("usb-controller-default-i440fx");
DO_TEST_CAPS_LATEST("usb-controller-default-q35");
DO_TEST_CAPS_ARCH_LATEST("usb-controller-default-pseries", "ppc64");
@@ -2122,7 +2122,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-virt-loongarch64", ".loongarch64-latest",
ARG_CAPS_ARCH, "loongarch64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2131,14 +2131,14 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-i440fx", ".x86_64-latest",
ARG_CAPS_ARCH, "x86_64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
ARG_END);
/* The implicit controller can be compiled out for q35; initialization fails though */
DO_TEST_FULL("usb-controller-default-unavailable-q35", ".x86_64-latest",
ARG_CAPS_ARCH, "x86_64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
ARG_END);
/* However, if the USB controller is the one that gets added
@@ -2154,7 +2154,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-pseries", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2167,7 +2167,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-virt-aarch64", ".aarch64-latest",
ARG_CAPS_ARCH, "aarch64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2180,7 +2180,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-virt-riscv64", ".riscv64-latest",
ARG_CAPS_ARCH, "riscv64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2194,7 +2194,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-versatilepb", ".armv7l-latest",
ARG_CAPS_ARCH, "armv7l",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2207,12 +2207,12 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-realview", ".aarch64-latest",
ARG_CAPS_ARCH, "aarch64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_LAST,
ARG_END);
/* The '-nousb' test case tests machine without a built-in USB controller */
- DO_TEST_CAPS_ARCH_LATEST_FAILURE("usb-controller-default-nousb", "aarch64");
+ DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("usb-controller-default-nousb", "aarch64");
DO_TEST_CAPS_ARCH_LATEST_ABI_UPDATE_PARSE_ERROR("usb-controller-default-nousb", "aarch64");
DO_TEST_FULL("usb-controller-default-fallback-g3beige", ".ppc64-latest",
@@ -2223,7 +2223,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-g3beige", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2235,7 +2235,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-mac99", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2247,7 +2247,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-mac99ppc", ".ppc-latest",
ARG_CAPS_ARCH, "ppc",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_LAST,
ARG_END);
@@ -2259,7 +2259,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-default-unavailable-powernv9", ".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
ARG_END);
DO_TEST_CAPS_LATEST("usb-none");
@@ -2275,7 +2275,7 @@ mymain(void)
DO_TEST_FULL("usb-controller-nec-xhci-unavailable", ".x86_64-latest",
ARG_CAPS_ARCH, "x86_64",
ARG_CAPS_VER, "latest",
- ARG_FLAGS, FLAG_EXPECT_FAILURE,
+ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_LAST,
ARG_END);
DO_TEST_CAPS_LATEST("usb-controller-nec-xhci-autoassign");
--
2.51.0
On Thu, Sep 25, 2025 at 20:07:13 +0200, Andrea Bolognani via Devel wrote: > Right now we call qemuValidateDomainDeviceDefControllerUSB() > quite late, just as we're generating the QEMU command line. > > The original intention was likely to prevent configurations > from being rejected, even though a default USB controller > model could not be found, because using -usb could be used > as a last resort. > > As it turns out, this premise was always flawed: in order > for -usb to work, the underlying device still needs to be > compiled into QEMU, and if that was the case then the > earlier code would have detected its presence and set the > model name accordingly. > > More recently, we have dropped the use of -usb altogether > so there's simply no longer anything to fall back to. > > With all this in mind, we can move the validation step much > earlier, making for a better user experience as any issues > will be reported when the domain is defined rather than when > an attempt is made to start it. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > Reviewed-by: Michal Privoznik <mprivozn@redhat.com> > --- Conceptually I agree with this move. My quesion is only how the machine types with native USB that can exist are handled with this code. I'm going to assume that this patch doesn't change libvirts behaviour wrt. the above machines, thus: Reviewed-by: Peter Krempa <pkrempa@redhat.com>
On Fri, Oct 03, 2025 at 09:11:26AM +0200, Peter Krempa wrote: > On Thu, Sep 25, 2025 at 20:07:13 +0200, Andrea Bolognani via Devel wrote: > > Right now we call qemuValidateDomainDeviceDefControllerUSB() > > quite late, just as we're generating the QEMU command line. > > > > The original intention was likely to prevent configurations > > from being rejected, even though a default USB controller > > model could not be found, because using -usb could be used > > as a last resort. > > > > As it turns out, this premise was always flawed: in order > > for -usb to work, the underlying device still needs to be > > compiled into QEMU, and if that was the case then the > > earlier code would have detected its presence and set the > > model name accordingly. > > > > More recently, we have dropped the use of -usb altogether > > so there's simply no longer anything to fall back to. > > > > With all this in mind, we can move the validation step much > > earlier, making for a better user experience as any issues > > will be reported when the domain is defined rather than when > > an attempt is made to start it. > > Conceptually I agree with this move. My quesion is only how the machine > types with native USB that can exist are handled with this code. > > I'm going to assume that this patch doesn't change libvirts behaviour > wrt. the above machines For those machine types the USB native controller was never modelled at the libvirt level; attempts to add a USB controller would result in a PCI controller being picked, which QEMU would promptly refuse due to the lack of PCI in the machine type. So all that will change here is that the error message is going to be reported earlier. Thank you for all your help getting this cleanup done! -- Andrea Bolognani / Red Hat / Virtualization
© 2016 - 2025 Red Hat, Inc.