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 1229592 - change-media with option update cannot eject cdrom as it always requires new source when device has source
Summary: change-media with option update cannot eject cdrom as it always requires new ...
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
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-09 08:10 UTC by Yang Yang
Modified: 2015-11-19 06:40 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:40:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Yang Yang 2015-06-09 08:10:40 UTC
Description of problem:
change-media with option update cannot eject cdrom as it always requires new source when device has source

Version-Release number of selected component (if applicable):
libvirt-1.2.16-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a running guest with following xml
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/vm1.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/bbb.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2.eject cdrom by issuing following cli
# virsh change-media simple hda --update
error: New disk media source was not specified

3.

Actual results:
Cannot eject cdrom by change-media --update

Expected results:
cdrom should be ejected

Additional info:
regression

Comment 2 Peter Krempa 2015-06-09 12:17:05 UTC
Fixed upstream:

commit 23e913671d20a9b6cc233f72cc8ac2fe996443a1
Author: Peter Krempa <pkrempa>
Date:   Tue Jun 9 13:27:42 2015 +0200

    virsh: change-media: Fix behavior with --update without a source
    
    Docs state that it should behave like eject. Currently the code does not
    do that. This is a regression since f4b5f53027da4fed2250628e11bac4019.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1229592

v1.2.16-112-g23e9136

Comment 5 Pei Zhang 2015-08-04 09:39:21 UTC
I can reproduce it . verify it like following 

verify version:
libvirt-1.2.17-3.el7.x86_64

steps:

1>change-media via --update for a running domian 
1.define and start a guest like following 
# virsh dumpxml r7-vm1 | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/a.iso' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
2.Using change-media with --update to eject the cdrom 

# virsh change-media r7-vm1 hdc --update
Successfully ejected media.

3.check domain xml, the media is ejected.
# virsh dumpxml r7-vm1 | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdc' bus='ide' tray='open'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

2>change-media via --update with --config

1.define and start a guest like following 
# virsh dumpxml r7-vm1 --inactive | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/b.iso' startupPolicy='optional'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

# virsh change-media r7-vm1 hdc --update --config
Successfully ejected media.

2. reboot guest to check 

# virsh destroy r7-vm1;virsh start r7-vm1
Domain r7-vm1 destroyed

Domain r7-vm1 started

3.dumpxml to check, the media was ejected.

# virsh dumpxml r7-vm1 | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
3>change-media via --update with --live --config; pass 
# virsh change-media r7-vm1 hdc --update --live --config
Successfully ejected media.

4>change-media via --update with --current ; pass 
# virsh change-media r7-vm1 hdc --update --current
Successfully ejected media.

5>change-media with source , the media can be changed 

3. change-media via --update with a source .the media can be changed .
# virsh dumpxml r7-vm1 | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/b.iso' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

# virsh change-media r7-vm1 hdc --update /var/lib/libvirt/images/a.iso 
Successfully updated media.

# virsh dumpxml r7-vm1 | grep disk -A 9
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/a.iso' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

As above, move this bug to verified.

Comment 7 errata-xmlrpc 2015-11-19 06:40:26 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-2015-2202.html


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