[libvirt] [PATCH v2 6/6] event-test: support storage lifecycle event APIs

Peter Krempa pkrempa at redhat.com
Tue Jun 14 06:05:17 UTC 2016


On Mon, Jun 13, 2016 at 18:38:43 +0200, Jovanka Gulicoska wrote:
> ---
>  examples/object-events/event-test.c | 46 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 45 insertions(+), 1 deletion(-)

[...]

> @@ -899,6 +933,7 @@ main(int argc, char **argv)
>      virConnectPtr dconn = NULL;
>      int callback1ret = -1;
>      int callback16ret = -1;
> +    int callback17ret = -1;
>      struct sigaction action_stop;
>      size_t i;
>  
> @@ -966,8 +1001,16 @@ main(int argc, char **argv)
>                                                        VIR_NETWORK_EVENT_CALLBACK(myNetworkEventCallback),
>                                                        strdup("net callback"), myFreeFunc);
>  
> +    callback17ret = virConnectStoragePoolEventRegisterAny(dconn,

If you follow the approach used by domain events rather than network
events the new code will automatically trigger a build failure when you
add new events and also will make addition of new storage pool callback
types much easier.

> +                                                          NULL,
> +                                                          VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
> +                                                          VIR_STORAGE_POOL_EVENT_CALLBACK(myStoragePoolEventCallback),
> +                                                          strdup("storage pool callback"), myFreeFunc);
> +
> +
>      if ((callback1ret == -1) ||
> -        (callback16ret == -1))
> +        (callback16ret == -1) ||
> +        (callback17ret == -1))
>          goto cleanup;
>  
>      if (virConnectSetKeepAlive(dconn, 5, 3) < 0) {




More information about the libvir-list mailing list