[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: alias: Remove QEMU_CAPS_DEVICE



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(-)

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;
-- 
2.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]