On Sat, May 10, 2008 at 06:53:29PM +0200, Stefan de Konink wrote:
On Sat, 10 May 2008, Daniel P. Berrange wrote:
> I don't believe it is possible to distinguish shutdown vs destroy reliably.
If it was initiated by libvirt itself, I guess we can fire it after we
suddenly miss the domain. Destroy would be a direct miss that isn't marked
as crashed. (directly leads to the question: does libvirt clean up crashed
states?)
> In the absence of this support in libvirt you can infer events by periodically
> sampling virDomainGetInfo and tracking changes in the state - though of
> course you can miss some intermediate states. This is what virt-manager does
> for event tracking.
I was thinking about implementing this TODO...
The problem with that TODO (apart the fact it's probably here for 2 years)
is that it means adding some kind of asynchronous interfaces, then you
get into the problem of hooking in the process main loop, and doing
that from a library in a clean way is not trivial. Also we wanted to see
if we really needed this, and up to now reasonable polling is good enough
for the apps and tools we needed to build (this is also linked to the fact
we tried to keep the virDomainGetInfo a very fast operation at least locally).
I would be quite happy to never cross that TODO item and found out it's
never really needed (asynch programming is bad for your health !)
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/