Bug 658147
Summary: | [vdsm] [libvirt] RFE - libvirt should allow user to ask for force eject | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | RHEL Program Management <pm-rhel> |
Component: | libvirt | Assignee: | Daniel Veillard <veillard> |
Status: | CLOSED WONTFIX | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | high | Docs Contact: | |
Priority: | urgent | ||
Version: | 6.1 | CC: | cpelland, crobinso, dallan, danken, eblake, hateya, iheim, jdenemar, mgoldboi, mjenner, mkenneth, plyons, pm-eus, xen-maint, ykaul, yoyzhang |
Target Milestone: | rc | Keywords: | FutureFeature, ZStream |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-0.8.1-27.el6_0.1 | Doc Type: | Enhancement |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2011-01-28 16:15:58 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 626305 | ||
Bug Blocks: | 602685 |
Description
RHEL Program Management
2010-11-29 14:17:51 UTC
Patches built into libvirt-0.8.1-27.el6_0.1 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 The z-stream package is correct. 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) Thanks for Jiri and Dan's guide. I verified this bug PASS calling the API from python script. - 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 Test steps: 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. # python Python 2.6.5 (r265:79063, Jul 14 2010, 11:36:05) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 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('rhel6-11') >>> d.updateDeviceFlags(empty,libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE) 0 5. cdrom device is replaced with empty # virsh dumpxml rhel6-11 ..... <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> ..... |