Bug 1147471
Summary: | Ejecting locked cdrom tray using update-device fails but next try succeeds | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | hongming <honzhang> | |
Component: | libvirt | Assignee: | Pavel Hrdina <phrdina> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | high | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.1 | CC: | dyuan, eblake, jdenemar, mzhan, rbalakri, weizhan, xuzhang, yanyang | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-1.2.17-2.el7 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1289069 (view as bug list) | Environment: | ||
Last Closed: | 2015-11-19 05:53:33 UTC | Type: | Bug | |
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: | ||||
Bug Blocks: | 1289069 |
Description
hongming
2014-09-29 10:07:39 UTC
In python, you called dom.updateDeviceFlags(devxml, 1), while the virsh command was virsh update-device virtlab_test /tmp/cdrom.xml. Strictly speaking these two are not equivalent. You either need to pass 0 flags (instead of 1) or add --live to the virsh command to make both approaches equivalent. However, --current will be transformed into --live when the domain is running, so this is not a big deal in fact. Anyway, this has nothing to do with python bindings as I was able to reproduce this issue just using virsh. The strange thing is it's inconsistent. Running virsh update-device sometimes succeeds and sometimes fails. It seems like it fails for the first time complaining about a locked device but within a second or two QEMU sends DEVICE_TRAY_MOVED event saying the tray is opened. After this happens, update-device command succeeds but closes the tray so the next update-device fails again. See also this thread where the qemu folks admitted their QMP commands suck, and where libvirt needs to be taught to try harder at ejecting CD-ROM disks: https://www.redhat.com/archives/libvir-list/2014-October/msg00817.html with a proposed solution to wait until the DEVICE_TRAY_MOVED event occurs to determine what happened on the first QMP attempt, and to have up to two QMP attempts per single libvirt API try. Upstream patch proposed: https://www.redhat.com/archives/libvir-list/2015-June/msg01135.html I can reproduce it, verify it with libvirt-1.2.17-9.el7.x86_64 Steps 1. prepare a running guest with boot.iso <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/boot.iso'/> <backingStore/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> # cat /yy/cdrom1.xml <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/bbb.iso'/> <target dev='hdc' bus='ide'/> </disk> 2. update-device with bbb.iso # virsh update-device vm1 /yy/cdrom1.xml Device updated successfully # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' 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='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 3. change-media with boot.iso # virsh change-media vm1 hdc --update /var/lib/libvirt/images/boot.iso Successfully updated media. # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/boot.iso'/> <backingStore/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 4. eject cdrom # virsh change-media vm1 hdc --update Successfully ejected media. # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <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> 5. insert cdrom # virsh change-media vm1 hdc --insert /var/lib/libvirt/images/bbb.iso Successfully inserted media. # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' 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='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 6. prepare a running guest with a cdrom without source # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <backingStore/> <target dev='sdc' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-2'/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> 7. insert cdrom # virsh change-media vm1 sdc --insert /var/lib/libvirt/images/boot.iso Successfully inserted media. # virsh dumpxml vm1 | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel7.2.qcow2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/boot.iso'/> <backingStore/> <target dev='sdc' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-2'/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> update-device and change-media can be done once 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 |