Add domain events detail information

This commit is contained in:
Daniel P. Berrange 2008-11-17 16:43:00 +00:00
parent 89156f1985
commit d3d54d2fc9
19 changed files with 578 additions and 116 deletions

View File

@ -1,3 +1,26 @@
Mon Nov 17 16:42:00 GMT 2008 Daniel Berrange <berrange@redhat.com>
Include an event 'detail' field providing the cause of
each emitted domain event.
* docs/ Re-generate API refernece
* examples/domain-events/events-c/event-test.c: Print out
event detail info
* include/libvirt/libvirt.h.in: Rename ADDED/REMOVED events
to DEFINED/UNDEFINED. Remove SAVED/RESTORED events replaced
by event detail info. Add enums providing details for each
domain event type.
* python/libvir.c: Pass through event detail to python layer
* qemud/remote_protocol.x: Add event detail field for domain
events.
* qemud/remote_protocol.c, qemud/remote_protocol.h: Regenerate
* qemud/remote.c: Pass event detail value onto the wire
* src/domain_event.h, src/domain_event.c: Store event detail
* src/remote_internal.c: De-serialize event detail off the
wire
* src/qemu_driver.c: Generate event detail information, and
fix migration API to honour VIR_MIGRATE_LIVE flag, pausing
the VM if it isn't set
Mon Nov 17 11:57:00 GMT 2008 Daniel Berrange <berrange@redhat.com>
Push stateful driver code into daemon binary

View File

@ -53,9 +53,10 @@ typedef struct _virDomainBlockStats <a href="#virDomainBlockStatsStruct">virDoma
typedef enum <a href="#virDomainMigrateFlags">virDomainMigrateFlags</a>;
typedef struct _virNodeInfo <a href="#virNodeInfo">virNodeInfo</a>;
typedef struct _virNetwork <a href="#virNetwork">virNetwork</a>;
typedef enum <a href="#virDomainEventResumedDetailType">virDomainEventResumedDetailType</a>;
typedef <a href="libvirt-libvirt.html#virDomainBlockStatsStruct">virDomainBlockStatsStruct</a> * <a href="#virDomainBlockStatsPtr">virDomainBlockStatsPtr</a>;
typedef struct _virConnect <a href="#virConnect">virConnect</a>;
typedef struct _virVcpuInfo <a href="#virVcpuInfo">virVcpuInfo</a>;
typedef enum <a href="#virDomainEventStartedDetailType">virDomainEventStartedDetailType</a>;
typedef struct _virDomainInfo <a href="#virDomainInfo">virDomainInfo</a>;
typedef enum <a href="#virStoragePoolDeleteFlags">virStoragePoolDeleteFlags</a>;
typedef enum <a href="#virEventHandleType">virEventHandleType</a>;
@ -79,17 +80,22 @@ typedef struct _virStorageVol <a href="#virStorageVol">virStorageVol</a>;
typedef <a href="libvirt-libvirt.html#virStorageVolInfo">virStorageVolInfo</a> * <a href="#virStorageVolInfoPtr">virStorageVolInfoPtr</a>;
typedef struct _virSchedParameter <a href="#virSchedParameter">virSchedParameter</a>;
typedef enum <a href="#virConnectFlags">virConnectFlags</a>;
typedef enum <a href="#virDomainEventDefinedDetailType">virDomainEventDefinedDetailType</a>;
typedef enum <a href="#virDomainMemoryFlags">virDomainMemoryFlags</a>;
typedef enum <a href="#virDomainEventStoppedDetailType">virDomainEventStoppedDetailType</a>;
typedef <a href="libvirt-libvirt.html#virStorageVol">virStorageVol</a> * <a href="#virStorageVolPtr">virStorageVolPtr</a>;
typedef enum <a href="#virVcpuState">virVcpuState</a>;
typedef enum <a href="#virStorageVolDeleteFlags">virStorageVolDeleteFlags</a>;
typedef struct _virVcpuInfo <a href="#virVcpuInfo">virVcpuInfo</a>;
typedef <a href="libvirt-libvirt.html#virSchedParameter">virSchedParameter</a> * <a href="#virSchedParameterPtr">virSchedParameterPtr</a>;
typedef struct _virConnectAuth <a href="#virConnectAuth">virConnectAuth</a>;
typedef struct _virConnectCredential <a href="#virConnectCredential">virConnectCredential</a>;
typedef enum <a href="#virDomainEventSuspendedDetailType">virDomainEventSuspendedDetailType</a>;
typedef <a href="libvirt-libvirt.html#virVcpuInfo">virVcpuInfo</a> * <a href="#virVcpuInfoPtr">virVcpuInfoPtr</a>;
typedef enum <a href="#virStoragePoolBuildFlags">virStoragePoolBuildFlags</a>;
typedef enum <a href="#virDomainXMLFlags">virDomainXMLFlags</a>;
typedef enum <a href="#virStorageVolType">virStorageVolType</a>;
typedef enum <a href="#virDomainEventUndefinedDetailType">virDomainEventUndefinedDetailType</a>;
typedef <a href="libvirt-libvirt.html#virDomain">virDomain</a> * <a href="#virDomainPtr">virDomainPtr</a>;
typedef enum <a href="#virConnectCredentialType">virConnectCredentialType</a>;
typedef enum <a href="#virStoragePoolState">virStoragePoolState</a>;
@ -175,7 +181,7 @@ int <a href="#virDomainPinVcpu">virDomainPinVcpu</a> (<a href="libvirt-libvirt.
int <a href="#virDomainRestore">virDomainRestore</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * from);
char * <a href="#virStorageVolGetPath">virStorageVolGetPath</a> (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol);
<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> <a href="#virNetworkLookupByUUIDString">virNetworkLookupByUUIDString</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * uuidstr);
typedef int <a href="#virConnectDomainEventCallback">virConnectDomainEventCallback</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> int event, <br/> void * opaque);
typedef int <a href="#virConnectDomainEventCallback">virConnectDomainEventCallback</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> int event, <br/> int detail, <br/> void * opaque);
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> <a href="#virDomainLookupByID">virDomainLookupByID</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int id);
int <a href="#virStorageVolDelete">virStorageVolDelete</a> (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br/> unsigned int flags);
int <a href="#virStorageVolFree">virStorageVolFree</a> (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol);
@ -367,17 +373,61 @@ The content of this structure is not made public by the API.
<a name="VIR_DOMAIN_NONE">VIR_DOMAIN_NONE</a> = 0
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventDefinedDetailType">Enum </a>virDomainEventDefinedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventDefinedDetailType">virDomainEventDefinedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_DEFINED_ADDED">VIR_DOMAIN_EVENT_DEFINED_ADDED</a> = 0 /* Newly created config file */
<a name="VIR_DOMAIN_EVENT_DEFINED_UPDATED">VIR_DOMAIN_EVENT_DEFINED_UPDATED</a> = 1 /* Changed config file */
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventResumedDetailType">Enum </a>virDomainEventResumedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventResumedDetailType">virDomainEventResumedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_RESUMED_UNPAUSED">VIR_DOMAIN_EVENT_RESUMED_UNPAUSED</a> = 0 /* Normal resume due to admin unpause */
<a name="VIR_DOMAIN_EVENT_RESUMED_MIGRATED">VIR_DOMAIN_EVENT_RESUMED_MIGRATED</a> = 1 /* Resumed for completion of migration */
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventStartedDetailType">Enum </a>virDomainEventStartedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventStartedDetailType">virDomainEventStartedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_STARTED_BOOTED">VIR_DOMAIN_EVENT_STARTED_BOOTED</a> = 0 /* Normal startup from boot */
<a name="VIR_DOMAIN_EVENT_STARTED_MIGRATED">VIR_DOMAIN_EVENT_STARTED_MIGRATED</a> = 1 /* Incoming migration from another host */
<a name="VIR_DOMAIN_EVENT_STARTED_RESTORED">VIR_DOMAIN_EVENT_STARTED_RESTORED</a> = 2 /* Restored from a state file */
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventStoppedDetailType">Enum </a>virDomainEventStoppedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventStoppedDetailType">virDomainEventStoppedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN">VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN</a> = 0 /* Normal shutdown */
<a name="VIR_DOMAIN_EVENT_STOPPED_DESTROYED">VIR_DOMAIN_EVENT_STOPPED_DESTROYED</a> = 1 /* Forced poweroff from host */
<a name="VIR_DOMAIN_EVENT_STOPPED_CRASHED">VIR_DOMAIN_EVENT_STOPPED_CRASHED</a> = 2 /* Guest crashed */
<a name="VIR_DOMAIN_EVENT_STOPPED_MIGRATED">VIR_DOMAIN_EVENT_STOPPED_MIGRATED</a> = 3 /* Migrated off to another host */
<a name="VIR_DOMAIN_EVENT_STOPPED_SAVED">VIR_DOMAIN_EVENT_STOPPED_SAVED</a> = 4 /* Saved to a state file */
<a name="VIR_DOMAIN_EVENT_STOPPED_FAILED">VIR_DOMAIN_EVENT_STOPPED_FAILED</a> = 5 /* Host emulator/mgmt failed */
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventSuspendedDetailType">Enum </a>virDomainEventSuspendedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventSuspendedDetailType">virDomainEventSuspendedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_SUSPENDED_PAUSED">VIR_DOMAIN_EVENT_SUSPENDED_PAUSED</a> = 0 /* Normal suspend due to admin pause */
<a name="VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED">VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED</a> = 1 /* Suspended for offline migration */
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventType">Enum </a>virDomainEventType</h3><pre class="programlisting">enum <a href="#virDomainEventType">virDomainEventType</a> {
<a name="VIR_DOMAIN_EVENT_ADDED">VIR_DOMAIN_EVENT_ADDED</a> = 0
<a name="VIR_DOMAIN_EVENT_REMOVED">VIR_DOMAIN_EVENT_REMOVED</a> = 1
<a name="VIR_DOMAIN_EVENT_DEFINED">VIR_DOMAIN_EVENT_DEFINED</a> = 0
<a name="VIR_DOMAIN_EVENT_UNDEFINED">VIR_DOMAIN_EVENT_UNDEFINED</a> = 1
<a name="VIR_DOMAIN_EVENT_STARTED">VIR_DOMAIN_EVENT_STARTED</a> = 2
<a name="VIR_DOMAIN_EVENT_SUSPENDED">VIR_DOMAIN_EVENT_SUSPENDED</a> = 3
<a name="VIR_DOMAIN_EVENT_RESUMED">VIR_DOMAIN_EVENT_RESUMED</a> = 4
<a name="VIR_DOMAIN_EVENT_STOPPED">VIR_DOMAIN_EVENT_STOPPED</a> = 5
<a name="VIR_DOMAIN_EVENT_SAVED">VIR_DOMAIN_EVENT_SAVED</a> = 6
<a name="VIR_DOMAIN_EVENT_RESTORED">VIR_DOMAIN_EVENT_RESTORED</a> = 7
};
</pre><p/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainEventUndefinedDetailType">Enum </a>virDomainEventUndefinedDetailType</h3><pre class="programlisting">enum <a href="#virDomainEventUndefinedDetailType">virDomainEventUndefinedDetailType</a> {
<a name="VIR_DOMAIN_EVENT_UNDEFINED_REMOVED">VIR_DOMAIN_EVENT_UNDEFINED_REMOVED</a> = 0 /* Deleted the config file */
};
</pre><p/>
</div>
@ -614,9 +664,9 @@ The content of this structure is not made public by the API.
</pre><p/>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>cred</tt></i>:</span></td><td/></tr><tr><td><span class="term"><i><tt>ncred</tt></i>:</span></td><td/></tr><tr><td><span class="term"><i><tt>cbdata</tt></i>:</span></td><td/></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td/></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virConnectDomainEventCallback"/>Function type virConnectDomainEventCallback</h3><pre class="programlisting">int virConnectDomainEventCallback (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> int event, <br/> void * opaque)<br/>
<div class="refsect2" lang="en"><h3><a name="virConnectDomainEventCallback"/>Function type virConnectDomainEventCallback</h3><pre class="programlisting">int virConnectDomainEventCallback (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> int event, <br/> int detail, <br/> void * opaque)<br/>
</pre><p>A callback function to be registered, and called when a domain event occurs</p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occured</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>The specfic <a href="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occured</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td/></tr></tbody></table></div></div>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occured</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>The specfic <a href="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occured</td></tr><tr><td><span class="term"><i><tt>detail</tt></i>:</span></td><td>event specific detail information</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td/></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virEventAddHandleFunc"/>Function type virEventAddHandleFunc</h3><pre class="programlisting">int virEventAddHandleFunc (int fd, <br/> int event, <br/> <a href="libvirt-libvirt.html#virEventHandleCallback">virEventHandleCallback</a> cb, <br/> void * opaque)<br/>
</pre><p>Part of the EventImpl, this callback Adds a file handle callback to listen for specific events</p>

