[PATCH 2/9] qemu: command: Remove dead code when formatting -drive

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

 



busid and unitid are ever used only if the device is an SD card due to
the check in qemuDiskBusNeedsDeviceArg. Since the SD card does not have
an bus or unit number, most of the code and command line formatter can
be removed since it will never be used.
---
 src/qemu/qemu_command.c | 37 +------------------------------------
 1 file changed, 1 insertion(+), 36 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b1cfafa79..a77a0a1fa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1639,38 +1639,11 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     const char *trans =
         virDomainDiskGeometryTransTypeToString(disk->geometry.trans);
     int idx = virDiskNameToIndex(disk->dst);
-    int busid = -1, unitid = -1;
     bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);

     if (qemuBuildDriveStrValidate(disk, qemuCaps, bus, idx) < 0)
         goto error;

-    switch (disk->bus) {
-    case VIR_DOMAIN_DISK_BUS_SCSI:
-        busid = disk->info.addr.drive.controller;
-        unitid = disk->info.addr.drive.unit;
-        break;
-
-    case VIR_DOMAIN_DISK_BUS_IDE:
-        busid = disk->info.addr.drive.bus;
-        unitid = disk->info.addr.drive.unit;
-        break;
-
-    case VIR_DOMAIN_DISK_BUS_FDC:
-        unitid = disk->info.addr.drive.unit;
-        break;
-
-    case VIR_DOMAIN_DISK_BUS_VIRTIO:
-        idx = -1;
-        break;
-
-    case VIR_DOMAIN_DISK_BUS_XEN:
-    case VIR_DOMAIN_DISK_BUS_SD:
-        /* Xen and SD have no address type currently, so assign
-         * based on index */
-        break;
-    }
-
     if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0)
         goto error;

@@ -1698,15 +1671,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
         virBufferAsprintf(&opt, ",id=%s", drivealias);
         VIR_FREE(drivealias);
     } else {
-        if (busid == -1 && unitid == -1) {
-            if (idx != -1)
-                virBufferAsprintf(&opt, ",index=%d", idx);
-        } else {
-            if (busid != -1)
-                virBufferAsprintf(&opt, ",bus=%d", busid);
-            if (unitid != -1)
-                virBufferAsprintf(&opt, ",unit=%d", unitid);
-        }
+        virBufferAsprintf(&opt, ",index=%d", idx);
     }
     if (bootable &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
-- 
2.14.3

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux