Bug 1026274 - fail to specify "readonly=on|off" for pass-through scsi-block and emulated ide cdrom
fail to specify "readonly=on|off" for pass-through scsi-block and emulated id...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.5
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Virtualization Maintenance
Virtualization Bugs
:
Depends On:
Blocks: 1026583
  Show dependency treegraph
 
Reported: 2013-11-04 05:15 EST by Sibiao Luo
Modified: 2013-11-10 21:09 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1026583 (view as bug list)
Environment:
Last Closed: 2013-11-05 06:16:52 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sibiao Luo 2013-11-04 05:15:32 EST
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-04 21:19:44 EST
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-04 21:59:16 EST
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 00:58:26 EST
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 06:16:52 EST
Not a bug; media=cdrom implies readonly=on.
Comment 5 Sibiao Luo 2013-11-08 03:49:13 EST
(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 04:46:34 EST
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-10 21:09:27 EST
(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.

Note You need to log in before you can comment on or make changes to this bug.