Each unique event ID will thus be composed by 1 byte for the namespace and 1 byte for a namespace-specific ID. The namespace for domain event needs to be 0 for compatibility reasons. --- src/conf/domain_event.c | 10 ++++++++-- src/conf/domain_event.h | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 3c14cec..8462754 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -1910,11 +1910,17 @@ virObjectEventStateDispatchFunc(virConnectPtr conn, void *opaque) { virObjectEventStatePtr state = opaque; + virEventNamespaceID namespace = (event->eventID & 0xFF00) >> 8; /* Drop the lock whle dispatching, for sake of re-entrancy */ virObjectEventStateUnlock(state); - virDomainEventDispatchDefaultFunc(conn, event, - VIR_DOMAIN_EVENT_CALLBACK(cb), cbopaque, NULL); + switch (namespace) + { + case VIR_EVENT_NAMESPACE_DOMAIN: + virDomainEventDispatchDefaultFunc(conn, event, + VIR_DOMAIN_EVENT_CALLBACK(cb), cbopaque, NULL); + break; + } virObjectEventStateLock(state); } diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index 647b7e4..ec1b3d6 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -28,6 +28,14 @@ # include "domain_conf.h" + +/** Event IDs are computed in the following way: + virEventNamespaceID << 8 + vir*EventId + */ +typedef enum { + VIR_EVENT_NAMESPACE_DOMAIN = 0, /* 0 to keep value of virDomainEventId unchanged */ +} virEventNamespaceID; + typedef struct _virObjectEventCallback virObjectEventCallback; typedef virObjectEventCallback *virObjectEventCallbackPtr; -- 1.8.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list