[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 09/11] event: Add guest agent lifecycle event



On 11/19/2014 03:23 AM, Peter Krempa wrote:
> As qemu is now able to notify us about change of the channel state used
> for communication with the guest agent we now can more precisely track
> the state of the guest agent.
> 
> To allow notifying management apps this patch implements a new event
> that will be triggered on changes of the guest agent state.
> ---

Actually, after seeing patch 11, I think this event is too narrow.  You
are only reporting if the guest agent on org.qemu.guest_agent.0 changes
state.  But a user can provide more than one channel, and the
VSERPORT_CHANGE event works for every channel.  I think we need to
broaden the definition of the event to allow the event on EVERY virtio
channel, and include the name of _which_ channel had the event, so that
someone using any other channel can also tell if their custom code in
the guest is properly connecting to that channel.


> +/**
> + * virConnectDomainEventAgentLifecycleCallback:
> + * @conn: connection object
> + * @dom: domain on which the event occurred
> + * @state: new state of the guest agent, one of virConnectDomainEventAgentLifecycleState
> + * @reason: reason for state change; currently only 0 is passed denoting change
> + *          in the guest agent socket state
> + * @opaque: application specified data
> + *
> + * This callback occurs when libvirt detects a change in the state of a guest
> + * agent.
> + *
> + * The callback signature to use when registering for an event of type
> + * VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE with virConnectDomainEventRegisterAny()
> + */
> +typedef void (*virConnectDomainEventAgentLifecycleCallback)(virConnectPtr conn,
> +                                                            virDomainPtr dom,
> +                                                            int state,
> +                                                            int reason,
> +                                                            void *opaque);

Thus, I think this signature needs an additional const char *channel
name, which provides the name of which agent channel is changing.

> +++ b/src/remote/remote_protocol.x
> @@ -3108,6 +3108,14 @@ struct remote_connect_get_all_domain_stats_args {
>      unsigned int flags;
>  };
> 
> +struct remote_domain_event_callback_agent_lifecycle_msg {
> +    int callbackID;
> +    remote_nonnull_domain dom;
> +
> +    int state;
> +    int reason;
> +};

Similarly, you'll need a remote_nonnull_string as the channel name as
part of this RPC call.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]