Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
I tested in plain libvirt without vdsm as we don't have vdsm env. Test result shows virsh command doesn't provide such option and the error still shows up. I wonder do you design expose such flag in virsh command or not ? Thanks.
- libvirt-0.8.1-27.el6_0.2.x86_64
- kernel-2.6.32-71.13.1.el6.x86_64
- qemu-kvm-0.12.1.2-2.113.el6_0.5.x86_64
1. Download an iso file
2. Add the following xml in guest xml config file and then start guest
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/RHEL6.0-20100922.1-Server-x86_64-DVD1.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
3. In guest, #mount /dev/sr0 /mnt
4. Prepare another cdrom-update.xml as below
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
</disk>
5. Force eject the cdrom in mouting failed
# virsh update-device rhel6-1 cdrom-update.xml
error: Failed to update device from cdrom-update.xml
error: internal error unable to execute QEMU command 'eject': Device 'drive-ide0-1-0' is locked
The new flag name is not the same in RHEL 6.0.z and RHEL 6.1. I do not care which version gives in, but the difference is too ugly to keep.
# rpm -q libvirt ; pydoc libvirt |grep FORCE
libvirt-0.8.1-28.el6.x86_64 VIR_DOMAIN_DEVICE_EJECT_FORCE = 4
libvirt-0.8.1-27.el6_0.2.x86_64 VIR_DOMAIN_DEVICE_MODIFY_FORCE = 4
Hmm, right, the patch doesn't contain virsh support for this flag. It's not required for vdsm but it would be nice to have. To verify this, you either need vdsm environment with support for this or call the API from a python script.
zhanghaiyan, you can use the following python script to force-eject a mounted cdrom:
import libvirt
empty = """<disk device='cdrom'>
<target dev='hdc' bus='ide'/>
<alias name='ide0-1-0'/>
</disk>
"""
c = libvirt.open('qemu:///system')
d = c.lookupByName('your domain name')
d.updateDeviceFlags(empty, libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE)