On Fri, Sep 19, 2008 at 10:54:39AM +0100, Daniel P. Berrange wrote:
Against a virConnectPtr object I'd expect to be able to register
to get an event upon
- A new domain object coming into existance
- A existing domain object going out of existance
So, you could register a callback, call Rich's virConnectListAllDomains()
once, and then rely on the callbacks from that point onwards to keep
your list of domains up2date. So in case of listening for domains:
Just a remark but unfortunately that scheme forces a race between
the start of the event flow and the return of the list. The way used in
the file monitoring API (FAM which I dislike but at least fixed that problem)
is that when you register you get a flow of initial events allowing
to setup your list of object. Certainly less efficient than single
synchronous call but avoid the race. The user code is also simpler
because you only use the events to maintain your state.
Performance vs. accuracy , the balance is still open for long lived
objects like domains though, but as virtualization gets integrated and
efficient maybe it's better to play safe.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/