[Libvir] Asynchronous notifications of domain start/stop

Richard W.M. Jones rjones at redhat.com
Wed Jul 18 09:56:42 UTC 2007


I had some private discussions with a developer who wants to start using 
libvirt, but requires asynch notifications of domain start/stop (and 
other stuff, but this will do for the moment).  Right now he's using 
XenStore watches.  The alternative of polling didn't look very appealing 
for him.

A rough API for this might look like this:

typedef int virEventHandle;

/* Register a callback to catch domain start events. */
virEventHandle virEventDomainStart
     (virConnectPtr,
      void (*f) (virConnectPtr, int domid));

/* Register a callback to catch domain stop events. */
virEventHandle virEventDomainStop
     (virConnectPtr,
      void (*f) (virConnectPtr, int domid));

/* Unregister any type of callback. */
int virEventCancel (virConnectPtr, virEventHandle handle);


Implementation
--------------

In the Xen case, we can use XenStore watches[1].  Callbacks from 
XenStore can be translated directly into event callbacks.

In the qemu case, the daemon knows when the qemu instances that it 
manages come and go.

In the qemu/remote case, asynch notifications are nominally supported by 
the protocol, but I haven't really looked at all the implications. 
Seems like we'd need to use MSG_OOB to signal the client process, and 
translate the SIGURG signal received into a callback.  This is all 
tricky and Unix-specific though so if you have any better ideas ...  We 
would also need to avoid mixing ordinary request/response with the 
notifications, which OOB takes care of.

Rich.

[1] http://wiki.xensource.com/xenwiki/XenBusDriver

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070718/aed98a74/attachment-0001.bin>


More information about the libvir-list mailing list