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
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list