Bug 1206114
Summary: | add an event on device attach | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Giuseppe Scrivano <gscrivan> | |
Component: | libvirt | Assignee: | Ján Tomko <jtomko> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | medium | Docs Contact: | ||
Priority: | medium | |||
Version: | 7.2 | CC: | dyuan, gscrivan, jtomko, juzhou, mzhan, rbalakri, tzheng, virt-bugs, zhwang | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-1.2.15-1.el7 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | 1179138 | |||
: | 1212168 (view as bug list) | Environment: | ||
Last Closed: | 2015-11-19 06:24:49 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: | 1179138, 1212168 |
Description
Giuseppe Scrivano
2015-03-26 10:50:32 UTC
Upstream patches proposing the VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event: https://www.redhat.com/archives/libvir-list/2015-April/msg00183.html and adding it to the python bindings: https://www.redhat.com/archives/libvir-list/2015-April/msg00186.html Note that both the new event and DEVICE_REMOVED are only emitted by the qemu driver. Now pushed upstream: commit b693b2fb731f0f188974c63d84d06dedcfcc6c7a Author: Ján Tomko <jtomko> CommitDate: 2015-04-15 17:06:01 +0200 Emit VIR_DOMAIN_EVENT_ID_DEVICE_ADDED in the QEMU driver Only for devices that have an alias. commit 1882c0bd8d9ebedea527419df32098bdd24b4047 Author: Ján Tomko <jtomko> CommitDate: 2015-04-15 17:06:01 +0200 Add VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event The counterpart to VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED. https://bugzilla.redhat.com/show_bug.cgi?id=1206114 git describe: v1.2.14-188-gb693b2f Hi Jan I could verify this bug with the libvirt-1.2.15-2.el7.x86_64 packet, Verify steps as following 1.Start a guest in the first terminal 1.Open the second terminal, run the 'event-test.py' python script to catch the event # python /usr/share/doc/libvirt-python-1.2.15/examples/event-test.py qemu:///system Using uri:qemu:///system 2.Open third terminal, run the virsh event command to catch the evetns #virsh event --all --loop 3.Prepare a network xml # cat nic.xml <interface type='network'> <source network='default'/> </interface> 4.Attach the network xml to the guest # virsh attach-device 7.0 network.xml Device attached successfully # virsh attach-disk 7.0 /var/lib/libvirt/images/test.img vdb Disk attached successfully # virsh detach-disk 7.0 vdb Disk detached successfully 5.Hotplug /hotunplug the disk 5.Check the events in the second and third terminal could catch the device-add events successfully # python /usr/share/doc/libvirt-python-1.2.15/examples/event-test.py qemu:///system Using uri:qemu:///system myDomainEventDeviceAddedCallback: Domain 7.0(38) device added: net myDomainEventDeviceAddedCallback: Domain 7.0(38) device added: virtio-disk1 myDomainEventDeviceRemovedCallback: Domain 7.0(38) device removed: virtio-disk1 # virsh event --all --loop event 'device-added' for domain 7.0: net1 event 'device-added' for domain 7.0: virtio-disk1 event 'device-removed' for domain 7.0: virtio-disk1 However, met a strange thing while run the virsh change-media command, it catched 'disk-change' events for virsh event --loop --all command, however capture 'myDomainEventTrayChangeCallback:' events for "event-test.py" python scripts, I think they should be coincident, can you help confirm it? thanks 1.Start a guest with cdrom in the first termina # virsh dumpxml 7.0 |grep cdrom -A 6 <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <backingStore/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> 2.Create a iso file #qemu-img create /var/lib/libvirt/image/test.img 100M 3.Open the second terminal, run the 'event-test.py' python script to catch the event # python /usr/share/doc/libvirt-python-1.2.15/examples/event-test.py qemu:///system Using uri:qemu:///system 4.Open third terminal, run the virsh event command to catch the events #virsh event --all --loop 5.Run the change-media command # virsh change-media 7.0 hdc /var/lib/libvirt/images/test.img Successfully updated media. 6.Check the events in the second terminal and the third terminal, found they didn't report the same events, the event-test.py report the 'tray-change' events, virsh events command report the 'disk-change' events # python /usr/share/doc/libvirt-python-1.2.15/examples/event-test.py qemu:///system Using uri:qemu:///system myDomainEventTrayChangeCallback: Domain 7.0(39) tray change devAlias: drive-ide0-1-0 reason: 0 myDomainEventTrayChangeCallback: Domain 7.0(39) tray change devAlias: drive-ide0-1-0 reason: 1 # virsh events --all --loop event 'disk-change' for domain 7.0 disk drive-ide0-1-0: opened event 'disk-change' for domain 7.0 disk drive-ide0-1-0: closed That's a copy and paste error in virsh's handler for that event. Fixed by: commit 61139c4438bf9f72271c7df08aada844153ba61d Author: Ján Tomko <jtomko> CommitDate: 2015-05-28 14:14:47 +0200 Fix the event name in vshEventTrayChangePrint https://bugzilla.redhat.com/show_bug.cgi?id=1206114#c5 Reported by: zhenfeng wang <zhwang> git describe: v1.2.16-rc1-10-g61139c4 Thanks for Jan's response, since the comment5's issue is a seperate issue for this bug, so mark this verified and file a seprate bug track the comment5's issue. 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 |