Bug 1072294

Summary: should disable host_cdrom device pass-through via scsi-generic with correct warning message
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, armbru, chayang, hhuang, juzhang, michen, pbonzini, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-24 13:05:14 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:

Description Sibiao Luo 2014-03-04 10:24:35 UTC
Description of problem:
We have disabled host cdrom passthrough in bug 760885 with warning message prompt: Driver 'host_cdrom' is not whitelisted.
But 'Could not open file: Invalid argument' when pass-through host_cdrom device via scsi-generic.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-100.el7.x86_64
qemu-kvm-rhev-1.5.3-50.el7.x86_64
guest info:
# uname -r
3.10.0-100.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.insert a DVD/CD to host.
# ls -lh /dev/cdrom 
lrwxrwxrwx. 1 root root 3 Mar  4 18:07 /dev/cdrom -> sr0
# sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0
2.pass-through host_cdrom device via scsi-generic.
e.g:...-drive file=/dev/sg1,if=none,id=drive-data-disk,format=raw,media=cdrom,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi1,indirect_desc=off,event_idx=off,bus=pci.0,addr=0x8 -device scsi-generic,drive=drive-data-disk,id=data-disk
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sg1,if=none,id=drive-data-disk,format=raw,media=cdrom,cache=none,aio=native,werror=stop,rerror=stop: could not open disk image /dev/sg1: Could not open file: Invalid argument

Actual results:

Expected results:
QEMU will quit with warning message prompt: Driver 'host_cdrom' is not whitelisted.

Additional info:

Comment 1 Sibiao Luo 2014-03-07 03:33:18 UTC
(In reply to Sibiao Luo from comment #0)
> 2.pass-through host_cdrom device via scsi-generic.
> e.g:...-drive
> file=/dev/sg1,if=none,id=drive-data-disk,format=raw,media=cdrom,cache=none,
> aio=native,werror=stop,rerror=stop -device
> virtio-scsi-pci,id=scsi1,indirect_desc=off,event_idx=off,bus=pci.0,addr=0x8
> -device scsi-generic,drive=drive-data-disk,id=data-disk
> Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
> qemu-kvm: -drive
> file=/dev/sg1,if=none,id=drive-data-disk,format=raw,media=cdrom,cache=none,
> aio=native,werror=stop,rerror=stop: could not open disk image /dev/sg1:
> Could not open file: Invalid argument

Hmm, according bug 920096#c1, I should not specify cache=none for scsi-generic, i also tried the cache=writeback/writethrough which can boot up guest successfully and we can see the passthrough host_cdrom in guest correctly.

# sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0
e.g:...-drive file=/dev/sg1,if=none,id=drive-data-disk,format=raw,*cache=writeback*,aio=native -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x7 -device scsi-generic,drive=drive-data-disk,bus=scsi1.0,id=data-disk

Expected results:
QEMU will quit with warning message prompt: Driver 'host_cdrom' is not whitelisted.

Base on above, i will raise the priority for it, thanks.

Best Regards,
sluo

Comment 2 Markus Armbruster 2014-06-24 13:05:14 UTC
We disabled host CD-ROM passthrough via block backend host_cdrom (bug
760885).  Therefore, you can't back a scsi-cd or ide-cd device model
with a host CD-ROM device in RHEL-7.

We didn't disable SCSI host device passthrough via device model
scsi-generic.  Therefore, you *can* back a scsi-generic device model
with a host SCSI CD-ROM device in RHEL-7.

Maybe we should've disabled that kind of host CD-ROM passthrough as
well, maybe not.  Question is moot, as 7.0 shipped with it enabled.

Closing NOTABUG.  Please reopen if you think we should disable use of
host SCSI CD-ROM via scsi-generic even though we shipped it in 7.0.

Comment 3 Sibiao Luo 2014-06-25 04:30:56 UTC
(In reply to Markus Armbruster from comment #2)
> We disabled host CD-ROM passthrough via block backend host_cdrom (bug
> 760885).  Therefore, you can't back a scsi-cd or ide-cd device model
> with a host CD-ROM device in RHEL-7.
> 
> We didn't disable SCSI host device passthrough via device model
> scsi-generic.  Therefore, you *can* back a scsi-generic device model
> with a host SCSI CD-ROM device in RHEL-7.
> 
> Maybe we should've disabled that kind of host CD-ROM passthrough as
> well, maybe not.  Question is moot, as 7.0 shipped with it enabled.
> 
> Closing NOTABUG.  Please reopen if you think we should disable use of
> host SCSI CD-ROM via scsi-generic even though we shipped it in 7.0.

I think we should disable pass-through the host CD-ROM via scsi-generic as well, or we should implement it to work well, thanks.

Best Regards,
sluo

Comment 4 Markus Armbruster 2014-06-25 06:09:28 UTC
Comment#1 makes me believe scsi-generic backed by host CD-ROM works: "can boot up guest successfully and we can see the passthrough host_cdrom in guest correctly".  If that's not the case, please describe how exactly it doesn't work.

Comment 5 Sibiao Luo 2014-06-25 06:24:53 UTC
(In reply to Markus Armbruster from comment #4)
> Comment#1 makes me believe scsi-generic backed by host CD-ROM works: "can
> boot up guest successfully and we can see the passthrough host_cdrom in
> guest correctly".  If that's not the case, please describe how exactly it
> doesn't work.
Yes, thanks for your reminds, I just forgot the comment #1, it worked well indeed.

Comment 6 juzhang 2014-06-25 06:30:15 UTC
(In reply to Markus Armbruster from comment #2)
> We disabled host CD-ROM passthrough via block backend host_cdrom (bug
> 760885).  Therefore, you can't back a scsi-cd or ide-cd device model
> with a host CD-ROM device in RHEL-7.
> 
> We didn't disable SCSI host device passthrough via device model
> scsi-generic.  Therefore, you *can* back a scsi-generic device model
> with a host SCSI CD-ROM device in RHEL-7.
> 
> Maybe we should've disabled that kind of host CD-ROM passthrough as
> well, maybe not.  Question is moot, as 7.0 shipped with it enabled.

Hi Markus,

Thanks for your inputs first.

Back to QE POV, do we need to test scsi-generic & CD-ROM passthrough scenario in RHEL7.1? 

Do not disable scsi-generic & CD-ROM passthrough is by design? or just ignore it?

Look forward to your feedback.

Best Regards,
Junyi

> 
> Closing NOTABUG.  Please reopen if you think we should disable use of
> host SCSI CD-ROM via scsi-generic even though we shipped it in 7.0.

Comment 7 Markus Armbruster 2014-06-25 08:31:04 UTC
SCSI host device passthrough (device models scsi-generic and scsi-block) is an intentional RHEL-7 feature.  Evidence: bug 721250.

General rule for RHEL-7: qemu-kvm can do it, libvirt can configure it, we support it.  Exceptions are possible, but should be documented.

Regarding whether we need to test this: excellent point!  I figure our testing of SCSI host device passthrough should cover CD-ROM devices, too.

Comment 8 juzhang 2014-06-25 08:36:26 UTC
(In reply to Markus Armbruster from comment #7)
> SCSI host device passthrough (device models scsi-generic and scsi-block) is
> an intentional RHEL-7 feature.  Evidence: bug 721250.
> 
> General rule for RHEL-7: qemu-kvm can do it, libvirt can configure it, we
> support it.  Exceptions are possible, but should be documented.
> 
> Regarding whether we need to test this: excellent point!  I figure our
> testing of SCSI host device passthrough should cover CD-ROM devices, too.

Thanks Markus.

Best Regards,
Junyi