[libvirt] [PATCH 4/5] Introduce new VIR_DOMAIN_EVENT_DEFINED_RENAMED event
Daniel P. Berrange
berrange at redhat.com
Wed Aug 5 12:14:09 UTC 2015
On Wed, Aug 05, 2015 at 01:59:10PM +0200, Tomas Meszaros wrote:
> This should be emitted whenever a domain is renamed.
>
> Signed-off-by: Tomas Meszaros <exo at tty.sk>
> ---
> examples/object-events/event-test.c | 2 ++
> include/libvirt/libvirt-domain.h | 1 +
> tools/virsh-domain.c | 3 ++-
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
> index 4f17273..c62bd56 100644
> --- a/examples/object-events/event-test.c
> +++ b/examples/object-events/event-test.c
> @@ -108,6 +108,8 @@ static const char *eventDetailToString(int event, int detail) {
> ret = "Added";
> else if (detail == VIR_DOMAIN_EVENT_DEFINED_UPDATED)
> ret = "Updated";
> + else if (detail == VIR_DOMAIN_EVENT_DEFINED_RENAMED)
> + ret = "Renamed";
> break;
> case VIR_DOMAIN_EVENT_UNDEFINED:
> if (detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
> diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> index 2ddc47d..d43ec27 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -2322,6 +2322,7 @@ typedef enum {
> typedef enum {
> VIR_DOMAIN_EVENT_DEFINED_ADDED = 0, /* Newly created config file */
> VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1, /* Changed config file */
> + VIR_DOMAIN_EVENT_DEFINED_RENAMED = 2, /* Domain was renamed */
>
> # ifdef VIR_ENUM_SENTINELS
> VIR_DOMAIN_EVENT_DEFINED_LAST
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index c7e218f..7291980 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -11763,7 +11763,8 @@ VIR_ENUM_DECL(vshDomainEventDefined)
> VIR_ENUM_IMPL(vshDomainEventDefined,
> VIR_DOMAIN_EVENT_DEFINED_LAST,
> N_("Added"),
> - N_("Updated"))
> + N_("Updated"),
> + N_("Renamed"))
If we're going to emit a defined + renamed event for the new name,
we should probably also emit an undefined + renamed event for the
old one. That should ensure existing apps continue to work right
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list