Add qemuBuildDomainForbidLegacyUSBController

Shorten some long conditions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Ján Tomko 2019-01-15 16:08:48 +01:00
parent 79c7cbaf46
commit 95049d7054

View File

@ -3049,6 +3049,18 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
}
static bool
qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
{
if (qemuDomainIsQ35(def) ||
qemuDomainIsARMVirt(def) ||
qemuDomainIsRISCVVirt(def))
return true;
return false;
}
static int
qemuBuildLegacyUSBControllerCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@ -3068,9 +3080,7 @@ qemuBuildLegacyUSBControllerCommandLine(virCommandPtr cmd,
}
if (usbcontroller == 0 &&
!qemuDomainIsQ35(def) &&
!qemuDomainIsARMVirt(def) &&
!qemuDomainIsRISCVVirt(def) &&
!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
@ -3173,9 +3183,7 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT &&
!qemuDomainIsQ35(def) &&
!qemuDomainIsARMVirt(def) &&
!qemuDomainIsRISCVVirt(def)) {
!qemuBuildDomainForbidLegacyUSBController(def)) {
/* An appropriate default USB controller model should already
* have been selected in qemuDomainDeviceDefPostParse(); if