aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-01 14:32:20 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-11-19 10:01:34 +0100
commit0d074bf8e74d16920d9c9a132a41d5200333c7bb (patch)
tree0b4fa9c36b2c28b210f656b2f38333149d9c3d52 /hw/scsi
parent2f34ebf222d6a9367665a4bf78b8c861a988c1d0 (diff)
downloadqemu-0d074bf8e74d16920d9c9a132a41d5200333c7bb.zip
qemu-0d074bf8e74d16920d9c9a132a41d5200333c7bb.tar.gz
qemu-0d074bf8e74d16920d9c9a132a41d5200333c7bb.tar.bz2
scsi: deprecate scsi-disk
It's an old compatibility shim that just delegates to scsi-cd or scsi-hd. Just like ide-drive, we don't need this. Acked-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/scsi-bus.c12
-rw-r--r--hw/scsi/scsi-disk.c3
2 files changed, 14 insertions, 1 deletions
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 359d50d..ad0e7f6 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -254,8 +254,18 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
char *name;
DeviceState *dev;
Error *err = NULL;
+ DriveInfo *dinfo;
- driver = blk_is_sg(blk) ? "scsi-generic" : "scsi-disk";
+ if (blk_is_sg(blk)) {
+ driver = "scsi-generic";
+ } else {
+ dinfo = blk_legacy_dinfo(blk);
+ if (dinfo && dinfo->media_cd) {
+ driver = "scsi-cd";
+ } else {
+ driver = "scsi-hd";
+ }
+ }
dev = qdev_create(&bus->qbus, driver);
name = g_strdup_printf("legacy[%d]", unit);
object_property_add_child(OBJECT(bus), name, OBJECT(dev), NULL);
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 07fb5eb..e44c61e 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2481,6 +2481,9 @@ static void scsi_disk_realize(SCSIDevice *dev, Error **errp)
DriveInfo *dinfo;
Error *local_err = NULL;
+ warn_report("'scsi-disk' is deprecated, "
+ "please use 'scsi-hd' or 'scsi-cd' instead");
+
if (!dev->conf.blk) {
scsi_realize(dev, &local_err);
assert(local_err);