[libvirt] Event on domain state change

Daniel P. Berrange berrange at redhat.com
Sat May 10 16:40:58 UTC 2008


On Sat, May 10, 2008 at 06:12:23PM +0200, Stefan de Konink wrote:
> Hi,
> 
> In the TODO list I find this line:
> 
> - event on big domain state change (create, crashed, paused, shutdown,
> destroy)
> 
> 
> Because this is a feature that is very useful, I first wonder how libvirt
> reliably get 'events' itself for example from Xen? From what I can read
> from xen_internal there is a xenHypervisorGetDomInfo function, but this
> function should be scheduled in order to see event changes. Even if so,
> can we be 'quick' enough to detect a destroy? Or determine the difference
> between a shutdown and a destroy?

I don't believe it is possible to distinguish shutdown vs destroy reliably.

For QEMU we can trivially get 'events' for create/paused/destroy etc since
we're in direct control of QEMU. 

Xen is a little more tricky - we'd have to register watches against xenstore
to get events back.


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.


Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list