[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] virDomainEventCallbackListAddID: allow different domains to register lifecycle events



Hello,

I had trouble of registering an VIR_DOMAIN_EVENT_ID_LIFECYLCE event for
different domains separately.

First I invoke [0] with one domain, and later with another one. For the
second call the operation will be denied by
"libvir: error : internal error event callback already tracked".

I assume this should be possible for different domains to register
LIFECYLCE handler separately. In that case please consider the attached
patch.

Thanks,

Alex B.


[0]
virConnectDomainEventRegisterAny(
 conn, domX, VIR_DOM_EVENT_ID_LIFECYLCE,
 VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback2),
 strdup("callback 2"), myFreeFunc);
--- libvirt-0.9.2/src/conf/domain_event.c	2011-06-06 02:15:12.000000000 +0200
+++ libvirt-0.9.2-own/src/conf/domain_event.c	2011-06-29 14:01:15.000000000 +0200
@@ -362,6 +362,7 @@
     for (i = 0 ; i < cbList->count ; i++) {
         if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
             cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
+            (!cbList->callbacks[i]->dom || !dom || memcmp(dom->uuid, cbList->callbacks[i]->dom->uuid, VIR_UUID_BUFLEN) == 0) &&
             cbList->callbacks[i]->conn == conn) {
             eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                              _("event callback already tracked"));

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]