On Thu, Oct 20, 2011 at 04:52:52PM +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 source string and disk alias
(which should be unique among a domain) and reason (an integer);
diff --git a/include/libvirt/libvirt.h.in
b/include/libvirt/libvirt.h.in
index 361881a..66b718c 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2996,6 +2996,34 @@ typedef void
(*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
void *opaque);
/**
+ * virConnectDomainEventDiskEjectReason:
+ *
+ * The reason describing why this callback is called
+ */
+typedef enum {
+ VIR_DOMAIN_DISK_EJECT_MISSING_ON_START = 0,
+} virConnectDomainEventDiskEjectReason;
+
+/**
+ * virConnectDomainEventDiskEjectCallback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @target: target which changed status
+ * @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 *srcPath,
+ const char *devAlias,
+ int reason,
+ void *opaque);
It suddenly occurs to me that this event will also be relevant if we
insert new media. So instead of 'srcPath', we should have 'oldSrcPath'
and 'newSrcPath', either one of which may be NULL depending on the
scenarios involved.
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 :|