Red Hat Bugzilla – Bug 834927
virConnectDomainEventRegisterAny won't register the same callback for the same event but for different domains
Last modified: 2015-11-01 20:36:39 EST
Description of problem: virConnectDomainEventRegisterAny() will return "libvir: Remote error : adding cb to list " when you attempt to register the same callback for already registered event but for a different domain. Version-Release number of selected component (if applicable): 0.9.12 How reproducible: always Steps to Reproduce: ... virDomainPtr dom1 = virDomainLookupByName(conn, "domain1"); virDomainPtr dom1 = virDomainLookupByName(conn, "domain2"); virConnectDomainEventRegisterAny(conn, dom1, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK (myCallback), someDataPtr, NULL); virConnectDomainEventRegisterAny(conn, dom2, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK (myCallback), someOtherDataPtr, NULL); Actual results: First call works as expected, second throws error "libvir: Remote error : adding cb to list" and the callback is not registered for domain2. Expected results: Both calls should work and register the callback correctly. Additional info: Problem seems to be in virDomainEventCallbackListAddID() where the first for() cycle does not take domain into account. Therefor it works perfectly for domain being NULL, but not for specific domains.
Created attachment 594710 [details] reproducer compile with: gcc repro.c -o repro -lvirt
Even though this is reported against upstream, RHEL is affected as well. Therefore I am changing product and setting 6.4? flag.
Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2012-June/msg01230.html
Okay, moving to POST: commit cd15303fd123146b0ba53e387d08ef22b707223c Author: Michal Privoznik <mprivozn@redhat.com> AuthorDate: Wed Jun 27 12:06:45 2012 +0200 Commit: Michal Privoznik <mprivozn@redhat.com> CommitDate: Wed Jun 27 16:20:41 2012 +0200 events: Don't fail on registering events for two different domains virConnectDomainEventRegisterAny() takes a domain as an argument. So it should be possible to register the same event (be it VIR_DOMAIN_EVENT_ID_LIFECYCLE for example) for two different domains. That is, we need to take domain into account when searching for duplicate event being already registered. v0.9.13-rc1-18-gcd15303
With libvirt-0.9.13-3.el6.x86_64, run the reproducer in comment 1, and this bug can be verified. I try to start/suspend/resume/destroy/save/restore for both tow guest, and no such error throw out like the bug described. The outputs: myDomainEventCallback2 EVENT: Domain rhel6(2) Started Booted myDomainEventCallback2 EVENT: Domain rhel6-2(1) Suspended Paused myDomainEventCallback2 EVENT: Domain rhel6(2) Suspended Paused myDomainEventCallback2 EVENT: Domain rhel6(2) Resumed Unpaused myDomainEventCallback2 EVENT: Domain rhel6-2(1) Resumed Unpaused myDomainEventCallback2 EVENT: Domain rhel6(-1) Stopped Destroyed myDomainEventCallback2 EVENT: Domain rhel6-2(-1) Stopped Destroyed myDomainEventCallback2 EVENT: Domain rhel6(3) Started Booted myDomainEventCallback2 EVENT: Domain rhel6-2(4) Started Booted myDomainEventCallback2 EVENT: Domain rhel6-2(-1) Stopped Failed myDomainEventCallback2 EVENT: Domain rhel6(-1) Stopped Failed myDomainEventCallback2 EVENT: Domain rhel6(5) Started Restored myDomainEventCallback2 EVENT: Domain rhel6-2(6) Started Restored
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. http://rhn.redhat.com/errata/RHSA-2013-0276.html