startupPolicy: Emit event on disk source dropping

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);
This commit is contained in:
Michal Privoznik
2011-10-25 09:27:10 +02:00
parent 12ba43222d
commit baf2ff7e90
14 changed files with 337 additions and 9 deletions
+36
View File
@@ -2995,6 +2995,41 @@ typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
int status,
void *opaque);
/**
* virConnectDomainEventDisChangeReason:
*
* The reason describing why this callback is called
*/
typedef enum {
VIR_DOMAIN_DISK_CHANGE_MISSING_ON_START = 0, /* oldSrcPath is set */
} virConnectDomainEventDiskChangeReason;
/**
* virConnectDomainEventDiskChangeCallback:
* @conn: connection object
* @dom: domain on which the event occurred
* @oldSrcPath: old source path
* @newSrcPath: new source path
* @reason: reason why this callback was called; any of
* virConnectDomainEventDiskChangeReason
* @opaque: application specified data
*
* This callback occurs when disk gets changed. However,
* not all @reason will cause both @oldSrcPath and @newSrcPath
* to be non-NULL. Please see virConnectDomainEventDiskChangeReason
* for more details.
*
* The callback signature to use when registering for an event of type
* VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny()
*/
typedef void (*virConnectDomainEventDiskChangeCallback)(virConnectPtr conn,
virDomainPtr dom,
const char *oldSrcPath,
const char *newSrcPath,
const char *devAlias,
int reason,
void *opaque);
/**
* VIR_DOMAIN_EVENT_CALLBACK:
*
@@ -3014,6 +3049,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON = 6, /* virConnectDomainEventIOErrorReasonCallback */
VIR_DOMAIN_EVENT_ID_CONTROL_ERROR = 7, /* virConnectDomainEventGenericCallback */
VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8, /* virConnectDomainEventBlockJobCallback */
VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9, /* virConnectDomainEventDiskChangeCallback */
/*
* NB: this enum value will increase over time as new events are