Hide Forgot
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:
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.
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.
Also hit it with emulated ide cdrom, but the emulated ide hard disk not met it. So, i modify the issue title.
Not a bug; media=cdrom implies readonly=on.
(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
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.
(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.