Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 602026 - Cannot change cdrom by "change device filename [format] " in (qemu) command line
Cannot change cdrom by "change device filename [format] " in (qemu) command line
Status: CLOSED WORKSFORME
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: 6.1
Assigned To: chellwig@redhat.com
Virtualization Bugs
: Reopened
: 602186 (view as bug list)
Depends On:
Blocks: 580954
  Show dependency treegraph
 
Reported: 2010-06-08 22:07 EDT by Cao, Chen
Modified: 2013-01-09 17:42 EST (History)
12 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.78.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-13 03:57:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Open CDROM device read-only from the monitor change command (1.14 KB, patch)
2010-06-11 14:07 EDT, chellwig@redhat.com
no flags Details | Diff

  None (edit)
Description Cao, Chen 2010-06-08 22:07:51 EDT
Description of problem:
just cannot change,
the cdrom does not appear in "info block" or guest OS.


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.71.el6.x86_64


How reproducible:
100%


Steps to Reproduce:
1.  start vm with command,
$ qemu-kvm -name 'vm1' -monitor stdio -drive file=./win7-32-virtio.qcow2,if=virtio,cache=none,boot=on -net nic,vlan=0,model=virtio,macaddr=02:30:20:EC:31:c2 -net tap,vlan=0,ifname=virtio_0_6001,script=/etc/qemu-ifup-switch,downscript=no -m 4096 -smp 2  -soundhw ac97 -redir tcp:5000::22 -vnc :0 -usbdevice tablet -rtc-td-hack  -cpu qemu64,+sse2 -no-kvm-pit-reinjection -serial unix:/tmp/serial-20100608-115414-Avvj,server,nowait -drive file=/home/kvm_autotest_root/iso/windows/winutils.iso,media=cdrom,if=ide

2. type "info block"
(qemu) info block
virtio0: type=hd removable=0 file=./win7-32-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide0-cd0: type=cdrom removable=1 locked=0 file=/home/kvm_autotest_root/iso/windows/winutils.iso ro=1 drv=raw encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

3. try to change cdrom ide0-cd0 by command in (qemu) command line:
(qemu) change ide0-cd0 /home/kvm_autotest_root/iso/windows/winutils2.iso

4. type "info block" tp check the block info
(qemu) info block
virtio0: type=hd removable=0 file=./win7-32-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide0-cd0: type=cdrom removable=1 locked=0 [not inserted]
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]


5. try to change the cdrom ide1-cd0
(qemu) change ide1-cd0 /home/kvm_autotest_root/iso/windows/winutils3.iso

6. type "info block" tp check the block info

  

Actual results:
the cdrom does not change/cannot be inserted.
"change" cdrom without eject the original one, will cause the attached
cdrom ejected, but the new one cannot be inserted.


Expected results:
the cdrom is changed accordingly


Additional info:
1.
I have tried to "eject" the cdrom before "change" it, but failed.

2.

[root@dhcp-0-1 ISO]# rpm -qa |grep qemu
qemu-kvm-tools-0.12.1.2-2.69.el6.x86_64
gpxe-roms-qemu-0.9.7-6.3.el6.noarch
qemu-img-0.12.1.2-2.69.el6.x86_64
qemu-kvm-0.12.1.2-2.69.el6.x86_64

[root@dhcp-0-1 ISO]# uname -a
Linux dhcp-0-1.nay.redhat.com 2.6.32-33.el6.x86_64 #1 SMP Thu Jun 3 13:00:03 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Comment 2 RHEL Product and Program Management 2010-06-08 22:33:19 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 3 Cao, Chen 2010-06-08 23:20:24 EDT
Addtionally,

1.
the cdrom can be changed successfully if the .iso file is on local harddisk.

2.
/home/kvm_autotest_root/iso/ is a mount point to nfs server

