
On Tue, Jun 07, 2011 at 03:01:57PM +0200, Jiri Denemark wrote:
The API can be used to query current state of an interface to VMM used to control a domain. In QEMU world this translates into monitor connection. [...] diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index df213f1..1454ca0 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -141,6 +141,43 @@ typedef enum { VIR_DOMAIN_CRASHED_UNKNOWN = 0, /* crashed for unknown reason */ } virDomainCrashedReason;
+ +/** + * virDomainControlState: + * + * Current state of a control interface to the domain. + */ +typedef enum { + VIR_DOMAIN_CONTROL_OK = 0, /* operational, ready to accept commands */ + VIR_DOMAIN_CONTROL_JOB = 1, /* background job is running (can be + monitored by virDomainGetJobInfo); only + limited set of commands may be allowed */ + VIR_DOMAIN_CONTROL_OCCUPIED = 2, /* occupied by a running command */ + VIR_DOMAIN_CONTROL_ERROR = 3, /* unusable, domain cannot be fully operated */ +} virDomainControlState; + +/** + * virDomainControlInfo: + * + * Structure filled in by virDomainGetControlInfo and providing details about + * current state of control interface to a domain. + */ +typedef struct _virDomainControlInfo virDomainControlInfo; +struct _virDomainControlInfo { + unsigned int state; /* control state, one of virDomainControlState */ + unsigned int details; /* state details, currently 0 */ + unsigned long long stateTime; /* for how long (in msec) control interface + has been in current state (except for OK + and ERROR states) */ +}; + +/** + * virDomainControlInfoPtr: + * + * Pointer to virDomainControlInfo structure. + */ +typedef virDomainControlInfo *virDomainControlInfoPtr; + /** * virDomainModificationImpact: * @@ -781,6 +818,9 @@ int virDomainGetState (virDomainPtr domain, int *state, int *reason, unsigned int flags); +int virDomainGetControlInfo (virDomainPtr domain, + virDomainControlInfoPtr info, + unsigned int flags);
that's really the "meat" of that patchset, it looks fine, ACK from me but since you intent a v2 don't commit right now :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/