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 602026 - Cannot change cdrom by "change device filename [format] " in (qemu) command line
Summary: Cannot change cdrom by "change device filename [format] " in (qemu) command line
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: 6.1
Assignee: chellwig@redhat.com
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 602186 (view as bug list)
Depends On:
Blocks: 580954
TreeView+ depends on / blocked
 
Reported: 2010-06-09 02:07 UTC by Cao, Chen
Modified: 2013-01-09 22:42 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.78.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-13 07:57:14 UTC
Target Upstream Version:
Embargoed:


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

Description Cao, Chen 2010-06-09 02:07:51 UTC
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 Program Management 2010-06-09 02:33:19 UTC
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-09 03:20:24 UTC
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 17:55:01 UTC
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 18:07:07 UTC
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-12 01:25:04 UTC
(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 06:29:17 UTC
I have verified the fix on qemu-kvm-0.12.1.2-2.78.el6.

Comment 10 Daniel Berrangé 2010-06-22 14:35:58 UTC
*** Bug 602186 has been marked as a duplicate of this bug. ***

Comment 12 Suqin Huang 2010-10-08 10:12:37 UTC
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 11:10:02 UTC
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-28 02:22:57 UTC
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 07:52:41 UTC
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 07:57:14 UTC
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.