Bug 919380

Summary: Add support for rerror/werror to scsi-generic in rhel7
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: areis, chayang, hhuang, juzhang, kwolf, michen, pbonzini, qzhang, rbalakri, stefanha, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1021102 (view as bug list) Environment:
Last Closed: 2015-12-11 14:43:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1021102    

Description Sibiao Luo 2013-03-08 10:01:57 UTC
Description of problem:
Just as discus with pbonzini that add support for rerror/werror to scsi-generic in rhel7.

Version-Release number of selected component (if applicable):
host info:
kernel-3.8.0-0.40.el7.x86_64
QEMU 1.4.50

How reproducible:
100%

Steps to Reproduce:
1.boot guest with scsi-generic adding werror=stop,rerror=stop.
e.g:...-drive file='/dev/sg1',werror=stop,rerror=stop... -device virtio-scsi-pci,... -device scsi-generic,...
2.
3.
  
Actual results:
after step 1, it will fail to boot up, and qemu will prompt like:
qemu-system-x86_64: -drive file=/dev/sg1,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,cache=none,aio=native: could not open disk image /dev/sg1: Invalid argument

Expected results:
we should add support for rerror/werror to scsi-generic.

Additional info:

Comment 1 Sibiao Luo 2013-03-11 03:47:17 UTC
(In reply to comment #0)  
> Actual results:
> after step 1, it will fail to boot up, and qemu will prompt like:
> qemu-system-x86_64: -drive
> file=/dev/sg1,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,
> cache=none,aio=native: could not open disk image /dev/sg1: Invalid argument
> 
Ignore above prompt, as this prompt is about the cache=none prompt. The right one as following:
e.g:...-drive file=/dev/sg2,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,aio=native -device virtio-scsi-pci,id=scsi1,addr=0x5 -device scsi-generic,bus=scsi1.0,drive=drive-data-disk,id=data-disk

qemu-kvm: -device scsi-generic,bus=scsi1.0,drive=drive-data-disk,id=data-disk: Device doesn't support drive option werror
qemu-kvm: -device scsi-generic,bus=scsi1.0,drive=drive-data-disk,id=data-disk: Device 'scsi-generic' could not be initialized

--------------------------------------------------------------------------------

Paolo, 

    If i boot guest with the cache=none for scsi-generic drive, it will fail to boot up, does it the same issue, does the scsi-generic support the cache=none for drive ? should we need to open a new bug for it ? btw, the "writeback", "unsafe", "directsync" and "writethrough" is ok for cache value of scsi-generic drive. 
e.g:...-drive file=/dev/sg2,if=none,id=drive-data-disk,format=raw,cache=none,aio=native -device virtio-scsi-pci,id=scsi1,addr=0x5 -device scsi-generic,bus=scsi1.0,drive=drive-data-disk,id=data-disk 

qemu-kvm: -drive file=/dev/sg2,if=none,id=drive-data-disk,format=raw,cache=none,aio=native: could not open disk image /dev/sg2: Invalid argument

Best Regards.
sluo

Comment 2 Paolo Bonzini 2013-03-11 10:41:17 UTC
Thanks for the report.  Yes, you can open a separate bug.  QEMU should ignore cache=none for scsi-generic because it always _behaves_ like cache=none but _using_ cache=none fails (O_DIRECT is not supported by /dev/sgN devices).

Comment 3 Sibiao Luo 2013-03-11 10:55:55 UTC
(In reply to comment #2)
> Thanks for the report.  Yes, you can open a separate bug.  QEMU should
> ignore cache=none for scsi-generic because it always _behaves_ like
> cache=none but _using_ cache=none fails (O_DIRECT is not supported by
> /dev/sgN devices).
see bug 920096, thx for your kindly checking.

Comment 4 Markus Armbruster 2013-05-17 13:04:59 UTC
scsi-generic.c needs to call scsi_handle_rw_error() (or equivalent function) like
scsi-disk.c does (see commit ea8a5d7 and commit 5dba48a).  Upstream first.

Comment 6 Markus Armbruster 2014-07-16 11:33:28 UTC
We refined rerror/werror upstream to not apply when the LBA range is
invalid, and are backporting that to RHEL-7 (bug 1085232).

Stupid question: how could we similarly filter out invalid LBA ranges
for scsi-generic?

Comment 8 Markus Armbruster 2014-07-25 12:15:55 UTC
rerror/werror require support in the underlying device model.
Currently, only ide-hd, ide-cd, ide-drive (legacy), scsi-hd, scsi-cd,
scsi-disk (legacy), scsi-block (partially[*]), virtio-blk-device do.

Device models that do not support it: isa-fdc, cfi.pflash01,
scsi-generic, nvme, ...  This bug is only about scsi-generic.

See also bug 1123355 - Document -drive rerror/werror restrictions.


[*] Should work as long as you stick to plain read/write.  Fancy stuff
like write same gets tricky.

Comment 9 Markus Armbruster 2014-07-25 12:21:06 UTC
The obvious way to fully implement rerror/werror for scsi-generic
involves understanding all SCSI commands.  Even vendor-specific
commands.  Defeats the purpose device pass-through.

Perhaps something covering just werror=enospc (and the default
=report, of course) could be hacked up with just understanding sense
codes.

Unless we can come up with workable ideas *and* a business case
justifying the work, this feels like a WONTFIX to me.

However, Paolo would like to address this upstream.  His rough ETA is
in one year.  He's prefer to keep this bug open for now.