View File

@ -26,7 +26,13 @@ typedef struct _virDomain <a href="#virDomain">virDomain</a>
typedef <a href="libvirt-libvirt.html#virDomainBlockStatsStruct">virDomainBlockStatsStruct</a> * <a name="virDomainBlockStatsPtr" id="virDomainBlockStatsPtr">virDomainBlockStatsPtr</a>
typedef struct _virDomainBlockStats <a href="#virDomainBlockStatsStruct">virDomainBlockStatsStruct</a>
typedef enum <a href="#virDomainCreateFlags">virDomainCreateFlags</a>
typedef enum <a href="#virDomainEventDefinedDetailType">virDomainEventDefinedDetailType</a>
typedef enum <a href="#virDomainEventResumedDetailType">virDomainEventResumedDetailType</a>
typedef enum <a href="#virDomainEventStartedDetailType">virDomainEventStartedDetailType</a>
typedef enum <a href="#virDomainEventStoppedDetailType">virDomainEventStoppedDetailType</a>
typedef enum <a href="#virDomainEventSuspendedDetailType">virDomainEventSuspendedDetailType</a>
typedef enum <a href="#virDomainEventType">virDomainEventType</a>
typedef enum <a href="#virDomainEventUndefinedDetailType">virDomainEventUndefinedDetailType</a>
typedef struct _virDomainInfo <a href="#virDomainInfo">virDomainInfo</a>
typedef <a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> * <a name="virDomainInfoPtr" id="virDomainInfoPtr">virDomainInfoPtr</a>
typedef <a href="libvirt-libvirt.html#virDomainInterfaceStatsStruct">virDomainInterfaceStatsStruct</a> * <a name="virDomainInterfaceStatsPtr" id="virDomainInterfaceStatsPtr">virDomainInterfaceStatsPtr</a>
@ -65,7 +71,7 @@ int <a href="#virConnectAuthCallbackPtr">virConnectAuthCallbackPtr</a> (<a href=
int <a href="#virConnectClose">virConnectClose</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
typedef <a href="#virConnectDomainEventCallback">virConnectDomainEventCallback</a>
int <a href="#virConnectDomainEventCallback">virConnectDomainEventCallback</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int event, <br /> void * opaque)
int <a href="#virConnectDomainEventCallback">virConnectDomainEventCallback</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int event, <br /> int detail, <br /> void * opaque)
int <a href="#virConnectDomainEventDeregister">virConnectDomainEventDeregister</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb)
int <a href="#virConnectDomainEventRegister">virConnectDomainEventRegister</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb, <br /> void * opaque)
@ -239,8 +245,20 @@ char * <a href="#virStorageVolGetXMLDesc">virStorageVolGetXMLDesc</a> (<a href=
}
</pre></div><h3><a name="virDomainCreateFlags" id="virDomainCreateFlags"><code>virDomainCreateFlags</code></a></h3><div class="api"><pre>enum virDomainCreateFlags {
</pre><table><tr><td><a name="VIR_DOMAIN_NONE" id="VIR_DOMAIN_NONE">VIR_DOMAIN_NONE</a></td><td> = </td><td>0</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventDefinedDetailType" id="virDomainEventDefinedDetailType"><code>virDomainEventDefinedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventDefinedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_DEFINED_ADDED" id="VIR_DOMAIN_EVENT_DEFINED_ADDED">VIR_DOMAIN_EVENT_DEFINED_ADDED</a></td><td> = </td><td>0</td><td> : Newly created config file</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_DEFINED_UPDATED" id="VIR_DOMAIN_EVENT_DEFINED_UPDATED">VIR_DOMAIN_EVENT_DEFINED_UPDATED</a></td><td> = </td><td>1</td><td> : Changed config file</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventResumedDetailType" id="virDomainEventResumedDetailType"><code>virDomainEventResumedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventResumedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_RESUMED_UNPAUSED" id="VIR_DOMAIN_EVENT_RESUMED_UNPAUSED">VIR_DOMAIN_EVENT_RESUMED_UNPAUSED</a></td><td> = </td><td>0</td><td> : Normal resume due to admin unpause</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_RESUMED_MIGRATED" id="VIR_DOMAIN_EVENT_RESUMED_MIGRATED">VIR_DOMAIN_EVENT_RESUMED_MIGRATED</a></td><td> = </td><td>1</td><td> : Resumed for completion of migration</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventStartedDetailType" id="virDomainEventStartedDetailType"><code>virDomainEventStartedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventStartedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_STARTED_BOOTED" id="VIR_DOMAIN_EVENT_STARTED_BOOTED">VIR_DOMAIN_EVENT_STARTED_BOOTED</a></td><td> = </td><td>0</td><td> : Normal startup from boot</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STARTED_MIGRATED" id="VIR_DOMAIN_EVENT_STARTED_MIGRATED">VIR_DOMAIN_EVENT_STARTED_MIGRATED</a></td><td> = </td><td>1</td><td> : Incoming migration from another host</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STARTED_RESTORED" id="VIR_DOMAIN_EVENT_STARTED_RESTORED">VIR_DOMAIN_EVENT_STARTED_RESTORED</a></td><td> = </td><td>2</td><td> : Restored from a state file</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventStoppedDetailType" id="virDomainEventStoppedDetailType"><code>virDomainEventStoppedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventStoppedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN" id="VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN">VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN</a></td><td> = </td><td>0</td><td> : Normal shutdown</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_DESTROYED" id="VIR_DOMAIN_EVENT_STOPPED_DESTROYED">VIR_DOMAIN_EVENT_STOPPED_DESTROYED</a></td><td> = </td><td>1</td><td> : Forced poweroff from host</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_CRASHED" id="VIR_DOMAIN_EVENT_STOPPED_CRASHED">VIR_DOMAIN_EVENT_STOPPED_CRASHED</a></td><td> = </td><td>2</td><td> : Guest crashed</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_MIGRATED" id="VIR_DOMAIN_EVENT_STOPPED_MIGRATED">VIR_DOMAIN_EVENT_STOPPED_MIGRATED</a></td><td> = </td><td>3</td><td> : Migrated off to another host</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_SAVED" id="VIR_DOMAIN_EVENT_STOPPED_SAVED">VIR_DOMAIN_EVENT_STOPPED_SAVED</a></td><td> = </td><td>4</td><td> : Saved to a state file</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED_FAILED" id="VIR_DOMAIN_EVENT_STOPPED_FAILED">VIR_DOMAIN_EVENT_STOPPED_FAILED</a></td><td> = </td><td>5</td><td> : Host emulator/mgmt failed</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventSuspendedDetailType" id="virDomainEventSuspendedDetailType"><code>virDomainEventSuspendedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventSuspendedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_SUSPENDED_PAUSED" id="VIR_DOMAIN_EVENT_SUSPENDED_PAUSED">VIR_DOMAIN_EVENT_SUSPENDED_PAUSED</a></td><td> = </td><td>0</td><td> : Normal suspend due to admin pause</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED" id="VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED">VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED</a></td><td> = </td><td>1</td><td> : Suspended for offline migration</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventType" id="virDomainEventType"><code>virDomainEventType</code></a></h3><div class="api"><pre>enum virDomainEventType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_ADDED" id="VIR_DOMAIN_EVENT_ADDED">VIR_DOMAIN_EVENT_ADDED</a></td><td> = </td><td>0</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_REMOVED" id="VIR_DOMAIN_EVENT_REMOVED">VIR_DOMAIN_EVENT_REMOVED</a></td><td> = </td><td>1</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STARTED" id="VIR_DOMAIN_EVENT_STARTED">VIR_DOMAIN_EVENT_STARTED</a></td><td> = </td><td>2</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_SUSPENDED" id="VIR_DOMAIN_EVENT_SUSPENDED">VIR_DOMAIN_EVENT_SUSPENDED</a></td><td> = </td><td>3</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_RESUMED" id="VIR_DOMAIN_EVENT_RESUMED">VIR_DOMAIN_EVENT_RESUMED</a></td><td> = </td><td>4</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED" id="VIR_DOMAIN_EVENT_STOPPED">VIR_DOMAIN_EVENT_STOPPED</a></td><td> = </td><td>5</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_SAVED" id="VIR_DOMAIN_EVENT_SAVED">VIR_DOMAIN_EVENT_SAVED</a></td><td> = </td><td>6</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_RESTORED" id="VIR_DOMAIN_EVENT_RESTORED">VIR_DOMAIN_EVENT_RESTORED</a></td><td> = </td><td>7</td></tr></table><pre>}
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_DEFINED" id="VIR_DOMAIN_EVENT_DEFINED">VIR_DOMAIN_EVENT_DEFINED</a></td><td> = </td><td>0</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_UNDEFINED" id="VIR_DOMAIN_EVENT_UNDEFINED">VIR_DOMAIN_EVENT_UNDEFINED</a></td><td> = </td><td>1</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STARTED" id="VIR_DOMAIN_EVENT_STARTED">VIR_DOMAIN_EVENT_STARTED</a></td><td> = </td><td>2</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_SUSPENDED" id="VIR_DOMAIN_EVENT_SUSPENDED">VIR_DOMAIN_EVENT_SUSPENDED</a></td><td> = </td><td>3</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_RESUMED" id="VIR_DOMAIN_EVENT_RESUMED">VIR_DOMAIN_EVENT_RESUMED</a></td><td> = </td><td>4</td></tr><tr><td><a name="VIR_DOMAIN_EVENT_STOPPED" id="VIR_DOMAIN_EVENT_STOPPED">VIR_DOMAIN_EVENT_STOPPED</a></td><td> = </td><td>5</td></tr></table><pre>}
</pre></div><h3><a name="virDomainEventUndefinedDetailType" id="virDomainEventUndefinedDetailType"><code>virDomainEventUndefinedDetailType</code></a></h3><div class="api"><pre>enum virDomainEventUndefinedDetailType {
</pre><table><tr><td><a name="VIR_DOMAIN_EVENT_UNDEFINED_REMOVED" id="VIR_DOMAIN_EVENT_UNDEFINED_REMOVED">VIR_DOMAIN_EVENT_UNDEFINED_REMOVED</a></td><td> = </td><td>0</td><td> : Deleted the config file</td></tr></table><pre>}
</pre></div><h3><a name="virDomainInfo" id="virDomainInfo"><code>virDomainInfo</code></a></h3><div class="api"><pre>struct virDomainInfo{
</pre><table><tr><td>unsigned char</td><td>state</td><td> : the running state, one of <a href="libvirt-libvirt.html#virDomainState">virDomainState</a></td></tr><tr><td>unsigned long</td><td>maxMem</td><td> : the maximum memory in KBytes allowed</td></tr><tr><td>unsigned long</td><td>memory</td><td> : the memory in KBytes used by the domain</td></tr><tr><td>unsigned short</td><td>nrVirtCpu</td><td> : the number of virtual CPUs for the domain</td></tr><tr><td>unsigned long long</td><td>cpuTime</td><td> : the CPU time used in nanoseconds</td></tr></table><pre>
}
@ -297,8 +315,8 @@ char * <a href="#virStorageVolGetXMLDesc">virStorageVolGetXMLDesc</a> (<a href=
</pre><table><tr><td><a name="VIR_VCPU_OFFLINE" id="VIR_VCPU_OFFLINE">VIR_VCPU_OFFLINE</a></td><td> = </td><td>0</td><td> : the virtual CPU is offline</td></tr><tr><td><a name="VIR_VCPU_RUNNING" id="VIR_VCPU_RUNNING">VIR_VCPU_RUNNING</a></td><td> = </td><td>1</td><td> : the virtual CPU is running</td></tr><tr><td><a name="VIR_VCPU_BLOCKED" id="VIR_VCPU_BLOCKED">VIR_VCPU_BLOCKED</a></td><td> = </td><td>2</td><td> : the virtual CPU is blocked on resource</td></tr></table><pre>}
</pre></div><h3><a name="functions" id="functions">Functions</a></h3><h3><a name="virConnectAuthCallbackPtr" id="virConnectAuthCallbackPtr"><code>virConnectAuthCallbackPtr</code></a></h3><pre class="programlisting">typedef int (*virConnectAuthCallbackPtr) (<a href="libvirt-libvirt.html#virConnectCredentialPtr">virConnectCredentialPtr</a> cred, <br /> unsigned int ncred, <br /> void * cbdata)
</pre><p></p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>cred</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>ncred</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>cbdata</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br /><h3><a name="virConnectClose" id="virConnectClose"><code>virConnectClose</code></a></h3><pre class="programlisting">int virConnectClose (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
</pre><p>This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virConnectDomainEventCallback" id="virConnectDomainEventCallback"><code>virConnectDomainEventCallback</code></a></h3><pre class="programlisting">typedef int (*virConnectDomainEventCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int event, <br /> void * opaque)
</pre><p>A callback function to be registered, and called when a domain event occurs</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occured</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>The specfic <a href="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occured</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventDeregister" id="virConnectDomainEventDeregister"><code>virConnectDomainEventDeregister</code></a></h3><pre class="programlisting">int virConnectDomainEventDeregister (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb)<br />
</pre><p>This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virConnectDomainEventCallback" id="virConnectDomainEventCallback"><code>virConnectDomainEventCallback</code></a></h3><pre class="programlisting">typedef int (*virConnectDomainEventCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int event, <br /> int detail, <br /> void * opaque)
</pre><p>A callback function to be registered, and called when a domain event occurs</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occured</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>The specfic <a href="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occured</td></tr><tr><td><span class="term"><i><tt>detail</tt></i>:</span></td><td>event specific detail information</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventDeregister" id="virConnectDomainEventDeregister"><code>virConnectDomainEventDeregister</code></a></h3><pre class="programlisting">int virConnectDomainEventDeregister (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb)<br />
</pre><p>Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventRegister" id="virConnectDomainEventRegister"><code>virConnectDomainEventRegister</code></a></h3><pre class="programlisting">int virConnectDomainEventRegister (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb, <br /> void * opaque)<br />
</pre><p>Adds a Domain Event Callback. Registering for a domain callback will enable delivery of the events</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque data to pass on to the callback</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectFindStoragePoolSources" id="virConnectFindStoragePoolSources"><code>virConnectFindStoragePoolSources</code></a></h3><pre class="programlisting">char * virConnectFindStoragePoolSources (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * type, <br /> const char * srcSpec, <br /> unsigned int flags)<br />
</pre><p>Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g. For iSCSI this would be a set of iSCSI targets. For NFS this would be a list of exported paths. The srcSpec (optional for some storage pool types, e.g. local ones) is an instance of the storage pool's source element specifying where to look for the pools. srcSpec is not required for some types (e.g., those querying local storage resources only)</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of storage pool sources to discover</td></tr><tr><td><span class="term"><i><tt>srcSpec</tt></i>:</span></td><td>XML document specifying discovery source</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for discovery (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an xml document consisting of a SourceList element containing a source document appropriate to the given pool type for each discovered source.</td></tr></tbody></table></div><h3><a name="virConnectGetCapabilities" id="virConnectGetCapabilities"><code>virConnectGetCapabilities</code></a></h3><pre class="programlisting">char * virConnectGetCapabilities (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />

View File

@ -16,69 +16,84 @@
<exports symbol='VIR_UUID_STRING_BUFLEN' type='macro'/>
<exports symbol='VIR_GET_CPUMAP' type='macro'/>
<exports symbol='VIR_UNUSE_CPU' type='macro'/>
<exports symbol='VIR_STORAGE_POOL_BUILD_REPAIR' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_DEFINED' type='enum'/>
<exports symbol='VIR_CRED_EXTERNAL' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_ADDED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_CRASHED' type='enum'/>
<exports symbol='VIR_EVENT_HANDLE_READABLE' type='enum'/>
<exports symbol='VIR_DOMAIN_SHUTDOWN' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_UINT' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_BUILDING' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_SAVED' type='enum'/>
<exports symbol='VIR_CRED_CNONCE' type='enum'/>
<exports symbol='VIR_CRED_ECHOPROMPT' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_DOUBLE' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STARTED_BOOTED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_RESUMED' type='enum'/>
<exports symbol='VIR_VCPU_OFFLINE' type='enum'/>
<exports symbol='VIR_STORAGE_VOL_DELETE_NORMAL' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_RUNNING' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_BUILD_RESIZE' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_LLONG' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_FAILED' type='enum'/>
<exports symbol='VIR_CONNECT_RO' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED' type='enum'/>
<exports symbol='VIR_CRED_AUTHNAME' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_BUILD_REPAIR' type='enum'/>
<exports symbol='VIR_CRED_LANGUAGE' type='enum'/>
<exports symbol='VIR_CRED_NOECHOPROMPT' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_BOOLEAN' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_UNDEFINED' type='enum'/>
<exports symbol='VIR_MIGRATE_LIVE' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_INACTIVE' type='enum'/>
<exports symbol='VIR_CRED_USERNAME' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_DESTROYED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_DEFINED_ADDED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STARTED_MIGRATED' type='enum'/>
<exports symbol='VIR_VCPU_BLOCKED' type='enum'/>
<exports symbol='VIR_MEMORY_VIRTUAL' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_REMOVED' type='enum'/>
<exports symbol='VIR_CRED_USERNAME' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_RESUMED_UNPAUSED' type='enum'/>
<exports symbol='VIR_DOMAIN_RUNNING' type='enum'/>
<exports symbol='VIR_EVENT_HANDLE_ERROR' type='enum'/>
<exports symbol='VIR_DOMAIN_NOSTATE' type='enum'/>
<exports symbol='VIR_DOMAIN_SHUTOFF' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_BUILD_NEW' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_DELETE_ZEROED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STARTED_RESTORED' type='enum'/>
<exports symbol='VIR_EVENT_HANDLE_WRITABLE' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_BUILD_NEW' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_SUSPENDED_PAUSED' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_DELETE_NORMAL' type='enum'/>
<exports symbol='VIR_STORAGE_VOL_DELETE_ZEROED' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_INT' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_ULLONG' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN' type='enum'/>
<exports symbol='VIR_CRED_REALM' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STARTED' type='enum'/>
<exports symbol='VIR_STORAGE_VOL_FILE' type='enum'/>
<exports symbol='VIR_EVENT_HANDLE_HANGUP' type='enum'/>
<exports symbol='VIR_DOMAIN_PAUSED' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_DEGRADED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_DEFINED_UPDATED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED' type='enum'/>
<exports symbol='VIR_DOMAIN_CRASHED' type='enum'/>
<exports symbol='VIR_VCPU_RUNNING' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_DOUBLE' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_LLONG' type='enum'/>
<exports symbol='VIR_DOMAIN_SCHED_FIELD_BOOLEAN' type='enum'/>
<exports symbol='VIR_DOMAIN_XML_INACTIVE' type='enum'/>
<exports symbol='VIR_STORAGE_VOL_BLOCK' type='enum'/>
<exports symbol='VIR_DOMAIN_NONE' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_RESTORED' type='enum'/>
<exports symbol='VIR_CRED_PASSPHRASE' type='enum'/>
<exports symbol='VIR_STORAGE_VOL_DELETE_NORMAL' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_DELETE_ZEROED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_UNDEFINED_REMOVED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_RESUMED_MIGRATED' type='enum'/>
<exports symbol='VIR_DOMAIN_BLOCKED' type='enum'/>
<exports symbol='VIR_CRED_PASSPHRASE' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_SAVED' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_STOPPED_MIGRATED' type='enum'/>
<exports symbol='VIR_STORAGE_POOL_INACTIVE' type='enum'/>
<exports symbol='VIR_DOMAIN_XML_SECURE' type='enum'/>
<exports symbol='VIR_DOMAIN_EVENT_SUSPENDED' type='enum'/>
<exports symbol='virDomainBlockStatsStruct' type='typedef'/>
<exports symbol='virDomainMigrateFlags' type='typedef'/>
<exports symbol='virNodeInfo' type='typedef'/>
<exports symbol='virNetwork' type='typedef'/>
<exports symbol='virDomainEventResumedDetailType' type='typedef'/>
<exports symbol='virDomainBlockStatsPtr' type='typedef'/>
<exports symbol='virConnect' type='typedef'/>
<exports symbol='virVcpuInfo' type='typedef'/>
<exports symbol='virDomainEventStartedDetailType' type='typedef'/>
<exports symbol='virDomainInfo' type='typedef'/>
<exports symbol='virStoragePoolDeleteFlags' type='typedef'/>
<exports symbol='virEventHandleType' type='typedef'/>
@ -102,17 +117,22 @@
<exports symbol='virStorageVolInfoPtr' type='typedef'/>
<exports symbol='virSchedParameter' type='typedef'/>
<exports symbol='virConnectFlags' type='typedef'/>
<exports symbol='virDomainEventDefinedDetailType' type='typedef'/>
<exports symbol='virDomainMemoryFlags' type='typedef'/>
<exports symbol='virDomainEventStoppedDetailType' type='typedef'/>
<exports symbol='virStorageVolPtr' type='typedef'/>
<exports symbol='virVcpuState' type='typedef'/>
<exports symbol='virStorageVolDeleteFlags' type='typedef'/>
<exports symbol='virVcpuInfo' type='typedef'/>
<exports symbol='virSchedParameterPtr' type='typedef'/>
<exports symbol='virConnectAuth' type='typedef'/>
<exports symbol='virConnectCredential' type='typedef'/>
<exports symbol='virDomainEventSuspendedDetailType' type='typedef'/>
<exports symbol='virVcpuInfoPtr' type='typedef'/>
<exports symbol='virStoragePoolBuildFlags' type='typedef'/>
<exports symbol='virDomainXMLFlags' type='typedef'/>
<exports symbol='virStorageVolType' type='typedef'/>
<exports symbol='virDomainEventUndefinedDetailType' type='typedef'/>
<exports symbol='virDomainPtr' type='typedef'/>
<exports symbol='virConnectCredentialType' type='typedef'/>
<exports symbol='virStoragePoolState' type='typedef'/>
@ -429,14 +449,28 @@
<enum name='VIR_CRED_USERNAME' file='libvirt' value='1' type='virConnectCredentialType' info='Identity to act as'/>
<enum name='VIR_DOMAIN_BLOCKED' file='libvirt' value='2' type='virDomainState' info='the domain is blocked on resource'/>
<enum name='VIR_DOMAIN_CRASHED' file='libvirt' value='6' type='virDomainState' info=' the domain is crashed'/>
<enum name='VIR_DOMAIN_EVENT_ADDED' file='libvirt' value='0' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_REMOVED' file='libvirt' value='1' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_RESTORED' file='libvirt' value='7' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_DEFINED' file='libvirt' value='0' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_DEFINED_ADDED' file='libvirt' value='0' type='virDomainEventDefinedDetailType' info='Newly created config file'/>
<enum name='VIR_DOMAIN_EVENT_DEFINED_UPDATED' file='libvirt' value='1' type='virDomainEventDefinedDetailType' info=' Changed config file'/>
<enum name='VIR_DOMAIN_EVENT_RESUMED' file='libvirt' value='4' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_SAVED' file='libvirt' value='6' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_RESUMED_MIGRATED' file='libvirt' value='1' type='virDomainEventResumedDetailType' info=' Resumed for completion of migration'/>
<enum name='VIR_DOMAIN_EVENT_RESUMED_UNPAUSED' file='libvirt' value='0' type='virDomainEventResumedDetailType' info='Normal resume due to admin unpause'/>
<enum name='VIR_DOMAIN_EVENT_STARTED' file='libvirt' value='2' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_STARTED_BOOTED' file='libvirt' value='0' type='virDomainEventStartedDetailType' info='Normal startup from boot'/>
<enum name='VIR_DOMAIN_EVENT_STARTED_MIGRATED' file='libvirt' value='1' type='virDomainEventStartedDetailType' info='Incoming migration from another host'/>
<enum name='VIR_DOMAIN_EVENT_STARTED_RESTORED' file='libvirt' value='2' type='virDomainEventStartedDetailType' info=' Restored from a state file'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED' file='libvirt' value='5' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_CRASHED' file='libvirt' value='2' type='virDomainEventStoppedDetailType' info='Guest crashed'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_DESTROYED' file='libvirt' value='1' type='virDomainEventStoppedDetailType' info='Forced poweroff from host'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_FAILED' file='libvirt' value='5' type='virDomainEventStoppedDetailType' info=' Host emulator/mgmt failed'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_MIGRATED' file='libvirt' value='3' type='virDomainEventStoppedDetailType' info='Migrated off to another host'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_SAVED' file='libvirt' value='4' type='virDomainEventStoppedDetailType' info='Saved to a state file'/>
<enum name='VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN' file='libvirt' value='0' type='virDomainEventStoppedDetailType' info='Normal shutdown'/>
<enum name='VIR_DOMAIN_EVENT_SUSPENDED' file='libvirt' value='3' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED' file='libvirt' value='1' type='virDomainEventSuspendedDetailType' info=' Suspended for offline migration'/>
<enum name='VIR_DOMAIN_EVENT_SUSPENDED_PAUSED' file='libvirt' value='0' type='virDomainEventSuspendedDetailType' info='Normal suspend due to admin pause'/>
<enum name='VIR_DOMAIN_EVENT_UNDEFINED' file='libvirt' value='1' type='virDomainEventType'/>
<enum name='VIR_DOMAIN_EVENT_UNDEFINED_REMOVED' file='libvirt' value='0' type='virDomainEventUndefinedDetailType' info=' Deleted the config file'/>
<enum name='VIR_DOMAIN_NONE' file='libvirt' value='0' type='virDomainCreateFlags'/>
<enum name='VIR_DOMAIN_NOSTATE' file='libvirt' value='0' type='virDomainState' info='no state'/>
<enum name='VIR_DOMAIN_PAUSED' file='libvirt' value='3' type='virDomainState' info='the domain is paused by user'/>
@ -582,7 +616,13 @@
<field name='errs' type='long long' info=' In Xen this returns the mysterious &apos;oo_req&apos;.'/>
</struct>
<typedef name='virDomainCreateFlags' file='libvirt' type='enum'/>
<typedef name='virDomainEventDefinedDetailType' file='libvirt' type='enum'/>
<typedef name='virDomainEventResumedDetailType' file='libvirt' type='enum'/>
<typedef name='virDomainEventStartedDetailType' file='libvirt' type='enum'/>
<typedef name='virDomainEventStoppedDetailType' file='libvirt' type='enum'/>
<typedef name='virDomainEventSuspendedDetailType' file='libvirt' type='enum'/>
<typedef name='virDomainEventType' file='libvirt' type='enum'/>
<typedef name='virDomainEventUndefinedDetailType' file='libvirt' type='enum'/>
<struct name='virDomainInfo' file='libvirt' type='struct _virDomainInfo'>
<field name='state' type='unsigned char' info=' the running state, one of virDomainState'/>
<field name='maxMem' type='unsigned long' info=' the maximum memory in KBytes allowed'/>
@ -736,6 +776,7 @@ see note above'/>
<arg name='conn' type='virConnectPtr' info='virConnect connection'/>
<arg name='dom' type='virDomainPtr' info='The domain on which the event occured'/>
<arg name='event' type='int' info='The specfic virDomainEventType which occured'/>
<arg name='detail' type='int' info='event specific detail information'/>
<arg name='opaque' type='void *' info='opaque user data'/>
</functype>
<function name='virConnectDomainEventDeregister' file='libvirt' module='libvirt'>

View File

@ -17,14 +17,28 @@
<reference name='VIR_CRED_USERNAME' href='html/libvirt-libvirt.html#VIR_CRED_USERNAME'/>
<reference name='VIR_DOMAIN_BLOCKED' href='html/libvirt-libvirt.html#VIR_DOMAIN_BLOCKED'/>
<reference name='VIR_DOMAIN_CRASHED' href='html/libvirt-libvirt.html#VIR_DOMAIN_CRASHED'/>
<reference name='VIR_DOMAIN_EVENT_ADDED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_ADDED'/>
<reference name='VIR_DOMAIN_EVENT_REMOVED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_REMOVED'/>
<reference name='VIR_DOMAIN_EVENT_RESTORED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_RESTORED'/>
<reference name='VIR_DOMAIN_EVENT_DEFINED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_DEFINED'/>
<reference name='VIR_DOMAIN_EVENT_DEFINED_ADDED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_DEFINED_ADDED'/>
<reference name='VIR_DOMAIN_EVENT_DEFINED_UPDATED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_DEFINED_UPDATED'/>
<reference name='VIR_DOMAIN_EVENT_RESUMED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_RESUMED'/>
<reference name='VIR_DOMAIN_EVENT_SAVED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_SAVED'/>
<reference name='VIR_DOMAIN_EVENT_RESUMED_MIGRATED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_RESUMED_MIGRATED'/>
<reference name='VIR_DOMAIN_EVENT_RESUMED_UNPAUSED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_RESUMED_UNPAUSED'/>
<reference name='VIR_DOMAIN_EVENT_STARTED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STARTED'/>
<reference name='VIR_DOMAIN_EVENT_STARTED_BOOTED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STARTED_BOOTED'/>
<reference name='VIR_DOMAIN_EVENT_STARTED_MIGRATED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STARTED_MIGRATED'/>
<reference name='VIR_DOMAIN_EVENT_STARTED_RESTORED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STARTED_RESTORED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_CRASHED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_CRASHED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_DESTROYED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_DESTROYED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_FAILED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_FAILED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_MIGRATED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_MIGRATED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_SAVED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_SAVED'/>
<reference name='VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN'/>
<reference name='VIR_DOMAIN_EVENT_SUSPENDED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_SUSPENDED'/>
<reference name='VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED'/>
<reference name='VIR_DOMAIN_EVENT_SUSPENDED_PAUSED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_SUSPENDED_PAUSED'/>
<reference name='VIR_DOMAIN_EVENT_UNDEFINED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_UNDEFINED'/>
<reference name='VIR_DOMAIN_EVENT_UNDEFINED_REMOVED' href='html/libvirt-libvirt.html#VIR_DOMAIN_EVENT_UNDEFINED_REMOVED'/>
<reference name='VIR_DOMAIN_NONE' href='html/libvirt-libvirt.html#VIR_DOMAIN_NONE'/>
<reference name='VIR_DOMAIN_NOSTATE' href='html/libvirt-libvirt.html#VIR_DOMAIN_NOSTATE'/>
<reference name='VIR_DOMAIN_PAUSED' href='html/libvirt-libvirt.html#VIR_DOMAIN_PAUSED'/>
@ -210,7 +224,13 @@
<reference name='virDomainDefineXML' href='html/libvirt-libvirt.html#virDomainDefineXML'/>
<reference name='virDomainDestroy' href='html/libvirt-libvirt.html#virDomainDestroy'/>
<reference name='virDomainDetachDevice' href='html/libvirt-libvirt.html#virDomainDetachDevice'/>
<reference name='virDomainEventDefinedDetailType' href='html/libvirt-libvirt.html#virDomainEventDefinedDetailType'/>
<reference name='virDomainEventResumedDetailType' href='html/libvirt-libvirt.html#virDomainEventResumedDetailType'/>
<reference name='virDomainEventStartedDetailType' href='html/libvirt-libvirt.html#virDomainEventStartedDetailType'/>
<reference name='virDomainEventStoppedDetailType' href='html/libvirt-libvirt.html#virDomainEventStoppedDetailType'/>
<reference name='virDomainEventSuspendedDetailType' href='html/libvirt-libvirt.html#virDomainEventSuspendedDetailType'/>
<reference name='virDomainEventType' href='html/libvirt-libvirt.html#virDomainEventType'/>
<reference name='virDomainEventUndefinedDetailType' href='html/libvirt-libvirt.html#virDomainEventUndefinedDetailType'/>
<reference name='virDomainFree' href='html/libvirt-libvirt.html#virDomainFree'/>
<reference name='virDomainGetAutostart' href='html/libvirt-libvirt.html#virDomainGetAutostart'/>
<reference name='virDomainGetConnect' href='html/libvirt-libvirt.html#virDomainGetConnect'/>
@ -376,14 +396,28 @@
<ref name='VIR_CRED_USERNAME'/>
<ref name='VIR_DOMAIN_BLOCKED'/>
<ref name='VIR_DOMAIN_CRASHED'/>
<ref name='VIR_DOMAIN_EVENT_ADDED'/>
<ref name='VIR_DOMAIN_EVENT_REMOVED'/>
<ref name='VIR_DOMAIN_EVENT_RESTORED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED_ADDED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED_UPDATED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED'/>
<ref name='VIR_DOMAIN_EVENT_SAVED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED_UNPAUSED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_BOOTED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_RESTORED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_CRASHED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_DESTROYED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_FAILED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_SAVED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED_PAUSED'/>
<ref name='VIR_DOMAIN_EVENT_UNDEFINED'/>
<ref name='VIR_DOMAIN_EVENT_UNDEFINED_REMOVED'/>
<ref name='VIR_DOMAIN_NONE'/>
<ref name='VIR_DOMAIN_NOSTATE'/>
<ref name='VIR_DOMAIN_PAUSED'/>
@ -573,7 +607,13 @@
<ref name='virDomainDefineXML'/>
<ref name='virDomainDestroy'/>
<ref name='virDomainDetachDevice'/>
<ref name='virDomainEventDefinedDetailType'/>
<ref name='virDomainEventResumedDetailType'/>
<ref name='virDomainEventStartedDetailType'/>
<ref name='virDomainEventStoppedDetailType'/>
<ref name='virDomainEventSuspendedDetailType'/>
<ref name='virDomainEventType'/>
<ref name='virDomainEventUndefinedDetailType'/>
<ref name='virDomainFree'/>
<ref name='virDomainGetAutostart'/>
<ref name='virDomainGetConnect'/>
@ -1089,14 +1129,28 @@
<ref name='VIR_CRED_USERNAME'/>
<ref name='VIR_DOMAIN_BLOCKED'/>
<ref name='VIR_DOMAIN_CRASHED'/>
<ref name='VIR_DOMAIN_EVENT_ADDED'/>
<ref name='VIR_DOMAIN_EVENT_REMOVED'/>
<ref name='VIR_DOMAIN_EVENT_RESTORED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED_ADDED'/>
<ref name='VIR_DOMAIN_EVENT_DEFINED_UPDATED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED'/>
<ref name='VIR_DOMAIN_EVENT_SAVED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_RESUMED_UNPAUSED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_BOOTED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_STARTED_RESTORED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_CRASHED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_DESTROYED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_FAILED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_SAVED'/>
<ref name='VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED'/>
<ref name='VIR_DOMAIN_EVENT_SUSPENDED_PAUSED'/>
<ref name='VIR_DOMAIN_EVENT_UNDEFINED'/>
<ref name='VIR_DOMAIN_EVENT_UNDEFINED_REMOVED'/>
<ref name='VIR_DOMAIN_NONE'/>
<ref name='VIR_DOMAIN_NOSTATE'/>
<ref name='VIR_DOMAIN_PAUSED'/>
@ -1200,7 +1254,13 @@
<ref name='virDomainDefineXML'/>
<ref name='virDomainDestroy'/>
<ref name='virDomainDetachDevice'/>
<ref name='virDomainEventDefinedDetailType'/>
<ref name='virDomainEventResumedDetailType'/>
<ref name='virDomainEventStartedDetailType'/>
<ref name='virDomainEventStoppedDetailType'/>
<ref name='virDomainEventSuspendedDetailType'/>
<ref name='virDomainEventType'/>
<ref name='virDomainEventUndefinedDetailType'/>
<ref name='virDomainFree'/>
<ref name='virDomainGetAutostart'/>
<ref name='virDomainGetConnect'/>
@ -2917,6 +2977,9 @@
<ref name='virStoragePoolCreateXML'/>
<ref name='virStoragePoolDestroy'/>
</word>
<word name='detail'>
<ref name='virConnectDomainEventCallback'/>
</word>
<word name='determine'>
<ref name='virDomainBlockPeek'/>
</word>
@ -3578,6 +3641,7 @@
</word>
<word name='information'>
<ref name='_virError'/>
<ref name='virConnectDomainEventCallback'/>
<ref name='virDomainGetInfo'/>
<ref name='virDomainGetUUIDString'/>
<ref name='virDomainGetVcpus'/>
@ -4898,6 +4962,7 @@
<ref name='virConnectDomainEventCallback'/>
</word>
<word name='specific'>
<ref name='virConnectDomainEventCallback'/>
<ref name='virConnectGetMaxVcpus'/>
<ref name='virEventAddHandleFunc'/>
</word>

View File

@ -35,9 +35,9 @@ void *t_opaque = NULL;
/* Prototypes */
const char *eventToString(int event);
int myDomainEventCallback1 (virConnectPtr conn, virDomainPtr dom,
int event, void *opaque);
int event, int detail, void *opaque);
int myDomainEventCallback2 (virConnectPtr conn, virDomainPtr dom,
int event, void *opaque);
int event, int detail, void *opaque);
int myEventAddHandleFunc (int fd, int event,
virEventHandleCallback cb, void *opaque);
void myEventUpdateHandleFunc(int fd, int event);
@ -56,13 +56,13 @@ void usage(const char *pname);
/* Callback functions */
const char *eventToString(int event) {
const char *ret = NULL;
const char *ret = "";
switch(event) {
case VIR_DOMAIN_EVENT_ADDED:
ret ="Added";
case VIR_DOMAIN_EVENT_DEFINED:
ret ="Defined";
break;
case VIR_DOMAIN_EVENT_REMOVED:
ret ="Removed";
case VIR_DOMAIN_EVENT_UNDEFINED:
ret ="Undefined";
break;
case VIR_DOMAIN_EVENT_STARTED:
ret ="Started";
@ -76,14 +76,70 @@ const char *eventToString(int event) {
case VIR_DOMAIN_EVENT_STOPPED:
ret ="Stopped";
break;
case VIR_DOMAIN_EVENT_SAVED:
ret ="Saved";
}
return ret;
}
static const char *eventDetailToString(int event, int detail) {
const char *ret = "";
switch(event) {
case VIR_DOMAIN_EVENT_DEFINED:
if (detail == VIR_DOMAIN_EVENT_DEFINED_ADDED)
ret = "Added";
else if (detail == VIR_DOMAIN_EVENT_DEFINED_UPDATED)
ret = "Updated";
break;
case VIR_DOMAIN_EVENT_RESTORED:
ret ="Restored";
case VIR_DOMAIN_EVENT_UNDEFINED:
if (detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
ret = "Removed";
break;
case VIR_DOMAIN_EVENT_STARTED:
switch (detail) {
case VIR_DOMAIN_EVENT_STARTED_BOOTED:
ret = "Booted";
break;
case VIR_DOMAIN_EVENT_STARTED_MIGRATED:
ret = "Migrated";
break;
case VIR_DOMAIN_EVENT_STARTED_RESTORED:
ret = "Restored";
break;
}
break;
case VIR_DOMAIN_EVENT_SUSPENDED:
if (detail == VIR_DOMAIN_EVENT_SUSPENDED_PAUSED)
ret = "Unpaused";
else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED)
ret = "Migrated";
break;
case VIR_DOMAIN_EVENT_RESUMED:
if (detail == VIR_DOMAIN_EVENT_RESUMED_UNPAUSED)
ret = "Unpaused";
else if (detail == VIR_DOMAIN_EVENT_RESUMED_MIGRATED)
ret = "Migrated";
break;
case VIR_DOMAIN_EVENT_STOPPED:
switch (detail) {
case VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN:
ret = "Shutdown";
break;
case VIR_DOMAIN_EVENT_STOPPED_DESTROYED:
ret = "Destroyed";
break;
case VIR_DOMAIN_EVENT_STOPPED_CRASHED:
ret = "Crashed";
break;
case VIR_DOMAIN_EVENT_STOPPED_MIGRATED:
ret = "Migrated";
break;
case VIR_DOMAIN_EVENT_STOPPED_SAVED:
ret = "Failed";
break;
case VIR_DOMAIN_EVENT_STOPPED_FAILED:
ret = "Failed";
break;
}
break;
default:
ret ="Unknown Event";
}
return ret;
}
@ -91,20 +147,24 @@ const char *eventToString(int event) {
int myDomainEventCallback1 (virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int event,
int detail,
void *opaque ATTRIBUTE_UNUSED)
{
printf("%s EVENT: Domain %s(%d) %s\n", __FUNCTION__, virDomainGetName(dom),
virDomainGetID(dom), eventToString(event));
printf("%s EVENT: Domain %s(%d) %s %s\n", __FUNCTION__, virDomainGetName(dom),
virDomainGetID(dom), eventToString(event),
eventDetailToString(event, detail));
return 0;
}
int myDomainEventCallback2 (virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int event,
int detail,
void *opaque ATTRIBUTE_UNUSED)
{
printf("%s EVENT: Domain %s(%d) %s\n", __FUNCTION__, virDomainGetName(dom),
virDomainGetID(dom), eventToString(event));
printf("%s EVENT: Domain %s(%d) %s %s\n", __FUNCTION__, virDomainGetName(dom),
virDomainGetID(dom), eventToString(event),
eventDetailToString(event, detail));
return 0;
}

View File

@ -32,11 +32,11 @@ def eventToString(event):
"Restored" );
return eventStrings[event];
def myDomainEventCallback1 (conn, dom, event, opaque):
print "myDomainEventCallback1 EVENT: Domain %s(%s) %s" % (dom.name(), dom.ID(), eventToString(event))
def myDomainEventCallback1 (conn, dom, event, detail, opaque):
print "myDomainEventCallback1 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
def myDomainEventCallback2 (conn, dom, event, opaque):
print "myDomainEventCallback2 EVENT: Domain %s(%s) %s" % (dom.name(), dom.ID(), eventToString(event))
def myDomainEventCallback2 (conn, dom, event, detail, opaque):
print "myDomainEventCallback2 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
#####################################################
# EventImpl Functions

View File

@ -1004,21 +1004,85 @@ virDomainPtr virDomainCreateLinux (virConnectPtr conn,
* a virDomainEventType is emitted during domain lifecycle events
*/
typedef enum {
VIR_DOMAIN_EVENT_ADDED = 0,
VIR_DOMAIN_EVENT_REMOVED = 1,
VIR_DOMAIN_EVENT_DEFINED = 0,
VIR_DOMAIN_EVENT_UNDEFINED = 1,
VIR_DOMAIN_EVENT_STARTED = 2,
VIR_DOMAIN_EVENT_SUSPENDED = 3,
VIR_DOMAIN_EVENT_RESUMED = 4,
VIR_DOMAIN_EVENT_STOPPED = 5,
VIR_DOMAIN_EVENT_SAVED = 6,
VIR_DOMAIN_EVENT_RESTORED = 7,
} virDomainEventType;
/**
* virDomainEventDefinedDetailType:
*
* Details on the caused of the 'defined' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_DEFINED_ADDED = 0, /* Newly created config file */
VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1, /* Changed config file */
} virDomainEventDefinedDetailType;
/**
* virDomainEventUndefinedDetailType:
*
* Details on the caused of the 'undefined' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED = 0, /* Deleted the config file */
} virDomainEventUndefinedDetailType;
/**
* virDomainEventStartedDetailType:
*
* Details on the caused of the 'started' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0, /* Normal startup from boot */
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */
} virDomainEventStartedDetailType;
/**
* virDomainEventSuspendedDetailType:
*
* Details on the caused of the 'suspended' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0, /* Normal suspend due to admin pause */
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */
} virDomainEventSuspendedDetailType;
/**
* virDomainEventResumedDetailType:
*
* Details on the caused of the 'resumed' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0, /* Normal resume due to admin unpause */
VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1, /* Resumed for completion of migration */
} virDomainEventResumedDetailType;
/**
* virDomainEventStoppedDetailType:
*
* Details on the caused of the 'stopped' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN = 0, /* Normal shutdown */
VIR_DOMAIN_EVENT_STOPPED_DESTROYED = 1, /* Forced poweroff from host */
VIR_DOMAIN_EVENT_STOPPED_CRASHED = 2, /* Guest crashed */
VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3, /* Migrated off to another host */
VIR_DOMAIN_EVENT_STOPPED_SAVED = 4, /* Saved to a state file */
VIR_DOMAIN_EVENT_STOPPED_FAILED = 5, /* Host emulator/mgmt failed */
} virDomainEventStoppedDetailType;
/**
* virConnectDomainEventCallback:
* @conn: virConnect connection
* @dom: The domain on which the event occured
* @event: The specfic virDomainEventType which occured
* @detail: event specific detail information
* @opaque: opaque user data
*
* A callback function to be registered, and called when a domain event occurs
@ -1026,6 +1090,7 @@ typedef enum {
typedef int (*virConnectDomainEventCallback)(virConnectPtr conn,
virDomainPtr dom,
int event,
int detail,
void *opaque);
int virConnectDomainEventRegister(virConnectPtr conn,

View File

@ -1004,21 +1004,85 @@ virDomainPtr virDomainCreateLinux (virConnectPtr conn,
* a virDomainEventType is emitted during domain lifecycle events
*/
typedef enum {
VIR_DOMAIN_EVENT_ADDED = 0,
VIR_DOMAIN_EVENT_REMOVED = 1,
VIR_DOMAIN_EVENT_DEFINED = 0,
VIR_DOMAIN_EVENT_UNDEFINED = 1,
VIR_DOMAIN_EVENT_STARTED = 2,
VIR_DOMAIN_EVENT_SUSPENDED = 3,
VIR_DOMAIN_EVENT_RESUMED = 4,
VIR_DOMAIN_EVENT_STOPPED = 5,
VIR_DOMAIN_EVENT_SAVED = 6,
VIR_DOMAIN_EVENT_RESTORED = 7,
} virDomainEventType;
/**
* virDomainEventDefinedDetailType:
*
* Details on the caused of the 'defined' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_DEFINED_ADDED = 0, /* Newly created config file */
VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1, /* Changed config file */
} virDomainEventDefinedDetailType;
/**
* virDomainEventUndefinedDetailType:
*
* Details on the caused of the 'undefined' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED = 0, /* Deleted the config file */
} virDomainEventUndefinedDetailType;
/**
* virDomainEventStartedDetailType:
*
* Details on the caused of the 'started' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0, /* Normal startup from boot */
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */
} virDomainEventStartedDetailType;
/**
* virDomainEventSuspendedDetailType:
*
* Details on the caused of the 'suspended' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0, /* Normal suspend due to admin pause */
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */
} virDomainEventSuspendedDetailType;
/**
* virDomainEventResumedDetailType:
*
* Details on the caused of the 'resumed' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0, /* Normal resume due to admin unpause */
VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1, /* Resumed for completion of migration */
} virDomainEventResumedDetailType;
/**
* virDomainEventStoppedDetailType:
*
* Details on the caused of the 'stopped' lifecycle event
*/
typedef enum {
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN = 0, /* Normal shutdown */
VIR_DOMAIN_EVENT_STOPPED_DESTROYED = 1, /* Forced poweroff from host */
VIR_DOMAIN_EVENT_STOPPED_CRASHED = 2, /* Guest crashed */
VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3, /* Migrated off to another host */
VIR_DOMAIN_EVENT_STOPPED_SAVED = 4, /* Saved to a state file */
VIR_DOMAIN_EVENT_STOPPED_FAILED = 5, /* Host emulator/mgmt failed */
} virDomainEventStoppedDetailType;
/**
* virConnectDomainEventCallback:
* @conn: virConnect connection
* @dom: The domain on which the event occured
* @event: The specfic virDomainEventType which occured
* @detail: event specific detail information
* @opaque: opaque user data
*
* A callback function to be registered, and called when a domain event occurs
@ -1026,6 +1090,7 @@ typedef enum {
typedef int (*virConnectDomainEventCallback)(virConnectPtr conn,
virDomainPtr dom,
int event,
int detail,
void *opaque);
int virConnectDomainEventRegister(virConnectPtr conn,

View File

@ -1538,6 +1538,7 @@ static int
libvirt_virConnectDomainEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int event,
int detail,
void *opaque)
{
PyObject *pyobj_ret;
@ -1595,9 +1596,10 @@ libvirt_virConnectDomainEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Call the Callback Dispatcher */
pyobj_ret = PyObject_CallMethod(pyobj_conn_inst,
(char*)"dispatchDomainEventCallbacks",
(char*)"Oi",
(char*)"Oii",
pyobj_dom_inst,
event);
event,
detail);
Py_DECREF(pyobj_dom_inst);

