Red Hat Bugzilla – Bug 1271069
Change media fail with virtio scsi cdrom when tray is open
Last modified: 2016-11-03 14:26:05 EDT
Description of problem: When change media lively with scsi cdrom and the argument tray='open', it will fail. Version-Release number of selected component (if applicable): libvirt-1.2.17-13.el7.x86_64 qemu-kvm-rhev-2.3.0-30.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. Add a scsi empty cdrom with argument tray='open' to a guest: ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='sda' bus='scsi' tray='open'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> ... 2. Start guest and insert media : # virsh start t100 Domain t100 started # virsh change-media t100 sda /tmp/a.iso --insert error: Failed to complete action insert on media error: internal error: unable to execute QEMU command 'eject': Device 'drive-scsi0-0-0-0' is locked # virsh change-media t100 sda /tmp/a.iso --insert Successfully inserted media. 3. Restart guest and update media: # virsh destroy t100&&virsh start t100 Domain t100 destroyed Domain t100 started # virsh change-media t100 sda /tmp/a.iso --update error: Failed to complete action update on media error: internal error: unable to execute QEMU command 'eject': Device 'drive-scsi0-0-0-0' is locked # virsh change-media t100 sda /tmp/a.iso --update Successfully updated media. Actual results: As step2&3 Expected results: change media not failed. Additional info: Bug reproduced only when scsi cdrom, guest started, tray opened. Shutdowned guest or sata/ide bus or without tray open doesn't produce the bug.
The Bug seems fixed on upstream. On libvirt-1.2.20-2.fc24.x86_64 not reproduced: # virsh change-media centos sda /tmp/boot.iso --insert Successfully inserted media. Pls confirm it.
Fixed upstream by: commit c59b9e1483ca50290f865737877358978d88dfc7 Author: Jaroslav Suchanek <jsuchane@redhat.com> AuthorDate: Tue Jun 28 13:05:30 2016 +0200 Commit: Erik Skultety <eskultet@redhat.com> CommitDate: Tue Jun 28 13:52:34 2016 +0200 logging: fixing log level initialization from cmdline Reorder code for setting default log level from cmdline prior initialization of log outputs. Thus the --verbose option is reflected. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072
Please ignore the comment 3. That is unrelated. Anyway, I was not able to reproduce this with qemu-kvm-rhev-2.6.0-9.el7.x86_64 and libvirt-1.3.5-1.el7.x86_64. There were numerous fixes related to blockdev operations. Please re-test this. Thanks.
Verified on libvirt-2.0.0-8.el7.x86_64 # virsh dumpxml virtlab_test_copy| grep cdrom -a10 ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='sdb' bus='scsi' tray='open'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> ... # virsh start virtlab_test_copy Domain virtlab_test_copy started # virsh change-media virtlab_test_copy sdb /tmp/a.iso --insert Successfully inserted media. # virsh dumpxml virtlab_test_copy| grep cdrom -a10 ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/tmp/a.iso'/> <backingStore/> <target dev='sdb' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> ... # virsh change-media virtlab_test_copy sdb --eject Successfully ejected media. # virsh dumpxml virtlab_test_copy| grep cdrom -a10 ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <backingStore/> <target dev='sdb' bus='scsi' tray='open'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> ... # virsh change-media virtlab_test_copy sdb /tmp/a.iso --insert Successfully inserted media. # virsh dumpxml virtlab_test_copy| grep cdrom -a10 ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/tmp/a.iso'/> <backingStore/> <target dev='sdb' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> ... # virsh change-media virtlab_test_copy sdb /tmp/a.iso --insert error: The disk device 'sdb' already has media # virsh dumpxml virtlab_test_copy| grep cdrom -a10 ... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/tmp/a.iso'/> <backingStore/> <target dev='sdb' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> ...
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/RHSA-2016-2577.html