[libvirt] [PATCH v3 4/4] on_missing: Emit event on disk source dropping
Daniel P. Berrange
berrange at redhat.com
Thu Oct 20 09:18:59 UTC 2011
On Wed, Oct 19, 2011 at 04:42:59PM +0200, Michal Privoznik wrote:
> If a disk source gets dropped because it is not accessible,
> mgmt application might want to be informed about this. Therefore
> we need to emit an event. The event presented in this patch
> is however a bit superset of what written above. The reason is simple:
> an intention to be easily expanded, e.g. on 'user ejected disk
> in guest' events. Therefore, callback gets target string
> (which should be unique among a domain) and reason (an integer);
> It can't get alias, as some disk changes (esp. dropping source
> caused by on_missing feature) might happen on inactive domain
> where no disks aliases exists.
> ---
> daemon/remote.c | 37 ++++++++++++++
> examples/domain-events/events-c/event-test.c | 27 ++++++++++-
> examples/domain-events/events-python/event-test.py | 4 ++
> include/libvirt/libvirt.h.in | 28 +++++++++++
> python/libvirt-override-virConnect.py | 9 ++++
> python/libvirt-override.c | 51 ++++++++++++++++++++
> src/conf/domain_event.c | 50 +++++++++++++++++++
> src/conf/domain_event.h | 7 +++
> src/libvirt_private.syms | 2 +
> src/qemu/qemu_domain.c | 7 +++
> src/remote/remote_driver.c | 34 +++++++++++++
> src/remote/remote_protocol.x | 9 +++-
> src/remote_protocol-structs | 5 ++
> 13 files changed, 268 insertions(+), 2 deletions(-)
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 361881a..d6d928a 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2996,6 +2996,33 @@ typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
> void *opaque);
>
> /**
> + * virConnectDomainEventDiskEjectReason:
> + *
> + * The reason describing why this callback is called
> + */
> +typedef enum {
> + VIR_DOMAIN_DISK_EJECT_ON_MISSING = 0,
> +} virConnectDomainEventDiskEjectReason;
I'd name this:
VIR_DOMAIN_DISK_EJECT_MISSING_ON_START
> +
> +/**
> + * virConnectDomainEventDiskEjectCallback:
> + * @conn: connection object
> + * @dom: domain on which the event occurred
> + * @target: target which changed status
In the I/O error event, we use 'srcPath' and 'devAlias' in the event
name. I think we probably ought todo the same here. So the app gets
details of which file was missing, and the unique alias of the device.
> + * @reason: reason why this callback was called; any of
> + * virConnectDomainEventDiskEjectReason
> + * @opaque: application specified data
> + *
> + * The callback signature to use when registering for an event of type
> + * VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny()
> + */
> +typedef void (*virConnectDomainEventDiskEjectCallback)(virConnectPtr conn,
> + virDomainPtr dom,
> + const char *target,
> + int reason,
> + void *opaque);
> +
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