[root@dhcp-0-1 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      51606140   6484972  42499728  14% /
tmpfs                  3997220         0   3997220   0% /dev/shm
/dev/sda1               495844     93790    376454  20% /boot
/dev/mapper/VolGroup-lv_home
                     418528000  50934360 346333560  13% /home
192.168.1.110:/vol/kvm/iso
                     1395654656 910985984 484668672  66% /home/kvm_autotest_root/iso
Comment 4 chellwig@redhat.com 2010-06-11 13:55:01 EDT
Is the NFS server exported read-only?  It seems like the monitor change command opens the block device without the read-only flag, which would cause errors when the filesystem is read-only.  In addition to that we're lacking any kind of error handling for the bdrv_open call in the change command, so no errors get reported.
Comment 5 chellwig@redhat.com 2010-06-11 14:07:07 EDT
Created attachment 423357 [details]
Open CDROM device read-only from the monitor change command

Backport of the upstream patch to open CDROM device read-only.  We're still missing out on error handling in the monitor change handler, but it seems like a lot of infrastructure for that is missing in the RHEL6 qemu version.
Comment 6 Cao, Chen 2010-06-11 21:25:04 EDT
(In reply to comment #4)
> Is the NFS server exported read-only?  It seems like the monitor change command
> opens the block device without the read-only flag, which would cause errors
> when the filesystem is read-only.  In addition to that we're lacking any kind
> of error handling for the bdrv_open call in the change command, so no errors
> get reported.    

yes, it is read-only.

and if the NFS server is mounted as RW, the "change" command returns successfully.
Comment 9 Cao, Chen 2010-06-22 02:29:17 EDT
I have verified the fix on qemu-kvm-0.12.1.2-2.78.el6.
Comment 10 Daniel Berrange 2010-06-22 10:35:58 EDT
*** Bug 602186 has been marked as a duplicate of this bug. ***
Comment 12 Suqin Huang 2010-10-08 06:12:37 EDT
I can reproduce this bug

qemu: qemu-kvm-0.12.1.2-2.113.el6_0.1.x86_64
kernel: 2.6.32-71.2.1.el6_0.x86_64


cmd: /usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/qemu -monitor stdio -drive file='/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/win2008r2-64-virtio.qcow2',index=0,if=none,id=drive-virtio-disk1,media=disk,cache=none,boot=on,format=qcow2,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=id5poILV,id=ndev00id5poILV,mac='02:30:1F:F3:6d:5a',bus=pci.0,addr=0x3 -netdev tap,id=id5poILV,ifname='virtio_0_8000',script='/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/scripts/qemu-ifup-switch',downscript='no' -m 2048 -smp 2 -cpu cpu64-rhel6,+x2apic -vnc :0 -spice port=8000,disable-ticketing -vga qxl -rtc base=utc,clock=host,driftfix=none -M rhel6.0.0 -usbdevice tablet -no-kvm-pit-reinjection -enable-kvm

3. change cdrom, iso is not changed

1). (qemu) info block
drive-virtio-disk1: type=hd removable=0 file=/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/win2008r2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
2). (qemu) change ide1-cd0 file=/usr/share/virtio-win/virtio-win-1.1.12.iso
3). (qemu) info block
drive-virtio-disk1: type=hd removable=0 file=/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/win2008r2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
Comment 14 chellwig@redhat.com 2011-03-18 07:10:02 EDT
Suqin, can you please retest it again?  I tried in a couple different setups with qemu-kvm-0.12.1.2-2.150.el6 and both changing an existing CDROM as in the original bug report, as well as changing the empyt default cdrom as in your test works fine.
Comment 16 Suqin Huang 2011-03-27 22:22:57 EDT
1. Can not reproduce in qemu-kvm-0.12.1.2-2.152.el6.x86_64

/usr/libexec/qemu-kvm -monitor stdio -drive file=/root/win2008r2-64-virtio.qcow2,index=0,if=none,id=drive-virtio-disk1,media=disk,cache=none,format=qcow2,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=idBUoK1M,mac=9a:cd:2e:5a:f3:8f,id=ndev00idBUoK1M,bus=pci.0,addr=0x3 -netdev tap,id=idBUoK1M,vhost=on,script=/home/Auto/autotest/client/tests/kvm/scripts/qemu-ifup-switch,downscript=no -m 2048 -smp 2,cores=1,threads=1,sockets=2 -cpu Penryn -vnc :1 -rtc base=utc,clock=host,driftfix=none -M rhel6.1.0 -boot order=cdn,once=c,menu=off -usbdevice tablet -no-kvm-pit-reinjection -enable-kvm
Using CPU model "Penryn"
Using CPU model "Penryn"
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info block
drive-virtio-disk1: type=hd removable=0 file=/root/win2008r2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