View File

@ -190,6 +190,7 @@ int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid);
int remoteRelayDomainEvent (virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int event,
int detail,
void *opaque);
#endif

View File

@ -80,7 +80,8 @@ typedef int (*dispatch_fn) (struct qemud_server *server,
static void
remoteDispatchDomainEventSend (struct qemud_client *client,
virDomainPtr dom,
virDomainEventType event);
int event,
int detail);
/* This function gets called from qemud when it detects an incoming
* remote protocol message. At this point, client->buffer contains
@ -413,15 +414,16 @@ remoteDispatchError (struct qemud_client *client,
}
int remoteRelayDomainEvent (virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
int event,
void *opaque)
virDomainPtr dom,
int event,
int detail,
void *opaque)
{
struct qemud_client *client = opaque;
REMOTE_DEBUG("Relaying domain event %d", event);
REMOTE_DEBUG("Relaying domain event %d %d", event, detail);
if(client) {
remoteDispatchDomainEventSend (client, dom, event);
remoteDispatchDomainEventSend (client, dom, event, detail);
qemudDispatchClientWrite(client->server,client);
}
return 0;
@ -3779,8 +3781,9 @@ remoteDispatchDomainEventsDeregister (struct qemud_server *server ATTRIBUTE_UNUS
static void
remoteDispatchDomainEventSend (struct qemud_client *client,
virDomainPtr dom,
virDomainEventType event)
virDomainPtr dom,
int event,
int detail)
{
remote_message_header rep;
XDR xdr;
@ -3816,7 +3819,8 @@ remoteDispatchDomainEventSend (struct qemud_client *client,
/* build return data */
make_nonnull_domain (&data.dom, dom);
data.event = (int) event;
data.event = event;
data.detail = detail;
if (!xdr_remote_domain_event_ret(&xdr, &data)) {
remoteDispatchError (client, NULL, "%s", _("serialise return struct"));

View File

@ -2033,6 +2033,8 @@ xdr_remote_domain_event_ret (XDR *xdrs, remote_domain_event_ret *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->event))
return FALSE;
if (!xdr_int (xdrs, &objp->detail))
return FALSE;
return TRUE;
}

