From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 10/12] scsi: deprecate scsi-disk
Date: Tue, 19 Nov 2019 17:08:46 +0100 [thread overview]
Message-ID: <1574179728-35535-11-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1574179728-35535-1-git-send-email-pbonzini@redhat.com>
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>
---
hw/scsi/scsi-bus.c | 12 +++++++++++-
hw/scsi/scsi-disk.c | 3 +++
qemu-deprecated.texi | 5 +++++
tests/qemu-iotests/051.pc.out | 6 ++++--
4 files changed, 23 insertions(+), 3 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);
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 296bfc9..4b4b742 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -259,6 +259,11 @@ their usecases.
The 'ide-drive' device is deprecated. Users should use 'ide-hd' or
'ide-cd' as appropriate to get an IDE hard disk or CD-ROM as needed.
+@subsection scsi-disk (since 4.2)
+
+The 'scsi-disk' device is deprecated. Users should use 'scsi-hd' or
+'scsi-cd' as appropriate to get a SCSI hard disk or CD-ROM as needed.
+
@section System emulator machines
@subsection pc-0.12, pc-0.13, pc-0.14 and pc-0.15 (since 4.0)
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
index 34849dd..0ea80d3 100644
--- a/tests/qemu-iotests/051.pc.out
+++ b/tests/qemu-iotests/051.pc.out
@@ -167,7 +167,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk
QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) QEMU_PROG: -device scsi-disk,drive=disk: Device needs media, but drive is empty
+(qemu) QEMU_PROG: -device scsi-disk,drive=disk: warning: 'scsi-disk' is deprecated, please use 'scsi-hd' or 'scsi-cd' instead
+QEMU_PROG: -device scsi-disk,drive=disk: Device needs media, but drive is empty
Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk
QEMU X.Y.Z monitor - type 'help' for more information
@@ -238,7 +239,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk
QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+(qemu) QEMU_PROG: -device scsi-disk,drive=disk: warning: 'scsi-disk' is deprecated, please use 'scsi-hd' or 'scsi-cd' instead
+quit
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk
QEMU X.Y.Z monitor - type 'help' for more information
--
1.8.3.1
next prev parent reply other threads:[~2019-11-19 16:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 16:08 [PULL 00/12] Misc patches for QEMU 4.2-rc Paolo Bonzini
2019-11-19 16:08 ` [PULL 01/12] scripts: Detect git worktrees for get_maintainer.pl --git Paolo Bonzini
2019-11-19 16:08 ` [PULL 02/12] microvm: fix memory leak in microvm_fix_kernel_cmdline Paolo Bonzini
2019-11-19 16:08 ` [PULL 03/12] target/i386: add PSCHANGE_NO bit for the ARCH_CAPABILITIES MSR Paolo Bonzini
2019-11-19 16:08 ` [PULL 04/12] target/i386: Export TAA_NO bit to guests Paolo Bonzini
2019-11-19 16:08 ` [PULL 05/12] hw/i386: Fix compiler warning when CONFIG_IDE_ISA is disabled Paolo Bonzini
2019-11-19 16:08 ` [PULL 06/12] vfio: vfio-pci requires EDID Paolo Bonzini
2019-11-19 16:08 ` [PULL 07/12] docs/microvm.rst: fix alignment in "Limitations" Paolo Bonzini
2019-11-19 16:08 ` [PULL 08/12] docs/microvm.rst: add instructions for shutting down the guest Paolo Bonzini
2019-11-19 16:08 ` [PULL 09/12] hw/i386: Move save_tsc_khz from PCMachineClass to X86MachineClass Paolo Bonzini
2019-11-19 16:08 ` Paolo Bonzini [this message]
2019-11-19 16:08 ` [PULL 11/12] Revert "mc146818rtc: fix timer interrupt reinjection" Paolo Bonzini
2019-11-19 16:08 ` [PULL 12/12] mc146818rtc: fix timer interrupt reinjection again Paolo Bonzini
2019-11-19 18:30 ` [PULL 00/12] Misc patches for QEMU 4.2-rc Peter Maydell
2019-11-20 2:00 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1574179728-35535-11-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).