(qemu) change ide1-cd0 /home/kvm_autotest_root/iso/linux/RHEL6.1-Server-i386.iso

(qemu) info block
drive-virtio-disk1: type=hd removable=0 file=/root/win2008r2-64-virtio.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=/home/kvm_autotest_root/iso/linux/RHEL6.1-Server-i386.iso ro=1 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
Comment 20 juzhang 2011-06-13 03:52:41 EDT
Can not be reproduced with qemu-kvm-0.12.1.2-2.164.el6.x86_64,Mark qa_ack+

(1).

/usr/libexec/qemu-kvm -name 'vm1' -monitor stdio -drive file=rhel5.7-64,if=virtio,cache=none,boot=on -net nic,vlan=0,model=virtio,macaddr=02:30:20:EC:31:c2 -net tap,vlan=0,ifname=virtio_0_6001,script=/etc/qemu-ifup,downscript=no -m 4096 -smp 2  -soundhw ac97 -redir tcp:5000::22 -vnc :0 -usbdevice tablet -rtc-td-hack  -cpu qemu64,+sse2 -no-kvm-pit-reinjection -serial unix:/tmp/serial-20100608-115414-Avvj,server,nowait -drive file=RHEL-Server-5.7-x86_64-DVD.iso,media=cdrom,if=ide



(2).

(qemu) info block

virtio0: type=hd removable=0 file=rhel5.7-64 ro=0 drv=qcow2 encrypted=0

ide0-cd0: type=cdrom removable=1 locked=0 file=RHEL-Server-5.7-x86_64-DVD.iso ro=1 drv=raw encrypted=0

ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]

floppy0: type=floppy removable=1 locked=0 [not inserted]

sd0: type=floppy removable=1 locked=0 [not inserted]

(qemu) change ide0-cd0 RHEL-Server-5.7-x86_64-DVD-bak.iso

(qemu) info block

virtio0: type=hd removable=0 file=rhel5.7-64 ro=0 drv=qcow2 encrypted=0

ide0-cd0: type=cdrom removable=1 locked=0 file=RHEL-Server-5.7-x86_64-DVD-bak.iso ro=1 drv=raw encrypted=0

ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]

floppy0: type=floppy removable=1 locked=0 [not inserted]

sd0: type=floppy removable=1 locked=0 [not inserted]

(qemu) change ide1-cd0 RHEL-Server-5.7-x86_64-DVD.iso

(qemu) info block

virtio0: type=hd removable=0 file=rhel5.7-64 ro=0 drv=qcow2 encrypted=0

ide0-cd0: type=cdrom removable=1 locked=0 file=RHEL-Server-5.7-x86_64-DVD-bak.iso ro=1 drv=raw encrypted=0

ide1-cd0: type=cdrom removable=1 locked=0 file=RHEL-Server-5.7-x86_64-DVD.iso ro=1 drv=raw encrypted=0

floppy0: type=floppy removable=1 locked=0 [not inserted]

sd0: type=floppy removable=1 locked=0 [not inserted]



(qemu) eject ide0-cd0

(qemu) info block

virtio0: type=hd removable=0 file=rhel5.7-64 ro=0 drv=qcow2 encrypted=0

ide0-cd0: type=cdrom removable=1 locked=0 [not inserted]

ide1-cd0: type=cdrom removable=1 locked=0 file=RHEL-Server-5.7-x86_64-DVD.iso ro=1 drv=raw encrypted=0

floppy0: type=floppy removable=1 locked=0 [not inserted]

sd0: type=floppy removable=1 locked=0 [not inserted]
Comment 21 juzhang 2011-06-13 03:57:14 EDT
According to comment16 comment19 and comment20, close this issue as worksforme temporary,if you find same issue in the future,please re-open it.

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