Bug 1124815

Summary: fail to detect the new cdrom device in guest after "change" it to anther iso (scsi-cd only)
Product: Red Hat Enterprise Linux 7 Reporter: chcheng <chcheng>
Component: qemu-kvm-rhevAssignee: John Snow <jsnow>
Status: CLOSED ERRATA QA Contact: FuXiangChun <xfu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: hhuang, huding, juzhang, lijin, mdeng, michen, mrezanin, qzhang, rbalakri, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu 2.6.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-07 20:15:01 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:

Description chcheng 2014-07-30 11:49:43 UTC
Description of problem:
The new cdrom device can not be detected in guest after "change" it to anther iso (virtio-cd only) with qemu-kvm-rhev-2.1.0.
BTW,
1.Also tried the IDE which did not hit it.
2.Also tried the qemu-kvm-1.5.3-64 with the same steps which did not hit it.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-132.el7.x86_64
qemu-kvm-rhev-2.1.0-1.el7ev.preview.x86_64
guest info:
# uname -r
3.10.0-132.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot with QMP enabled like:...-qmp tcp:0:4444,server -device virtio-scsi-pci,bus=pci.0,addr=0x9,id=scsi1  -drive file=/home/aaa.iso,format=raw,if=none,id=cdrom1,werror=stop,rerror=stop,cache=none    -device ide-drive,bus=ide.0,unit=0,drive=cdrom1,id=ide0-0-0 
2.from any box with telnet client
run #telnet $HostIP 4444
3.query the existing cdrom device in QMP and check it in guest.
QMP:
{"execute": "qmp_capabilities"}
{"execute": "query-block"}
in guest:
# ls /dev/cdrom -lh 
4.change the cdrom to anther one.
QMP: 
{"execute":"eject","arguments":{"device":"cdrom1"}}
{"execute":"change","arguments":{"device":"cdrom1","target":"/home/bbb.iso"}}
5. query the new cdrom in QMP and in guest.
QMP:
{"execute": "query-block"}
in guest:
# ls /dev/cdrom -lh 
# mount /dev/cdrom /mnt


Actual results:
after step 5,the new cdrom device can not be seen in guest, but can be seen in QMP.
in guest:
# ls /dev/cdrom -lh 
lrwxrwxrwx. 1 root toot 3 Jul 31 03:41 /dev/cdrom -> sr0
# mount /dev/cdrom /mnt
mount:no medium found on /dev/sr0
QMP:
{"execute": "query-block"}
 ... "image": {"virtual-size": 4268605440, "filename": "/home/bbb.iso", "format": "raw", "actual-size": 4268605440, "dirty-flag": false}...

BTW,it can be detected in guest after reboot the KVM guest.

Expected results:
after step 5,the new cdrom device can be detected both in guest and QMP.

Additional info:

