With the way the code is currently written, we can end up using
the legacy USB controller (-usb) for a guest that doesn't have
any USB controllers at all in its configuration.
This is pretty harmless, since in these cases QEMU will ignore
the request and not create any USB controller, but it's also
incorrect and gets in the way of further changes that we want
to make.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_command.c | 1 +
tests/qemuxmlconfdata/arm-vexpressa9-basic.aarch64-latest.args | 1 -
tests/qemuxmlconfdata/arm-vexpressa9-nodevs.aarch64-latest.args | 1 -
tests/qemuxmlconfdata/arm-vexpressa9-virtio.aarch64-latest.args | 1 -
tests/qemuxmlconfdata/disk-arm-virtio-sd.aarch64-latest.args | 1 -
tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args | 1 -
.../usb-controller-implicit-isapc.x86_64-latest.args | 1 -
7 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2719574fb5..7824c31bde 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2962,6 +2962,7 @@ qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd,
}
if (nusb == 0 &&
+ nlegacy > 0 &&
!qemuBuildDomainForbidLegacyUSBController(def) &&
!ARCH_IS_S390(def->os.arch)) {
/* We haven't added any USB controller yet, but we haven't been asked
diff --git a/tests/qemuxmlconfdata/arm-vexpressa9-basic.aarch64-latest.args
b/tests/qemuxmlconfdata/arm-vexpressa9-basic.aarch64-latest.args
index 1ffef8383e..72d10a732e 100644
--- a/tests/qemuxmlconfdata/arm-vexpressa9-basic.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/arm-vexpressa9-basic.aarch64-latest.args
@@ -30,7 +30,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armtest/.config \
-initrd /arm.initrd \
-append 'console=ttyAMA0,115200n8 rw root=/dev/mmcblk0p3 rootwait
physmap.enabled=0' \
-dtb /arm.dtb \
--usb \
-drive file=/arm.raw,format=raw,if=sd,index=0 \
-netdev '{"type":"user","id":"hostnet0"}'
\
-net nic,macaddr=52:54:00:09:a4:37,netdev=hostnet0,model=lan9118,id=net0 \
diff --git a/tests/qemuxmlconfdata/arm-vexpressa9-nodevs.aarch64-latest.args
b/tests/qemuxmlconfdata/arm-vexpressa9-nodevs.aarch64-latest.args
index 86c0d47849..de96ada570 100644
--- a/tests/qemuxmlconfdata/arm-vexpressa9-nodevs.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/arm-vexpressa9-nodevs.aarch64-latest.args
@@ -30,7 +30,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armtest/.config \
-initrd /arm.initrd \
-append console=ttyAMA0,115200n8 \
-dtb /arm.dtb \
--usb \
-audiodev
'{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/arm-vexpressa9-virtio.aarch64-latest.args
b/tests/qemuxmlconfdata/arm-vexpressa9-virtio.aarch64-latest.args
index 79b569aa38..b4c295be6b 100644
--- a/tests/qemuxmlconfdata/arm-vexpressa9-virtio.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/arm-vexpressa9-virtio.aarch64-latest.args
@@ -31,7 +31,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armtest/.config \
-append 'console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0'
\
-dtb /arm.dtb \
-device
'{"driver":"virtio-serial-device","id":"virtio-serial0"}'
\
--usb \
-blockdev
'{"driver":"file","filename":"/arm.raw","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
-device
'{"driver":"virtio-blk-device","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}'
\
diff --git a/tests/qemuxmlconfdata/disk-arm-virtio-sd.aarch64-latest.args
b/tests/qemuxmlconfdata/disk-arm-virtio-sd.aarch64-latest.args
index 2572b51f95..3328189b44 100644
--- a/tests/qemuxmlconfdata/disk-arm-virtio-sd.aarch64-latest.args
+++ b/tests/qemuxmlconfdata/disk-arm-virtio-sd.aarch64-latest.args
@@ -30,7 +30,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-armtest/.config \
-initrd /arm.initrd \
-append 'console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0'
\
-dtb /arm.dtb \
--usb \
-drive file=/arm-sd.qcow2,format=qcow2,if=sd,index=0 \
-drive
file.driver=nbd,file.server.type=inet,file.server.host=localhost,file.server.port=10809,file.export=export,format=qcow2,if=sd,index=1
\
-drive
file.driver=gluster,file.volume=Volume3,file.path=Image.qcow2,file.server.0.type=inet,file.server.0.host=example.org,file.server.0.port=6000,file.server.1.type=inet,file.server.1.host=example.org,file.server.1.port=24007,file.server.2.type=unix,file.server.2.path=/path/to/sock,file.debug=4,format=qcow2,if=sd,index=2
\
diff --git a/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args
b/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args
index 1cb520cf4a..b285efa615 100644
--- a/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args
+++ b/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args
@@ -24,7 +24,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-redhat62sparc/.config \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
--usb \
-blockdev
'{"driver":"file","filename":"/home/berrange/VirtualMachines/redhat-6.2-sparc.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage"}'
\
-device
scsi-hd,bus=scsi.0,scsi-id=0,device_id=drive-scsi0-0-0-0,drive=libvirt-2-format,id=scsi0-0-0-0,bootindex=1
\
diff --git a/tests/qemuxmlconfdata/usb-controller-implicit-isapc.x86_64-latest.args
b/tests/qemuxmlconfdata/usb-controller-implicit-isapc.x86_64-latest.args
index 62dc26ee8b..cf8a176cd8 100644
--- a/tests/qemuxmlconfdata/usb-controller-implicit-isapc.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/usb-controller-implicit-isapc.x86_64-latest.args
@@ -26,7 +26,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
--usb \
-audiodev
'{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
--
2.43.0