From patchwork Sun May 15 21:25:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67819 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1239758qge; Sun, 15 May 2016 14:30:12 -0700 (PDT) X-Received: by 10.55.77.205 with SMTP id a196mr26451190qkb.94.1463347812692; Sun, 15 May 2016 14:30:12 -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 o98si20483643qge.88.2016.05.15.14.30.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 15 May 2016 14:30:12 -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 u4FLPYV4006440; Sun, 15 May 2016 17:25:34 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u4FLPXAG019775 for ; Sun, 15 May 2016 17:25:33 -0400 Received: from colepc.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4FLPWxJ013392; Sun, 15 May 2016 17:25:32 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 15 May 2016 17:25:30 -0400 Message-Id: <96f46891b206340ac3306d4e74b5ac1ebcc3f5ea.1463347530.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: alias: Remove QEMU_CAPS_DEVICE 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 drop code that depends on not-DEVICE --- src/qemu/qemu_alias.c | 82 +++------------------------------------------------ 1 file changed, 4 insertions(+), 78 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_alias.c b/src/qemu/qemu_alias.c index ade2033..cb102ec 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -171,70 +171,11 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef, } -/* Names used before -drive supported the id= option */ -static int -qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk) -{ - int busid, devid; - int ret; - char *dev_name; - - if (virDiskNameToBusDeviceIndex(disk, &busid, &devid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot convert disk '%s' to bus/device index"), - disk->dst); - return -1; - } - - switch (disk->bus) { - case VIR_DOMAIN_DISK_BUS_IDE: - if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) - ret = virAsprintf(&dev_name, "ide%d-hd%d", busid, devid); - else - ret = virAsprintf(&dev_name, "ide%d-cd%d", busid, devid); - break; - case VIR_DOMAIN_DISK_BUS_SCSI: - if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) - ret = virAsprintf(&dev_name, "scsi%d-hd%d", busid, devid); - else - ret = virAsprintf(&dev_name, "scsi%d-cd%d", busid, devid); - break; - case VIR_DOMAIN_DISK_BUS_FDC: - ret = virAsprintf(&dev_name, "floppy%d", devid); - break; - case VIR_DOMAIN_DISK_BUS_VIRTIO: - ret = virAsprintf(&dev_name, "virtio%d", devid); - break; - case VIR_DOMAIN_DISK_BUS_XEN: - ret = virAsprintf(&dev_name, "xenblk%d", devid); - break; - case VIR_DOMAIN_DISK_BUS_SD: - ret = virAsprintf(&dev_name, "sd%d", devid); - break; - case VIR_DOMAIN_DISK_BUS_USB: - ret = virAsprintf(&dev_name, "usb%d", devid); - break; - default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk name mapping for bus '%s'"), - virDomainDiskBusTypeToString(disk->bus)); - return -1; - } - - if (ret == -1) - return -1; - - disk->info.alias = dev_name; - - return 0; -} - - /* Our custom -drive naming scheme used with id= */ -static int -qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def, - virDomainDiskDefPtr disk, - virQEMUCapsPtr qemuCaps) +int +qemuAssignDeviceDiskAlias(virDomainDefPtr def, + virDomainDiskDefPtr disk, + virQEMUCapsPtr qemuCaps) { const char *prefix = virDomainDiskBusTypeToString(disk->bus); int controllerModel = -1; @@ -276,18 +217,6 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def, int -qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, - virDomainDiskDefPtr def, - virQEMUCapsPtr qemuCaps) -{ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return qemuAssignDeviceDiskAliasCustom(vmdef, def, qemuCaps); - else - return qemuAssignDeviceDiskAliasFixed(def); -} - - -int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, char **alias, int idx) @@ -435,9 +364,6 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) return -1; } - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return 0; - for (i = 0; i < def->nfss; i++) { if (virAsprintf(&def->fss[i]->info.alias, "fs%zu", i) < 0) return -1;