[libvirt] Help needed: simple python api to obtain events
Daniel P. Berrange
berrange at redhat.com
Wed Oct 7 10:05:36 UTC 2009
On Tue, Oct 06, 2009 at 07:04:29PM +0200, Dan Kenigsberg wrote:
> Would someone help me have a shrink-wrapped solution for obtaining libvirt
> events in python?
>
> I'm looking for a python module with no API calls (or maybe just a few).
>
> I'd like to register a callback functions with
> virConnect.domainEventRegister(), and want them to be called in the
> context of a specialized (automatically-created?) thread. I don't mind
> if the module has two API calls instead: register() and
> startPollThread().
>
> I learned that it takes me far too long to do it on my own, and that just
> modifying events-python.py (attached) reaches miserable outcomes
> ("libvir: Domain error : invalid domain pointer in virDomainFree", and
> deadlocked python:
> #0 0x00000037fe40d174 in __lll_lock_wait () from /lib64/libpthread.so.0
> #1 0x00000037fe408aca in _L_lock_1034 () from /lib64/libpthread.so.0
> #2 0x00000037fe40898c in pthread_mutex_lock () from /lib64/libpthread.so.0
> #3 0x0000003cce04db84 in remoteDomainEventFired ()
> #4 0x00002b4cc96e1612 in libvirt_virEventInvokeHandleCallback ()
> )
>
> Help most welcome,
After discussions on IRC, it turns out that this is being seen with the
libvirt 0.6.3 release, which had known-broken events code in the python
bindings. It did not do correct locking, or reference counting. The
current libvirt python works with Dan's demo program.
Daniel
--
|: Red Hat, Engineering, London -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