mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
hw: Deprecate -drive if=scsi with non-onboard HBAs
Block backends defined with "-drive if=T" with T other than "none" are meant to be picked up by machine initialization code: a suitable frontend gets created and wired up automatically. Drives defined with if=scsi are also picked up by SCSI HBAs added with -device, unlike other interface types. Deprecate this usage, as follows. Create the frontends for onboard HBAs in machine initialization code, exactly like we do for if=ide and other interface types. Change scsi_legacy_handle_cmdline() to create a frontend only when it's still missing, and warn that this usage is deprecated. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1487161136-9018-3-git-send-email-armbru@redhat.com>
This commit is contained in:
parent
fb8b660e17
commit
a64aa5785d
9 changed files with 35 additions and 7 deletions
|
@ -261,7 +261,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
|
|||
return SCSI_DEVICE(dev);
|
||||
}
|
||||
|
||||
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
|
||||
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
|
||||
{
|
||||
Location loc;
|
||||
DriveInfo *dinfo;
|
||||
|
@ -274,6 +274,17 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
|
|||
continue;
|
||||
}
|
||||
qemu_opts_loc_restore(dinfo->opts);
|
||||
if (deprecated) {
|
||||
/* Handling -drive not claimed by machine initialization */
|
||||
if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) {
|
||||
continue; /* claimed */
|
||||
}
|
||||
if (!dinfo->is_default) {
|
||||
error_report("warning: bus=%d,unit=%d is deprecated with this"
|
||||
" machine type",
|
||||
bus->busnr, unit);
|
||||
}
|
||||
}
|
||||
scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
|
||||
unit, false, -1, NULL, &error_fatal);
|
||||
}
|
||||
|
@ -304,7 +315,7 @@ static int scsi_legacy_handle_cmdline_cb(Object *obj, void *opaque)
|
|||
SCSIBus *bus = (SCSIBus *)object_dynamic_cast(obj, TYPE_SCSI_BUS);
|
||||
|
||||
if (bus && is_scsi_hba_with_legacy_magic(OBJECT(bus->qbus.parent))) {
|
||||
scsi_bus_legacy_handle_cmdline(bus);
|
||||
scsi_bus_legacy_handle_cmdline(bus, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue