Kevin Wolf <[email protected]> writes:

> The error handling policy was traditionally set with -drive, but with
> -blockdev it is no longer possible to set frontend options. scsi-disk
> (and other block devices) have long supported qdev properties to
> configure the error handling policy, so let's add these options to
> usb-storage as well and just forward them to the internal scsi-disk
> instance.
>
> Signed-off-by: Kevin Wolf <[email protected]>

Let's see whether I remember / figure out how this stuff works.

Not all devices support error handling policy, but scsi-disk does.

The preferred way to configure error handling policy is with qdev
properties rerror, werror.  blkconf_apply_backend_options() propagates
them to the associated BlockBackend.

The outmoded way is with -drive parameters rerror, werror.
blockdev_init() propagates them to the BlockBackend.

If you use both ways, qdev properties win.

usb-storage is a hack: it tries to look like a block device, but it's
really a SCSI controller that can serve only a single scsi-disk device,
which it creates automatically.

We want to deprecate -drive.  We also want to deprecate usb-storage, but
I guess we're still not ready for that (it's a complicated story).

To deprecate -drive without also deprecating usb-storage, we need to
preserve features.

The outmoded way works with usb-storage: the automatically created
scsi-disk is associated with the BlockBackend that got its error
handling policy from -drive.

The preferred way doesn't, because usb-storage lacks the qdev
properties.  This patch adds them.

Kind of sad, but it's either that or deprecating usb-storage.

Patch looks good to me, thus
Reviewed-by: Markus Armbruster <[email protected]>

Feel free to work whatever parts of my ramblings you find useful into
your commit message.

Reply via email to