On 01/15/2014 04:23 PM, Eric Blake wrote:
We want to convert over to server-side events, even for older
APIs. To do that, the client side of the remote driver wants
to distinguish between legacy virConnectDomainEventRegister and
normal virConnectDomainEventRegisterAny, while knowing the
client callbackID and the server's serverID for both types of
registration. The client also needs to probe whether the
server supports server-side filtering. However, for ease of
review, we don't actually use the new RPCs until a later patch.
* src/conf/object_event_private.h (virObjectEventStateCallbackID):
Add parameter.
* src/conf/object_event.c (virObjectEventCallbackListAddID)
(virObjectEventStateRegisterID): Separate legacy from callbackID.
(virObjectEventStateCallbackID): Pass through parameter.
* src/conf/network_event.c (virNetworkEventStateRegisterID):
Update caller.
* src/conf/domain_event.c (virDomainEventStateRegister)
(virDomainEventStateRegisterID, virDomainEventStateDeregister):
Likewise.
(virDomainEventStateRegisterClient)
(virDomainEventStateCallbackID): Implement new functions.
* src/conf/domain_event.h (virDomainEventStateRegisterClient)
(virDomainEventStateCallbackID): New prototypes.
* src/remote/remote_driver.c (private_data): Add field.
(doRemoteOpen): Probe server feature.
(remoteConnectDomainEventRegister)
(remoteConnectDomainEventRegisterAny): Use new function.
Based on my additional testing, I need to squash this in for global
domain lifecycle events (lookup of a remoteID should match the same
conditions as virObjectEventCallbackListCount, which ignores legacy).
Thankfully, no impact to 1.2.1 (network events are never marked legacy).
diff --git i/src/conf/object_event.c w/src/conf/object_event.c
index c5770bf..de45257 100644
--- i/src/conf/object_event.c
+++ w/src/conf/object_event.c
@@ -334,13 +334,13 @@ virObjectEventCallbackLookup(virConnectPtr conn,
if (cb->klass == klass &&
cb->eventID == eventID &&
cb->conn == conn &&
- cb->legacy == legacy &&
((uuid && cb->uuid_filter &&
memcmp(cb->uuid, uuid, VIR_UUID_BUFLEN) == 0) ||
(!uuid && !cb->uuid_filter))) {
if (remoteID)
*remoteID = cb->remoteID;
- if (cb->cb == callback)
+ if (cb->legacy == legacy &&
+ cb->cb == callback)
return cb->callbackID;
}
}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org