From patchwork Fri Jan 22 19:30:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 60190 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp51216lbb; Fri, 22 Jan 2016 11:33:10 -0800 (PST) X-Received: by 10.55.31.9 with SMTP id f9mr6014108qkf.5.1453491188296; Fri, 22 Jan 2016 11:33:08 -0800 (PST) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id z23si8551567qka.91.2016.01.22.11.33.07 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 11:33:08 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUqSj010341; Fri, 22 Jan 2016 14:30:52 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUikx019921 for ; Fri, 22 Jan 2016 14:30:44 -0500 Received: from colepc.redhat.com (ovpn-113-198.phx2.redhat.com [10.3.113.198]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MJUaPV002518; Fri, 22 Jan 2016 14:30:44 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 22 Jan 2016 14:30:23 -0500 Message-Id: <9147686cc04595813227a7237cb11ea2fb774edc.1453489952.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/17] qemu: command: drop QEMU_CAPS_DEVICE for controller cli X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com 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(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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); } }