Currently all machine types which do honour '-usb' are already covered
by code which will either select a proper controller model or would
select the same one which '-usb' would use.
Thus all of the legacy -usb controller code can be removed.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 88 ++-----------------
.../sparc-minimal.sparc-latest.args | 1 -
2 files changed, 8 insertions(+), 81 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2d6f930756..b163322191 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2919,62 +2919,6 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
}
-static bool
-qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
-{
- if (ARCH_IS_X86(def->os.arch) ||
- ARCH_IS_PPC(def->os.arch) ||
- ARCH_IS_ARM(def->os.arch) ||
- qemuDomainIsRISCVVirt(def))
- return true;
-
- return false;
-}
-
-
-static int
-qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd,
- const virDomainDef *def)
-{
- size_t i;
- size_t nlegacy = 0;
- size_t nusb = 0;
-
- for (i = 0; i < def->ncontrollers; i++) {
- virDomainControllerDef *cont = def->controllers[i];
-
- if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_USB)
- continue;
-
- /* If we have mode='none', there are no other USB controllers */
- if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
- return 0;
-
- if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT)
- nlegacy++;
- else
- nusb++;
- }
-
- if (nlegacy > 1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Multiple legacy USB controllers are not
supported"));
- return -1;
- }
-
- if (nusb == 0 &&
- !qemuBuildDomainForbidLegacyUSBController(def) &&
- !ARCH_IS_S390(def->os.arch)) {
- /* We haven't added any USB controller yet, but we haven't been asked
- * not to add one either. Add a legacy USB controller, unless we're
- * creating a kind of guest we want to keep legacy-free */
- virCommandAddArg(cmd, "-usb");
- }
-
- return 0;
-}
-
-
/**
* qemuBuildSkipController:
* @controller: Controller to check
@@ -3055,29 +2999,16 @@ qemuBuildControllersByTypeCommandLine(virCommand *cmd,
if (qemuBuildSkipController(cont, def))
continue;
- /* skip USB controllers with type none.*/
- if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
- cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
- continue;
- }
+ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
- if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
- cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT &&
- !qemuBuildDomainForbidLegacyUSBController(def)) {
+ /* skip USB controllers with type none*/
+ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
+ continue;
- /* An appropriate default USB controller model should already
- * have been selected in qemuDomainDeviceDefPostParse(); if
- * we still have no model by now, we have to fall back to the
- * legacy USB controller.
- *
- * Note that we *don't* want to end up with the legacy USB
- * controller for q35 and virt machines, so we go ahead and
- * fail in qemuBuildControllerDevProps(); on the other hand,
- * for s390 machines we want to ignore any USB controller
- * (see 548ba43028 for the full story), so we skip
- * qemuBuildControllerDevProps() but we don't ultimately end
- * up adding the legacy USB controller */
- continue;
+ /* skip 'default' controllers on s390 for legacy reasons */
+ if (ARCH_IS_S390(def->os.arch) &&
+ cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT)
+ continue;
}
if (qemuBuildControllerDevProps(def, cont, qemuCaps, &props) < 0)
@@ -3135,9 +3066,6 @@ qemuBuildControllersCommandLine(virCommand *cmd,
return -1;
}
- if (qemuBuildLegacyUSBControllerCommandLine(cmd, def) < 0)
- return -1;
-
return 0;
}
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
\
--
2.43.0