Re: [PATCH v2 5/6] storage: implement storage lifecycle event APIs

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

 



On Mon, Jun 13, 2016 at 18:38:42 +0200, Jovanka Gulicoska wrote:
> Implement storage pool event callbacks for START, STOP, DEFINE, UNDEFINED
> and REFRESHED in functions when a storage pool is created/started/stopped
> etc. accordingly
> ---
>  src/storage/storage_driver.c | 110 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 110 insertions(+)
> 
> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
> index fb1b1a2..d336bd6 100644
> --- a/src/storage/storage_driver.c
> +++ b/src/storage/storage_driver.c
> @@ -41,6 +41,7 @@
>  #include "driver.h"
>  #include "storage_driver.h"
>  #include "storage_conf.h"
> +#include "storage_event.h"
>  #include "viralloc.h"
>  #include "storage_backend.h"
>  #include "virlog.h"
> @@ -276,6 +277,8 @@ storageStateInitialize(bool privileged,
>  
>      storagePoolUpdateAllState();
>  
> +    driver->storageEventState = virObjectEventStateNew();

So. This patch needs to add 'storageEventState' rather than 2/6.

> +
>      storageDriverUnlock();
>  
>      ret = 0;

[...]

> @@ -2662,6 +2728,48 @@ storageConnectListAllStoragePools(virConnectPtr conn,
>      return ret;
>  }
>  
> +static int
> +storageConnectStoragePoolEventRegisterAny(virConnectPtr conn,
> +                                          virStoragePoolPtr pool,
> +                                          int eventID,
> +                                          virConnectStoragePoolEventGenericCallback callback,
> +                                          void *opaque,
> +                                          virFreeCallback freecb)
> +{
> +    int ret = -1;

I'd call this 'callbackID' since. Otherwise the usage is a bit
confusing.

> +
> +    if (virConnectStoragePoolEventRegisterAnyEnsureACL(conn) < 0)
> +        goto cleanup;
> +
> +    if (virStoragePoolEventStateRegisterID(conn, driver->storageEventState,
> +                                           pool, eventID, callback,
> +                                           opaque, freecb, &ret) < 0)
> +        ret = -1;
> + cleanup:
> +    return ret;
> +}
>+

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]