[libvirt] Domain Event Handlers

Noah Zoschke nzoschke at neuraliq.com
Fri May 15 01:43:10 UTC 2009


I have been playing around with the libvirt domain event handlers in  
Python and am seeing something surprising. I am using trunk libvirt  
and `event-test.py` with some more of the debugging strings uncommented.

When I trigger my first event:

virsh # define xppro-sp2-0.img.xml
Domain xppro-sp2-0.img defined from xppro-sp2-0.img.xml

The timeout and handle callbacks are called, but not my  
domainEventRegister handler:

Invoking Timeout CB
Invoking Handle CB

When I trigger a second event:

virsh # create xppro-sp2-0.img.xml
Domain xppro-sp2-0.img created from xppro-sp2-0.img.xml

my event handler for the first event is finally called:

Invoking Timeout CB
domainEventHandler EVENT: Domain xppro-sp2-0.img(-1) Added 1
Invoking Handle CB

Likewise for a third event:

virsh # destroy xppro-sp2-0.img
Domain xppro-sp2-0.img destroyed

Invoking Timeout CB
domainEventHandler EVENT: Domain xppro-sp2-0.img(1) Started 0
Invoking Handle CB

So my handler is always one event behind.

This behavior is not intended is it? Am I missing either something in  
`event-test.py` or in how I am using virsh that would correct this  

Thank you,

More information about the libvir-list mailing list