The default USB device auto-selection code for 'pseries' machines picks
controller models which are also selected when '-usb' is used thus it's
impossible to end up in the case when using '-usb' would be possible:
$ qemu-system-ppc64 --machine pseries,usb=on
qemu-system-ppc64: could not find a module for type 'nec-usb-xhci'
$ qemu-system-ppc64 --machine pseries-2.5,usb=on
qemu-system-ppc64: could not find a module for type 'pci-ohci'
Remove the impossible downgrade and adjust tests.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 1 +
...ault-unavailable-pseries.ppc64-latest.args | 33 -------------------
...fault-unavailable-pseries.ppc64-latest.err | 1 +
tests/qemuxmlconftest.c | 2 ++
4 files changed, 4 insertions(+), 33 deletions(-)
delete mode 100644
tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.args
create mode 100644
tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.err
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d6328af70b..19eabb49ca 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2924,6 +2924,7 @@ qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
{
if (ARCH_IS_X86(def->os.arch) ||
qemuDomainIsARMVirt(def) ||
+ qemuDomainIsPSeries(def) ||
qemuDomainIsRISCVVirt(def))
return true;
diff --git
a/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.args
b/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.args
deleted file mode 100644
index 4d5825032d..0000000000
--- a/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.args
+++ /dev/null
@@ -1,33 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-ppc64 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}'
\
--machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \
--accel tcg \
--cpu POWER9 \
--m size=262144k \
--object
'{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}'
\
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--boot strict=on \
--usb \
--audiodev
'{"id":"audio1","driver":"none"}' \
--device
'{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x6"}'
\
--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
--msg timestamp=on
diff --git
a/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.err
b/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.err
new file mode 100644
index 0000000000..7a71aa107d
--- /dev/null
+++ b/tests/qemuxmlconfdata/usb-controller-default-unavailable-pseries.ppc64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: no model provided for USB controller
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 417b5e5900..bb898a0787 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1891,9 +1891,11 @@ mymain(void)
ARG_QEMU_CAPS_DEL, QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_NEC_USB_XHCI,
QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_LAST,
ARG_END);
+ /* The USB controllers can be compiled out but downgrade to -usb fails in qemu */
DO_TEST_FULL("usb-controller-default-unavailable-pseries",
".ppc64-latest",
ARG_CAPS_ARCH, "ppc64",
ARG_CAPS_VER, "latest",
+ ARG_FLAGS, FLAG_EXPECT_FAILURE,
ARG_QEMU_CAPS_DEL, QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_PCI_OHCI,
QEMU_CAPS_DEVICE_QEMU_XHCI, QEMU_CAPS_LAST,
ARG_END);
--
2.43.0