Bug 1271069 - Change media fail with virtio scsi cdrom when tray is open
Change media fail with virtio scsi cdrom when tray is open
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Jaroslav Suchanek
Virtualization Bugs
: TestOnly
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-13 02:26 EDT by Han Han
Modified: 2016-11-03 14:26 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:26:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Han Han 2015-10-13 02:26:13 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.
Comment 1 Han Han 2015-10-23 22:33:22 EDT
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.
Comment 3 Jaroslav Suchanek 2016-06-28 09:06:31 EDT
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
Comment 4 Jaroslav Suchanek 2016-06-28 09:27:42 EDT
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.
Comment 5 yisun 2016-09-09 07:38:06 EDT
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>
...
Comment 7 errata-xmlrpc 2016-11-03 14:26:05 EDT
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

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