This function is tightly coupled with qemuDomainDefaultUSBControllerModel(), as whether or not the legacy '-usb' option is going to be used depends on the return value of both. As such, it makes sense for them to be close to one another. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_command.c | 16 ++-------------- src/qemu/qemu_domain.c | 12 ++++++++++++ src/qemu/qemu_domain.h | 1 + 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4aad7066e9..ec4982bbf6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2918,18 +2918,6 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef, } -static bool -qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def) -{ - if (qemuDomainIsQ35(def) || - qemuDomainIsARMVirt(def) || - qemuDomainIsRISCVVirt(def)) - return true; - - return false; -} - - static int qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd, const virDomainDef *def) @@ -2961,7 +2949,7 @@ qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd, } if (nusb == 0 && - !qemuBuildDomainForbidLegacyUSBController(def) && + !qemuDomainForbidLegacyUSBController(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 @@ -3061,7 +3049,7 @@ qemuBuildControllersByTypeCommandLine(virCommand *cmd, if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT && - !qemuBuildDomainForbidLegacyUSBController(def)) { + !qemuDomainForbidLegacyUSBController(def)) { /* An appropriate default USB controller model should already * have been selected in qemuDomainDeviceDefPostParse(); if diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dcf73c0e08..2b7eae295b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4258,6 +4258,18 @@ qemuDomainDefaultUSBControllerModel(const virDomainDef *def, } +bool +qemuDomainForbidLegacyUSBController(const virDomainDef *def) +{ + if (qemuDomainIsQ35(def) || + qemuDomainIsARMVirt(def) || + qemuDomainIsRISCVVirt(def)) + return true; + + return false; +} + + static int qemuDomainDefAddDefaultDevices(virQEMUDriver *driver, virDomainDef *def, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 48f966fa2a..4e61d741f3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -839,6 +839,7 @@ bool qemuDomainSupportsPCIMultibus(const virDomainDef *def); int qemuDomainDefaultSCSIControllerModel(const virDomainDef *def, const virDomainControllerDef *cont, virQEMUCaps *qemuCaps); +bool qemuDomainForbidLegacyUSBController(const virDomainDef *def); void qemuDomainUpdateCurrentMemorySize(virDomainObj *vm); -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx