All the logic was in a QEMU_CAPS_DEVICE conditional. Unindent it --- src/qemu/qemu_command.c | 112 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f2e9f6a..a943d69 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9986,73 +9986,71 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - for (j = 0; j < ARRAY_CARDINALITY(contOrder); j++) { - for (i = 0; i < def->ncontrollers; i++) { - virDomainControllerDefPtr cont = def->controllers[i]; - char *devstr; + for (j = 0; j < ARRAY_CARDINALITY(contOrder); j++) { + for (i = 0; i < def->ncontrollers; i++) { + virDomainControllerDefPtr cont = def->controllers[i]; + char *devstr; - if (cont->type != contOrder[j]) - continue; + if (cont->type != contOrder[j]) + continue; - /* skip USB controllers with type none.*/ - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && - cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { - usbcontroller = -1; /* mark we don't want a controller */ + /* skip USB controllers with type none.*/ + if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { + usbcontroller = -1; /* mark we don't want a controller */ + continue; + } + + /* skip pci-root/pcie-root */ + if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) + continue; + + /* first SATA controller on Q35 machines is implicit */ + if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA && + cont->idx == 0 && qemuDomainMachineIsQ35(def)) continue; - } - /* skip pci-root/pcie-root */ - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI && - (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || - cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) + /* first IDE controller is implicit on various machines */ + if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE && + cont->idx == 0 && qemuDomainMachineHasBuiltinIDE(def)) continue; - /* first SATA controller on Q35 machines is implicit */ - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA && - cont->idx == 0 && qemuDomainMachineIsQ35(def)) - continue; - - /* first IDE controller is implicit on various machines */ - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE && - cont->idx == 0 && qemuDomainMachineHasBuiltinIDE(def)) - continue; - - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && - cont->model == -1 && - !qemuDomainMachineIsQ35(def)) { - bool need_legacy = false; - - /* We're not using legacy usb controller for q35 */ - if (ARCH_IS_PPC64(def->os.arch)) { - /* For ppc64 the legacy was OHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) - need_legacy = true; - } else { - /* For anything else, we used PIIX3_USB_UHCI */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) - need_legacy = true; - } + if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + cont->model == -1 && + !qemuDomainMachineIsQ35(def)) { + bool need_legacy = false; - if (need_legacy) { - if (usblegacy) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multiple legacy USB controllers are " - "not supported")); - goto error; - } - usblegacy = true; - continue; - } + /* We're not using legacy usb controller for q35 */ + if (ARCH_IS_PPC64(def->os.arch)) { + /* For ppc64 the legacy was OHCI */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + need_legacy = true; + } else { + /* For anything else, we used PIIX3_USB_UHCI */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) + need_legacy = true; } - virCommandAddArg(cmd, "-device"); - if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, - &usbcontroller))) - goto error; - virCommandAddArg(cmd, devstr); - VIR_FREE(devstr); + if (need_legacy) { + if (usblegacy) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multiple legacy USB controllers are " + "not supported")); + goto error; + } + usblegacy = true; + continue; + } } + + virCommandAddArg(cmd, "-device"); + if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, + &usbcontroller))) + goto error; + virCommandAddArg(cmd, devstr); + VIR_FREE(devstr); } } -- 2.5.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list