[libvirt] [PATCH v2 5/6] storage: implement storage lifecycle event APIs
Peter Krempa
pkrempa at redhat.com
Tue Jun 14 05:58:33 UTC 2016
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;
> +}
>+
More information about the libvir-list
mailing list