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 1271069 - Change media fail with virtio scsi cdrom when tray is open
Summary: Change media fail with virtio scsi cdrom when tray is open
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Jaroslav Suchanek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-13 06:26 UTC by Han Han
Modified: 2016-11-03 18:26 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:26:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Han Han 2015-10-13 06:26:13 UTC
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-24 02:33:22 UTC
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 13:06:31 UTC
Fixed upstream by:
commit c59b9e1483ca50290f865737877358978d88dfc7
Author:     Jaroslav Suchanek <jsuchane>
AuthorDate: Tue Jun 28 13:05:30 2016 +0200
Commit:     Erik Skultety <eskultet>
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 13:27:42 UTC
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 11:38:06 UTC
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 18:26:05 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/RHSA-2016-2577.html


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