View File

@ -1135,6 +1135,7 @@ typedef struct remote_domain_events_deregister_ret remote_domain_events_deregist
struct remote_domain_event_ret {
remote_nonnull_domain dom;
int event;
int detail;
};
typedef struct remote_domain_event_ret remote_domain_event_ret;
#define REMOTE_PROGRAM 0x20008086

View File

@ -1011,6 +1011,7 @@ struct remote_domain_events_deregister_ret {
struct remote_domain_event_ret {
remote_nonnull_domain dom;
int event;
int detail;
};
/*----- Protocol. -----*/

View File

@ -198,7 +198,8 @@ virDomainEventCallbackQueuePop(virDomainEventQueuePtr evtQueue)
int
virDomainEventCallbackQueuePush(virDomainEventQueuePtr evtQueue,
virDomainPtr dom,
virDomainEventType event)
int event,
int detail)
{
virDomainEventPtr domEvent;
@ -214,6 +215,7 @@ virDomainEventCallbackQueuePush(virDomainEventQueuePtr evtQueue,
}
domEvent->dom = dom;
domEvent->event = event;
domEvent->detail = detail;
/* Make space on queue */
if (VIR_REALLOC_N(evtQueue->events,

View File

@ -58,7 +58,8 @@ int virDomainEventCallbackListRemove(virConnectPtr conn,
*/
struct _virDomainEvent {
virDomainPtr dom;
virDomainEventType event;
int event;
int detail;
};
typedef struct _virDomainEvent virDomainEvent;
typedef virDomainEvent *virDomainEventPtr;
@ -72,7 +73,8 @@ typedef virDomainEventQueue *virDomainEventQueuePtr;
int virDomainEventCallbackQueuePush(virDomainEventQueuePtr evtQueue,
virDomainPtr dom,
virDomainEventType event);
int event,
int detail);
virDomainEventPtr
virDomainEventCallbackQueuePop(virDomainEventQueuePtr evtQueue);

View File

@ -107,7 +107,8 @@ static int qemudSetNonBlock(int fd) {
static void qemudDomainEventDispatch (struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainEventType evt);
int event,
int detail);
static void qemudDispatchVMEvent(int fd,
int events,
@ -137,13 +138,19 @@ qemudAutostartConfigs(struct qemud_driver *driver) {
unsigned int i;
for (i = 0 ; i < driver->domains.count ; i++) {
if (driver->domains.objs[i]->autostart &&
!virDomainIsActive(driver->domains.objs[i]) &&
qemudStartVMDaemon(NULL, driver, driver->domains.objs[i], NULL) < 0) {
virErrorPtr err = virGetLastError();
qemudLog(QEMUD_ERR, _("Failed to autostart VM '%s': %s\n"),
driver->domains.objs[i]->def->name,
err ? err->message : NULL);
virDomainObjPtr vm = driver->domains.objs[i];
if (vm->autostart &&
!virDomainIsActive(vm)) {
int ret = qemudStartVMDaemon(NULL, driver, vm, NULL);
if (ret < 0) {
virErrorPtr err = virGetLastError();
qemudLog(QEMUD_ERR, _("Failed to autostart VM '%s': %s\n"),
vm->def->name,
err ? err->message : NULL);
} else {
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_BOOTED);
}
}
}
}
@ -945,7 +952,6 @@ static int qemudStartVMDaemon(virConnectPtr conn,
qemudShutdownVMDaemon(conn, driver, vm);
return -1;
}
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_STARTED);
}
return ret;
@ -1030,6 +1036,9 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
static int qemudDispatchVMLog(struct qemud_driver *driver, virDomainObjPtr vm, int fd) {
if (qemudVMData(driver, vm, fd) < 0) {
qemudShutdownVMDaemon(NULL, driver, vm);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FAILED);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains,
vm);
@ -1040,7 +1049,9 @@ static int qemudDispatchVMLog(struct qemud_driver *driver, virDomainObjPtr vm, i
static int qemudDispatchVMFailure(struct qemud_driver *driver, virDomainObjPtr vm,
int fd ATTRIBUTE_UNUSED) {
qemudShutdownVMDaemon(NULL, driver, vm);
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_STOPPED);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains,
vm);
@ -1518,6 +1529,9 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
vm);
return NULL;
}
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_BOOTED);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom) dom->id = vm->def->id;
@ -1548,7 +1562,9 @@ static int qemudDomainSuspend(virDomainPtr dom) {
}
vm->state = VIR_DOMAIN_PAUSED;
qemudDebug("Reply %s", info);
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_SUSPENDED);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
VIR_FREE(info);
return 0;
}
@ -1577,7 +1593,9 @@ static int qemudDomainResume(virDomainPtr dom) {
}
vm->state = VIR_DOMAIN_RUNNING;
qemudDebug("Reply %s", info);
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_RESUMED);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
VIR_FREE(info);
return 0;
}
@ -1616,7 +1634,9 @@ static int qemudDomainDestroy(virDomainPtr dom) {
}
qemudShutdownVMDaemon(dom->conn, driver, vm);
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_STOPPED);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains,
vm);
@ -1947,10 +1967,12 @@ static int qemudDomainSave(virDomainPtr dom,
/* Shut it down */
qemudShutdownVMDaemon(dom->conn, driver, vm);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SAVED);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains,
vm);
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_SAVED);
return 0;
}
@ -2245,6 +2267,10 @@ static int qemudDomainRestore(virConnectPtr conn,
return -1;
}
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_RESTORED);
/* If it was running before, resume it now. */
if (header.was_running) {
char *info;
@ -2257,7 +2283,6 @@ static int qemudDomainRestore(virConnectPtr conn,
vm->state = VIR_DOMAIN_RUNNING;
}
qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_RESTORED);
return 0;
}
@ -2317,6 +2342,7 @@ static int qemudNumDefinedDomains(virConnectPtr conn) {
static int qemudDomainStart(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
virDomainObjPtr vm = virDomainFindByUUID(&driver->domains, dom->uuid);
int ret;
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
@ -2324,7 +2350,13 @@ static int qemudDomainStart(virDomainPtr dom) {
return -1;
}
return qemudStartVMDaemon(dom->conn, driver, vm, NULL);
ret = qemudStartVMDaemon(dom->conn, driver, vm, NULL);
if (ret < 0)
return ret;
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_BOOTED);
return 0;
}
@ -3345,7 +3377,8 @@ qemudDomainEventDeregister (virConnectPtr conn,
static void qemudDomainEventDispatch (struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainEventType evt)
int event,
int detail)
{
int i;
virDomainEventCallbackListPtr cbList;
@ -3359,11 +3392,11 @@ static void qemudDomainEventDispatch (struct qemud_driver *driver,
vm->def->uuid);
if (dom) {
dom->id = virDomainIsActive(vm) ? vm->def->id : -1;
DEBUG("Dispatching callback %p %p event %d",
cbList->callbacks[i],
cbList->callbacks[i]->cb, evt);
DEBUG("Dispatching callback %p %p event %d detail %d",
cbList->callbacks[i],
cbList->callbacks[i]->cb, event, detail);
cbList->callbacks[i]->cb(cbList->callbacks[i]->conn,
dom, evt,
dom, event, detail,
cbList->callbacks[i]->opaque);
virDomainFree(dom);
}
@ -3512,6 +3545,9 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
return -1;
}
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_MIGRATED);
return 0;
}
@ -3544,6 +3580,18 @@ qemudDomainMigratePerform (virDomainPtr dom,
return -1;
}
if (!(flags & VIR_MIGRATE_LIVE)) {
/* Pause domain for non-live migration */
snprintf(cmd, sizeof cmd, "%s", "stop");
qemudMonitorCommand (driver, vm, cmd, &info);
DEBUG ("stop reply: %s", info);
VIR_FREE(info);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
}
if (resource > 0) {
/* Issue migrate_set_speed command. Don't worry if it fails. */
snprintf (cmd, sizeof cmd, "migrate_set_speed %lum", resource);
@ -3583,6 +3631,9 @@ qemudDomainMigratePerform (virDomainPtr dom,
/* Clean up the source domain. */
qemudShutdownVMDaemon (dom->conn, driver, vm);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains, vm);
@ -3617,9 +3668,15 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
VIR_FREE(info);
vm->state = VIR_DOMAIN_RUNNING;
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
return dom;
} else {
qemudShutdownVMDaemon (dconn, driver, vm);
qemudDomainEventDispatch(driver, vm,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FAILED);
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains, vm);
return NULL;

