The following patch series implements the Events API discussed here previously in this
thread:
http://www.redhat.com/archives/libvir-list/2008-September/msg00321.html
This is a rather large patch, and touches quite a few files, but in the end, accomplishes
the goal of event delivery of notificaton of domain events.
It does so in a manner that is able to co-exist with older clients, or older libvirtd
implementations.
In the former case, events will never be delivered to a client that does not request
them.
In the latter case, we will fail registration, and so events will not be available.
I have broken this up into 3 patches in the following manner:
1/3 - events.patch
This is the bulk of the work. It emits, and delivers events to clients that are
supported, and have registered to recieve the events.
2/3 - events-xen.patch
These changes are currently untested (as I did my development with KVM), but are the
changes that will be necessary to monitor xenstore for changes in domain states
3/3 - events-test.patch
This is a test harness implemented to receive (and print) when domain events occur. I
was unsure where this should live in the tree - so it currently is an independant patch
(.c and Makefile in its own dir)
Please note that I have not yet made any effort to generate any Python, or Java bindings,
but wanted to get this out on the list first.
NOTES:
Thread safeness:
We know that there are 2 data structures that need protection against concurrent access
_virDriver.conns and
_virConnect.domainEventCallbacks
However, we have not addressed these issues at this juncture.
We are considering recursive mutexes (specifically making conn->lock one) to avoid
deadlocks in a vir* call from within a callback. We plan on addressing this with the next
version of this code, after addressing any other issues the list may come up with, as
well.