[libvirt] [PATCH] events: Don't fail on registering events for two different domains
Eric Blake
eblake at redhat.com
Wed Jun 27 14:26:13 UTC 2012
On 06/27/2012 08:22 AM, Michal Privoznik wrote:
> On 27.06.2012 14:12, Michal Privoznik wrote:
>> 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.
>> ---
>> src/conf/domain_event.c | 6 +++++-
>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
>> index 4ecc413..3cfd940 100644
>> --- a/src/conf/domain_event.c
>> +++ b/src/conf/domain_event.c
>> @@ -363,7 +363,11 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
>> for (i = 0 ; i < cbList->count ; i++) {
>> if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
>> cbList->callbacks[i]->eventID == eventID &&
>> - cbList->callbacks[i]->conn == conn) {
>> + cbList->callbacks[i]->conn == conn &&
>> + ((dom && cbList->callbacks[i]->dom &&
>> + memcmp(cbList->callbacks[i]->dom->uuid,
>> + dom->uuid, VIR_UUID_BUFLEN) == 0) ||
>> + (!dom && !cbList->callbacks[i]->dom))) {
>> eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> _("event callback already tracked"));
>> return -1;
>>
>
> So after all - ACK or NACK?
ACK - I think we agreed that current behavior of allowing both global
and per-domain simultaneous registration is fine, and this preserves
that ability.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120627/726f7544/attachment-0001.sig>
More information about the libvir-list
mailing list