From patchwork Fri Jan 22 19:30:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 60194 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp51339lbb; Fri, 22 Jan 2016 11:33:21 -0800 (PST) X-Received: by 10.28.172.193 with SMTP id v184mr5680307wme.94.1453491193021; Fri, 22 Jan 2016 11:33:13 -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 g203si6008828wmf.79.2016.01.22.11.33.12 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 11:33:12 -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 u0MJUrLn010354; Fri, 22 Jan 2016 14:30:53 -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 u0MJUgX0019892 for ; Fri, 22 Jan 2016 14:30:42 -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 u0MJUaPR002518; Fri, 22 Jan 2016 14:30:39 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 22 Jan 2016 14:30:19 -0500 Message-Id: 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 04/17] qemu: command: Don't unset QEMU_CAPS_DEVICE for -drive sd 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 Since -device can't be used with bus=sd disks, we would unset QEMU_CAPS_DEVICE temporarily for these disks. However since QEMU_CAPS_DEVICE is going away, we don't want code to key off that anymore. Push the bus=sd check down into BuildDriveStr, and use that to hit the different code paths. --- src/qemu/qemu_command.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 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 bf6eb9f..dade9f5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3734,6 +3734,9 @@ qemuBuildDriveStr(virConnectPtr conn, int busid = -1, unitid = -1; char *source = NULL; int actualType = virStorageSourceGetActualType(disk->src); + bool usesDeviceArg = ( + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && + (disk->bus != VIR_DOMAIN_DISK_BUS_SD)); if (idx < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3872,7 +3875,7 @@ qemuBuildDriveStr(virConnectPtr conn, } VIR_FREE(source); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) + if (usesDeviceArg) virBufferAddLit(&opt, "if=none"); else virBufferAsprintf(&opt, "if=%s", bus); @@ -3889,7 +3892,7 @@ qemuBuildDriveStr(virConnectPtr conn, } } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + if (usesDeviceArg) { virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); } else { if (busid == -1 && unitid == -1) { @@ -10184,7 +10187,6 @@ qemuBuildCommandLine(virConnectPtr conn, int bootindex = 0; virDomainDiskDefPtr disk = def->disks[i]; bool withDeviceArg = false; - bool deviceFlagMasked = false; /* Unless we have -device, then USB disks need special handling */ @@ -10228,24 +10230,16 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-drive"); - /* Unfortunately it is not possible to use - -device for floppies, xen PV, or SD - devices. Fortunately, those don't need - static PCI addresses, so we don't really - care that we can't use -device */ + /* Unfortunately it is not possible to use -device for SD devices. + Fortunately, those don't need static PCI addresses, so we don't + really care that we can't use -device */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) { + if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) withDeviceArg = true; - } else { - virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE); - deviceFlagMasked = true; - } } optstr = qemuBuildDriveStr(conn, disk, emitBootindex ? false : !!bootindex, qemuCaps); - if (deviceFlagMasked) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); if (!optstr) goto error; virCommandAddArg(cmd, optstr);