• E
    event: server RPC protocol tweaks for domain lifecycle events · 03722957
    Eric Blake 提交于
    This patch adds some new RPC call numbers, but for ease of review,
    they sit idle until a later patch adds the client counterpart to
    drive the new RPCs.  Also for ease of review, I limited this patch
    to just the lifecycle event; although converting the remaining
    15 domain events will be quite mechanical.  On the server side,
    we have to have a function per RPC call, largely with duplicated
    bodies (the key difference being that we store in our callback
    opaque pointer whether events should be fired with old or new
    style); meanwhile, a single function can drive multiple RPC
    messages.  With a strategic choice of XDR struct layout, we can
    make the event generation code for both styles fairly compact.
    
    I debated about adding a tri-state witness variable per
    connection (values 'unknown', 'legacy', 'modern').  It would start
    as 'unknown', move to 'legacy' if any RPC call is made to a legacy
    event call, and move to 'modern' if the feature probe is made;
    then the event code could issue an error if the witness state is
    incorrect (a legacy RPC call while in 'modern', a modern RPC call
    while in 'unknown' or 'legacy', and a feature probe while in
    'legacy' or 'modern').  But while it might prevent odd behavior
    caused by protocol fuzzing, I don't see that it would prevent
    any security holes, so I considered it bloat.
    
    Note that sticking @acl markers on the new RPCs generates unused
    functions in access/viraccessapicheck.c, because there is no new
    API call that needs to use the new checks; however, having a
    consistent .x file is worth the dead code.
    
    * src/libvirt_internal.h (VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK):
    New feature.
    * src/remote/remote_protocol.x
    (REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY)
    (REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY)
    (REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE): New RPCs.
    * daemon/remote.c (daemonClientCallback): Add field.
    (remoteDispatchConnectDomainEventCallbackRegisterAny)
    (remoteDispatchConnectDomainEventCallbackDeregisterAny): New
    functions.
    (remoteDispatchConnectDomainEventRegisterAny)
    (remoteDispatchConnectDomainEventDeregisterAny): Mark legacy use.
    (remoteRelayDomainEventLifecycle): Change message based on legacy
    or new use.
    (remoteDispatchConnectSupportsFeature): Advertise new feature.
    * src/remote_protocol-structs: Regenerate.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    03722957
remote.c 188.6 KB