[Libvir] Re: Asynchronous notifications of domain start/stop

Richard W.M. Jones rjones at redhat.com
Wed Jul 18 14:45:10 UTC 2007


Daniel P. Berrange wrote:
> Instead we should provide an API which lets application
> register callbacks for adding/removing file handles to an event loop.

Understood ...

> We in fact already have this - look at the src/event.h file. So if we make
> this part of the official public API, then applications merely need provide
> an impl of the virEventAddHandleFunc and virEventRemoveHandleFunc. The 
> underlying libvirt drivers can thus invoke these callbacks as required,
> be it with the XenStored filehandle, a XenAPI filehandle, a libvirtd fd
> or something else. 

If I understand what you're saying here, you are proposing that libvirt 
provides a call like this following (don't worry about specifics):

   virEventDomainNotify (virConnectPtr, int state, void (*f)(...));

The implementation of this call is that it sets up a xenstore watch, and 
registers the xenstore fd with the previously defined 
virEventAddHandleFunc (implemented by the main app / app's event loop code).

When the event happens, xenstore fd gets some data available, app's 
event loop triggers this, and calls into libvirt, which then calls the 
app's callback function ("f").

Is that right?

In the remote case it's more tricky.  What does the remote's callback 
function do when it gets an event?  (This could happen pretty 
asynchronously relative to other communications going on -- eg. in the 
middle of a round of TLS chatter).  Choices seem to be: (1) Send the 
data OOB, unencrypted[1].  (2) Piggy-back the notification on to the 
reply to the next call [not asynchronous].  (3) Try to work out where we 
are in the TLS message and if necessary queue the event up and wait for 
a "safe" place to insert the message in the protocol.  (3) seems fairly 
do-able.

Rich.

[1] TLS 1.1 includes support for OOB data, but it's not really clear if 
GnuTLS supports that.

-- 
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/34c99ef2/attachment-0001.bin>


More information about the libvir-list mailing list