8d9d098 event: wire up RPC for server-side network event filtering

Authored and Committed by ericb 10 years ago
    event: wire up RPC for server-side network event filtering
    
    We haven't had a release with network events yet, so we are free
    to fix the RPC so that it actually does what we want.  Doing
    client-side filtering of per-network events is inefficient if a
    connection is only interested in events on a single network out
    of hundreds available on the server.  But to do server-side
    per-network filtering, the server needs to know which network
    to filter on - so we need to pass an optional network over on
    registration.  Furthermore, it is possible to have a client with
    both a global and per-network filter; in the existing code, the
    server sends only one event and the client replicates to both
    callbacks.  But with server-side filtering, the server will send
    the event twice, so we need a way for the client to know which
    callbackID is sending an event, to ensure that the client can
    filter out events from a registration that does not match the
    callbackID from the server.  Likewise, the existing style of
    deregistering by eventID alone is fine; but in the new style,
    we have to remember which callbackID to delete.
    
    This patch fixes the RPC wire definition to contain all the
    needed pieces of information, and hooks into the server and
    client side improvements of the previous patches, in order to
    switch over to full server-side filtering of network events.
    Also, since we fixed this in time, all released versions of
    libvirtd that support network events also support per-network
    filtering, so we can hard-code that assumption into
    network_event.c.
    
    Converting domain events to server-side filtering will require
    the introduction of new RPC numbers, as well as a server
    feature bit that the client can use to tell whether to use
    old-style (server only supports global events) or new-style
    (server supports filtered events), so that is deferred to a
    later set of patches.
    
    * src/conf/network_event.c (virNetworkEventStateRegisterClient):
    Assume server-side filtering.
    * src/remote/remote_protocol.x
    (remote_connect_network_event_register_any_args): Add network
    argument.
    (remote_connect_network_event_register_any_ret): Return callbackID
    instead of count.
    (remote_connect_network_event_deregister_any_args): Pass
    callbackID instead of eventID.
    (remote_connect_network_event_deregister_any_ret): Drop unused
    type.
    (remote_network_event_lifecycle_msg): Add callbackID.
    * daemon/remote.c
    (remoteDispatchConnectNetworkEventDeregisterAny): Drop unused arg,
    and deal with callbackID from client.
    (remoteRelayNetworkEventLifecycle): Pass callbackID.
    (remoteDispatchConnectNetworkEventRegisterAny): Likewise, and
    recognize non-NULL network.
    * src/remote/remote_driver.c
    (remoteConnectNetworkEventRegisterAny): Pass network, and track
    server side id.
    (remoteConnectNetworkEventDeregisterAny): Deregister by callback id.
    (remoteNetworkBuildEventLifecycle): Pass remote id to event queue.
    * src/remote_protocol-structs: Regenerate.
    
    Signed-off-by: Eric Blake <eblake@redhat.com>
    
        
file modified
+17 -17
file modified
+1 -3
file modified
+14 -3
file modified
+5 -7
file modified
+4 -5