View File

@ -5206,7 +5206,7 @@ remoteRegister (void)
*/
static int
remoteDomainReadEvent(virConnectPtr conn, XDR *xdr,
virDomainPtr *dom, int *event)
virDomainPtr *dom, int *event, int *detail)
{
remote_domain_event_ret ret;
memset (&ret, 0, sizeof ret);
@ -5220,6 +5220,7 @@ remoteDomainReadEvent(virConnectPtr conn, XDR *xdr,
*dom = get_nonnull_domain(conn,ret.dom);
*event = ret.event;
*detail = ret.detail;
return 0;
}
@ -5228,15 +5229,16 @@ static void
remoteDomainProcessEvent(virConnectPtr conn, XDR *xdr)
{
virDomainPtr dom;
int event,i;
int event, detail, i;
struct private_data *priv = conn->privateData;
if(!remoteDomainReadEvent(conn, xdr, &dom, &event)) {
if(!remoteDomainReadEvent(conn, xdr, &dom, &event, &detail)) {
DEBUG0("Calling domain event callbacks (no queue)");
for(i=0 ; i < priv->callbackList->count ; i++) {
if( priv->callbackList->callbacks[i] )
priv->callbackList->callbacks[i]->cb(conn, dom, event,
priv->callbackList->callbacks[i]->opaque);
if (priv->callbackList->callbacks[i] )
priv->callbackList->callbacks[i]->cb(
conn, dom, event, detail,
priv->callbackList->callbacks[i]->opaque);
}
}
}
@ -5245,13 +5247,13 @@ static void
remoteDomainQueueEvent(virConnectPtr conn, XDR *xdr)
{
virDomainPtr dom;
int event;
int event, detail;
struct private_data *priv = conn->privateData;
if(!remoteDomainReadEvent(conn, xdr, &dom, &event))
if(!remoteDomainReadEvent(conn, xdr, &dom, &event, &detail))
{
if( virDomainEventCallbackQueuePush(priv->domainEvents,
dom, event) < 0 ) {
dom, event, detail) < 0 ) {
DEBUG("%s", "Error adding event to queue");
}
}
@ -5344,6 +5346,7 @@ remoteDomainEventQueueFlush(int timer ATTRIBUTE_UNUSED, void *opaque)
priv->callbackList->callbacks[i]->cb(domEvent->dom->conn,
domEvent->dom,
domEvent->event,
domEvent->detail,
user_data);
}
}