Re: [PATCH 1/5] storage: adding a skeleton for libvirt volume events.

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

 



On Sun, May 27, 2018 at 16:25:35 -0300, Julio Faracco wrote:
> This commit adds some basic structures to support events for volumes as
> libvirt does with pools, networks, domains, secrets, etc. This commit
> add only lifecycle event to be included at create and delete actions.
> 
> Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
> ---
>  include/libvirt/libvirt-storage.h |  86 ++++++++++++++++++++
>  src/libvirt-storage.c             | 125 ++++++++++++++++++++++++++++++
>  src/libvirt_public.syms           |   6 ++
>  3 files changed, 217 insertions(+)
> 
> diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
> index 413d9f6c4c..291742e5ef 100644
> --- a/include/libvirt/libvirt-storage.h
> +++ b/include/libvirt/libvirt-storage.h

[...]

> +/**
> + * virStorageVolEventLifecycleType:
> + *
> + * a virStorageVolEventLifecycleType is emitted during storage vol
> + * lifecycle events
> + */
> +typedef enum {
> +    VIR_STORAGE_VOL_EVENT_CREATED = 0,
> +    VIR_STORAGE_VOL_EVENT_DELETED = 1,

How do you plan to handle the case of a storage pool refresh for the
filesystem (directory?) pool. Currently if you refresh it libvirt
removes all volume metadata and re-detects everything. If a image file
was manually deleted from the directory it will vanish after the
refresh. This means that if you want to properly emit these you'll need
to add a diffing mechanism so that you can regenerate all the events.

> +
> +# ifdef VIR_ENUM_SENTINELS
> +    VIR_STORAGE_VOL_EVENT_LAST
> +# endif
> +} virStorageVolEventLifecycleType;
> +
> +/**
> + * virConnectStorageVolEventLifecycleCallback:
> + * @conn: connection object
> + * @vol: vol on which the event occurred
> + * @event: The specific virStorageVolEventLifeCycleType which occurred
> + * @detail: contains some details on the reason of the event.
> + * @opaque: application specified data
> + *
> + * This callback is called when a vol lifecycle action is performed, like start
> + * or stop.

There are no such actions for a volume.

> + *
> + * The callback signature to use when registering for an event of type
> + * VIR_STORAGE_VOL_EVENT_ID_LIFECYCLE with
> + * virConnectStorageVolEventRegisterAny()
> + */
> +typedef void (*virConnectStorageVolEventLifecycleCallback)(virConnectPtr conn,
> +                                                           virStorageVolPtr vol,
> +                                                           int event,
> +                                                           int detail,
> +                                                           void *opaque);
> +
>  #endif /* __VIR_LIBVIRT_STORAGE_H__ */

Attachment: signature.asc
Description: PGP signature

--
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]

  Powered by Linux