From patchwork Sun May 15 21:03:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67818 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1234834qge; Sun, 15 May 2016 14:09:00 -0700 (PDT) X-Received: by 10.140.98.147 with SMTP id o19mr25934514qge.8.1463346540370; Sun, 15 May 2016 14:09:00 -0700 (PDT) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id b18si20430726qka.112.2016.05.15.14.08.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 15 May 2016 14:09:00 -0700 (PDT) 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 u4FL46oH004150; Sun, 15 May 2016 17:04:07 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u4FL44qp017006 for ; Sun, 15 May 2016 17:04:04 -0400 Received: from colepc.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4FL43pk004948; Sun, 15 May 2016 17:04:04 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 15 May 2016 17:03:55 -0400 Message-Id: <7f1e34f1ed8abe5bc7e4dc0100c3bfdabf51b9b8.1463346235.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: command: Ignore QEMU_CAPS_DEVICE when building drive alias 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 QEMU_CAPS_DEVICE is always set nowadays, so we can drop the non-DEVICE code paths --- src/qemu/qemu_command.c | 12 ++++-------- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_hotplug.c | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) -- 2.7.4 -- 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 0d6d5f8..4286999 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -377,17 +377,13 @@ qemuBuildObjectCommandlineFromJSON(const char *type, } -char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk, - virQEMUCapsPtr qemuCaps) +char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk) { char *ret; - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, - disk->info.alias)); - } else { - ignore_value(VIR_STRDUP(ret, disk->info.alias)); - } + if (virAsprintf(&ret, "%s%s", + QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) + return NULL; return ret; } diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index d5ad1b2..c777701 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -96,8 +96,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def, size_t vhostfdSize, virQEMUCapsPtr qemuCaps); -char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk, - virQEMUCapsPtr qemuCaps); +char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk); /* Both legacy & current support */ char *qemuBuildDriveStr(virDomainDiskDefPtr disk, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f40b34d..f8ab095 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -192,7 +192,7 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, if (qemuDomainPrepareDisk(driver, vm, disk, newsrc, false) < 0) goto cleanup; - if (!(driveAlias = qemuDeviceDriveHostAlias(disk, priv->qemuCaps))) + if (!(driveAlias = qemuDeviceDriveHostAlias(disk))) goto error; do { @@ -376,7 +376,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn, if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps))) goto error; - if (!(drivealias = qemuDeviceDriveHostAlias(disk, priv->qemuCaps))) + if (!(drivealias = qemuDeviceDriveHostAlias(disk))) goto error; if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))