Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1026274

Summary: fail to specify "readonly=on|off" for pass-through scsi-block and emulated ide cdrom
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, bsarathy, chayang, juzhang, michen, mkenneth, 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:
: 1026583 (view as bug list) Environment:
Last Closed: 2013-11-05 11:16:52 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: 1026583    

Description Sibiao Luo 2013-11-04 10:15:32 UTC
Description of problem:
as subject, it display 'ro=1' or "ro": true all the time no matter you specify "readonly=on|off". 
About the passthrough scsi-block disk can be writed with "readonly=on", please refer to bug 993537.

Version-Release number of selected component (if applicable):
host info:
2.6.32-429.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.415.el6.x86_64
seabios-0.6.1.2-28.el6.x86_64
guest info:
2.6.32-429.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.insert a DVD disk to host.
2.boot guest with this dvd disk passthrough.
e.g1:...-drive file=/dev/sr0,if=none,id=drive-cdrom-disk,format=raw,media=cdrom,werror=stop,rerror=stop -device virtio-scsi-pci,bus=pci.0,addr=0x8,id=scsi0 -device scsi-block,drive=drive-cdrom-disk,bus=scsi0.0,id=cdrom-disk,bus=scsi0.0
3.boot guest with this dvd disk passthrough withe readonly=off specified.
e.g2:...-drive file=/dev/sr0,if=none,id=drive-cdrom-disk,format=raw,media=cdrom,werror=stop,rerror=stop,*readonly=off* -device virtio-scsi-pci,bus=pci.0,addr=0x8,id=scsi0 -device scsi-block,drive=drive-cdrom-disk,bus=scsi0.0,id=cdrom-disk,bus=scsi0.0
4.boot guest with this dvd disk passthrough withe readonly=on specified.
e.g3:...-drive file=/dev/sr0,if=none,id=drive-cdrom-disk,format=raw,media=cdrom,werror=stop,rerror=stop,*readonly=on* -device virtio-scsi-pci,bus=pci.0,addr=0x8,id=scsi0 -device scsi-block,drive=drive-cdrom-disk,bus=scsi0.0,id=cdrom-disk,bus=scsi0.0

Actual results:
after step 2-4, all of them display the same info about the passthrough disk.
- HMP:
(qemu) info block
...
drive-cdrom-disk: removable=0 io-status=ok file=/dev/sr0 ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
-QMP:
{"execute":"query-block"}
{"return": [...{"io-status": "ok", "device": "drive-cdrom-disk", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "iops_wr": 0, "ro": true, "drv": "raw", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/dev/sr0"}, "type": "unknown"}]}

Expected results:
it should "ro=0" when specify readonly=off, and it should "ro=1" when specify readonly=on, and maybe the default value should be "ro=0".

Additional info:

Comment 1 Sibiao Luo 2013-11-05 02:19:44 UTC
No matter specify the readonly=off or readonly=on for the passthrough new blank cdrom to guest, we can burn it in the guest successfully, this maybe the bug 993537, please let me separate a new bug if not, thanks in advance.

Comment 2 Sibiao Luo 2013-11-05 02:59:16 UTC
Also tried the passthrough hard disk with the same testing as comment #0 that did not hit this issue, so this issue is just specified to the passthrough cdrom.

Comment 3 Sibiao Luo 2013-11-05 05:58:26 UTC
Also hit it with emulated ide cdrom, but the emulated ide hard disk not met it. So, i modify the issue title.

Comment 4 Paolo Bonzini 2013-11-05 11:16:52 UTC
Not a bug; media=cdrom implies readonly=on.

Comment 5 Sibiao Luo 2013-11-08 08:49:13 UTC
(In reply to Paolo Bonzini from comment #4)
> Not a bug; media=cdrom implies readonly=on.
But i have anther problem. If we need to burn the blank DVD/CD in guest which passthrough to it adding the media=cdrom, it can be burn successfully while it was readonly. Does it not a problem, any idea about it ?

Best Regards,
sluo

Comment 6 Paolo Bonzini 2013-11-08 09:46:34 UTC
media=cdrom only affects whether scsi-disk "becomes" scsi-hd or scsi-cd.

To burn a CD-ROM with passthrough, you need to use scsi-block, thus there is no need to specify the "media" option.

Comment 7 Sibiao Luo 2013-11-11 02:09:27 UTC
(In reply to Paolo Bonzini from comment #6)
> media=cdrom only affects whether scsi-disk "becomes" scsi-hd or scsi-cd.
> 
> To burn a CD-ROM with passthrough, you need to use scsi-block, thus there is
> no need to specify the "media" option.

Ok, good catch, thanks.