mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: command: Remove dead code when formatting -drive
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.
This commit is contained in:
parent
e5580888f5
commit
b60ce7b122
@ -1639,38 +1639,11 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
const char *trans =
|
const char *trans =
|
||||||
virDomainDiskGeometryTransTypeToString(disk->geometry.trans);
|
virDomainDiskGeometryTransTypeToString(disk->geometry.trans);
|
||||||
int idx = virDiskNameToIndex(disk->dst);
|
int idx = virDiskNameToIndex(disk->dst);
|
||||||
int busid = -1, unitid = -1;
|
|
||||||
bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);
|
bool emitDeviceSyntax = qemuDiskBusNeedsDeviceArg(disk->bus);
|
||||||
|
|
||||||
if (qemuBuildDriveStrValidate(disk, qemuCaps, bus, idx) < 0)
|
if (qemuBuildDriveStrValidate(disk, qemuCaps, bus, idx) < 0)
|
||||||
goto error;
|
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)
|
if (qemuBuildDriveSourceStr(disk, cfg, &opt, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -1698,15 +1671,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
virBufferAsprintf(&opt, ",id=%s", drivealias);
|
virBufferAsprintf(&opt, ",id=%s", drivealias);
|
||||||
VIR_FREE(drivealias);
|
VIR_FREE(drivealias);
|
||||||
} else {
|
} else {
|
||||||
if (busid == -1 && unitid == -1) {
|
|
||||||
if (idx != -1)
|
|
||||||
virBufferAsprintf(&opt, ",index=%d", idx);
|
virBufferAsprintf(&opt, ",index=%d", idx);
|
||||||
} else {
|
|
||||||
if (busid != -1)
|
|
||||||
virBufferAsprintf(&opt, ",bus=%d", busid);
|
|
||||||
if (unitid != -1)
|
|
||||||
virBufferAsprintf(&opt, ",unit=%d", unitid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (bootable &&
|
if (bootable &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user