diff mbox

[06/17] qemu: command: Drop QEMU_CAPS_DEVICE for device aliases

Message ID a4c4d807402452577444e37f2e7d49ee3a897b66.1453489952.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 22, 2016, 7:30 p.m. UTC
---
 src/qemu/qemu_command.c | 86 ++++---------------------------------------------
 1 file changed, 7 insertions(+), 79 deletions(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 594cee6..3ab53be 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -772,74 +772,16 @@  int qemuDomainNetVLAN(virDomainNetDefPtr def)
 
 
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
-                               virQEMUCapsPtr qemuCaps)
+                               virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED)
 {
     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));
-    }
+    ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX,
+                             disk->info.alias));
     return ret;
 }
 
 
-/* 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_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;
-}
-
 static int
 qemuSetSCSIControllerModel(virDomainDefPtr def,
                            virQEMUCapsPtr qemuCaps,
@@ -898,11 +840,10 @@  qemuSetSCSIControllerModel(virDomainDefPtr def,
     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;
@@ -941,19 +882,6 @@  qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def,
     return 0;
 }
 
-
-int
-qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
-                          virDomainDiskDefPtr def,
-                          virQEMUCapsPtr qemuCaps)
-{
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
-        return qemuAssignDeviceDiskAliasCustom(vmdef, def, qemuCaps);
-    else
-        return qemuAssignDeviceDiskAliasFixed(def);
-}
-
-
 int
 qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)
 {