Comment 2 Sibiao Luo 2014-07-30 12:46:22 UTC
(In reply to chcheng from comment #0)
> Description of problem:
> The new cdrom device can not be detected in guest after "change" it to
> anther iso (virtio-cd only) with qemu-kvm-rhev-2.1.0.
> BTW,
> 1.Also tried the IDE which did not hit it.
> 2.Also tried the qemu-kvm-1.5.3-64 with the same steps which did not hit it.
> 
> Steps to Reproduce:
> 1.boot with QMP enabled like:...-qmp tcp:0:4444,server -device
> virtio-scsi-pci,bus=pci.0,addr=0x9,id=scsi1  -drive
> file=/home/aaa.iso,format=raw,if=none,id=cdrom1,werror=stop,rerror=stop,
> cache=none    -device ide-drive,bus=ide.0,unit=0,drive=cdrom1,id=ide0-0-0 
Just scsi-cd interface hit it while ide-cd not hit it, but you paste the wrong qemu-kvm command line. Please paste your right cmdline.

Best Regards,
sluo

Comment 3 chcheng 2014-07-30 13:00:39 UTC
hi,all. sorry for my carelessness.
the Steps 1 to Reproduce should be:
1.boot with QMP enabled like:...-qmp tcp:0:4444,server -device virtio-scsi-pci,bus=pci.0,addr=0x9,id=scsi1 -drive file=/home/aaa.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1 -device scsi-cd,bus=scsi0.0,drive=cdrom1,id=scsi0-0

Other steps remains the same.

(In reply to chcheng from comment #0)

> Steps to Reproduce:
> 1.boot with QMP enabled like:...-qmp tcp:0:4444,server -device
> virtio-scsi-pci,bus=pci.0,addr=0x9,id=scsi1  -drive
> file=/home/aaa.iso,format=raw,if=none,id=cdrom1,werror=stop,rerror=stop,
> cache=none    -device ide-drive,bus=ide.0,unit=0,drive=cdrom1,id=ide0-0-0

Comment 4 lijin 2014-11-06 06:52:03 UTC
windows guest also hit the same issue when change scsi-cd iso image,and after reboot guest,the new iso image can be seen in guest.

package info:
qemu-kvm-rhev-2.1.2-5.el7.x86_64
kernel-3.10.0-196.el7.x86_64
virtio-win-prewhql-92
seabios-1.7.5-5.el7.x86_64

Comment 7 John Snow 2016-06-08 19:26:13 UTC
Appears to work correctly on current upstream master:

/x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 4096 -cpu host -M pc -smp 4 -qmp tcp::4444,server,nowait -hda /media/ext/img/f24b.qcow2 -drive id=cd0,media=cdrom,file=/media/ext/iso/Fedora-Workstation-Live-x86_64-24_Beta-1.6.iso,if=none,format=raw -device virtio-scsi-pci,id=scsi-pci -device scsi-cd,bus=scsi-pci.0,drive=cd0,id=scsicd -monitor stdio


(QEMU) eject device=cd0
{
    "execute": "eject", 
    "arguments": {
        "device": "cd0"
    }
}
{
    "error": {
        "class": "GenericError", 
        "desc": "Device 'cd0' is locked and force was not specified, wait for tray to open and try again"
    }
}
(QEMU) eject device=cd0
{
    "execute": "eject", 
    "arguments": {
        "device": "cd0"
    }
}
{
    "return": {}
}
(QEMU) change device=cd0 target=/media/ext/iso/linux/Fedora-Live-Workstation-x86_64-23-10.iso
{
    "execute": "change", 
    "arguments": {
        "device": "cd0", 
        "target": "/media/ext/iso/linux/Fedora-Live-Workstation-x86_64-23-10.iso"
    }
}
{
    "return": {}
}
(QEMU) 



After the "eject" the mounted ISO is removed from the gnome Files visualizer, and after "change" the new ISO is clearly visible. During re-testing, please ensure that the "change" command completes successfully. It is not necessary to 'eject' first when using the 'change' command, either.

Comment 9 FuXiangChun 2016-09-08 09:58:39 UTC
verified the bug with qemu-kvm-rhev-2.6.0-23.el7

1./usr/libexec/qemu-kvm -boot menu=on -m 2G -vnc :1 -object iothread,id=iothread0 -drive file=rbd:libvirt-pool/rhel.raw:mon_host=10.66.144.26,format=raw,if=none,id=drive-scsi-disk0,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0,iothread=iothread0 -device scsi-hd,drive=drive-scsi-disk0,bus=scsi0.0,scsi-id=0,lun=0,id=scsi-disk0 -qmp tcp:0:6666,server,nowait -device virtio-scsi-pci,bus=pci.0,addr=0x9,id=scsi1 -drive file=/home/aaa.iso,if=none,media=cdrom,readonly=on,format=raw,id=cdrom1 -device scsi-cd,bus=scsi0.0,drive=cdrom1,id=scsi0-0 -monitor stdio

2.query the existing cdrom device in QMP and check it in guest.
QMP:
{"execute": "qmp_capabilities"}
{"execute": "query-block"}
in guest:
# ls /dev/cdrom -lh 
3.change the cdrom to anther one.
QMP: 
{"execute":"eject","arguments":{"device":"cdrom1"}}
{"execute":"change","arguments":{"device":"cdrom1","target":"/home/bbb.iso"}}
4. query the new cdrom in QMP and in guest.
QMP:
{"execute": "query-block"}
in guest:
# ls /dev/cdrom -lh 
# mount /dev/cdrom /mnt

result:
after step4, mount is successful. the new cdrom device can be detected both in guest and QMP

Comment 11 errata-xmlrpc 2016-11-07 20:15:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2673.html