|
|
ae23c9 |
From 4fa8ef564ee9326ceb0b6a4898dee294fa2b4bb4 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 2 Jul 2018 12:20:17 +0200
|
|
|
ae23c9 |
Subject: [PATCH 180/268] usb-storage: Add rerror/werror properties
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180702122017.29664-2-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81183
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/1] usb-storage: Add rerror/werror properties
|
|
|
ae23c9 |
Bugzilla: 1595180
|
|
|
ae23c9 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
The error handling policy was traditionally set with -drive, but with
|
|
|
ae23c9 |
-blockdev it is no longer possible to set frontend options. scsi-disk
|
|
|
ae23c9 |
(and other block devices) have long supported qdev properties to
|
|
|
ae23c9 |
configure the error handling policy, so let's add these options to
|
|
|
ae23c9 |
usb-storage as well and just forward them to the internal scsi-disk
|
|
|
ae23c9 |
instance.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit b8efb36b9e99dbea7370139c0866b97a933f78d4)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
hw/scsi/scsi-bus.c | 11 ++++++++++-
|
|
|
ae23c9 |
hw/usb/dev-storage.c | 2 ++
|
|
|
ae23c9 |
include/hw/scsi/scsi.h | 2 ++
|
|
|
ae23c9 |
3 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
|
|
|
ae23c9 |
index 9646743..5905f6b 100644
|
|
|
ae23c9 |
--- a/hw/scsi/scsi-bus.c
|
|
|
ae23c9 |
+++ b/hw/scsi/scsi-bus.c
|
|
|
ae23c9 |
@@ -226,6 +226,8 @@ static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
|
|
|
ae23c9 |
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
|
|
|
ae23c9 |
int unit, bool removable, int bootindex,
|
|
|
ae23c9 |
bool share_rw,
|
|
|
ae23c9 |
+ BlockdevOnError rerror,
|
|
|
ae23c9 |
+ BlockdevOnError werror,
|
|
|
ae23c9 |
const char *serial, Error **errp)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
const char *driver;
|
|
|
ae23c9 |
@@ -262,6 +264,10 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
|
|
|
ae23c9 |
object_unparent(OBJECT(dev));
|
|
|
ae23c9 |
return NULL;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ qdev_prop_set_enum(dev, "rerror", rerror);
|
|
|
ae23c9 |
+ qdev_prop_set_enum(dev, "werror", werror);
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
object_property_set_bool(OBJECT(dev), true, "realized", &err;;
|
|
|
ae23c9 |
if (err != NULL) {
|
|
|
ae23c9 |
error_propagate(errp, err);
|
|
|
ae23c9 |
@@ -285,7 +291,10 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
qemu_opts_loc_restore(dinfo->opts);
|
|
|
ae23c9 |
scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
|
|
|
ae23c9 |
- unit, false, -1, false, NULL, &error_fatal);
|
|
|
ae23c9 |
+ unit, false, -1, false,
|
|
|
ae23c9 |
+ BLOCKDEV_ON_ERROR_AUTO,
|
|
|
ae23c9 |
+ BLOCKDEV_ON_ERROR_AUTO,
|
|
|
ae23c9 |
+ NULL, &error_fatal);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
loc_pop(&loc;;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
|
|
|
ae23c9 |
index b56c75a..68e2062 100644
|
|
|
ae23c9 |
--- a/hw/usb/dev-storage.c
|
|
|
ae23c9 |
+++ b/hw/usb/dev-storage.c
|
|
|
ae23c9 |
@@ -634,6 +634,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
|
|
|
ae23c9 |
&usb_msd_scsi_info_storage, NULL);
|
|
|
ae23c9 |
scsi_dev = scsi_bus_legacy_add_drive(&s->bus, blk, 0, !!s->removable,
|
|
|
ae23c9 |
s->conf.bootindex, s->conf.share_rw,
|
|
|
ae23c9 |
+ s->conf.rerror, s->conf.werror,
|
|
|
ae23c9 |
dev->serial,
|
|
|
ae23c9 |
errp);
|
|
|
ae23c9 |
blk_unref(blk);
|
|
|
ae23c9 |
@@ -687,6 +688,7 @@ static const VMStateDescription vmstate_usb_msd = {
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static Property msd_properties[] = {
|
|
|
ae23c9 |
DEFINE_BLOCK_PROPERTIES(MSDState, conf),
|
|
|
ae23c9 |
+ DEFINE_BLOCK_ERROR_PROPERTIES(MSDState, conf),
|
|
|
ae23c9 |
DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
|
|
|
ae23c9 |
DEFINE_PROP_END_OF_LIST(),
|
|
|
ae23c9 |
};
|
|
|
ae23c9 |
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
|
|
|
ae23c9 |
index e35137e..1a7290d 100644
|
|
|
ae23c9 |
--- a/include/hw/scsi/scsi.h
|
|
|
ae23c9 |
+++ b/include/hw/scsi/scsi.h
|
|
|
ae23c9 |
@@ -154,6 +154,8 @@ static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
|
|
|
ae23c9 |
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
|
|
|
ae23c9 |
int unit, bool removable, int bootindex,
|
|
|
ae23c9 |
bool share_rw,
|
|
|
ae23c9 |
+ BlockdevOnError rerror,
|
|
|
ae23c9 |
+ BlockdevOnError werror,
|
|
|
ae23c9 |
const char *serial, Error **errp);
|
|
|
ae23c9 |
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus);
|
|
|
ae23c9 |
void scsi_legacy_handle_cmdline(void);
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|