[libvirt] Re: Libvir Xen and domain events

I have been looking into registering some domain events though the python Libvir API. However, I am getting errors and I believe it may be due to lack of event support in Xen. This is the error I am getting: libvir: Xen error : this function is not supported by the hypervisor: xenUnifiedDomainEventRegister Traceback (most recent call last): File "./testcallback.py", line 19, in ? conn.domainEventRegister(callback,None) File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1578, in domainEventRegister if ret == -1: raise libvirtError ('virConnectDomainEventRegister () failed', conn=self) libvirt.libvirtError: this function is not supported by the hypervisor: xenUnifiedDomainEventRegister If this lack of support is the case, what would you recommend is the best route for catching domain events? Currently, I am thinking of just polling regularly and monitoring for changes in domain state. Cheers. Chris Pyper. P.S. Libvir is awesome.

On Fri, Oct 09, 2009 at 06:46:40PM -0400, Christopher Pyper wrote:
I have been looking into registering some domain events though the python Libvir API. However, I am getting errors and I believe it may be due to lack of event support in Xen. This is the error I am getting:
libvir: Xen error : this function is not supported by the hypervisor: xenUnifiedDomainEventRegister Traceback (most recent call last): File "./testcallback.py", line 19, in ? conn.domainEventRegister(callback,None) File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1578, in domainEventRegister if ret == -1: raise libvirtError ('virConnectDomainEventRegister () failed', conn=self) libvirt.libvirtError: this function is not supported by the hypervisor: xenUnifiedDomainEventRegister
The Xen driver does support events. I think this is probably a misleading error message which in fact is trying to tell you that you need to provide an event loop first. Take a look at examples/domain-events/events-py.py for a good example of how to use events. I've not tested it with Xen recently, but it ought to work 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 :|

Daniel, Thanks for the fast response. I have actually tried the script you were referring too, and it was actually the basis of my tests. I can't get the script to function either: [root@node1 pyper]# python Python 2.4.3 (#1, Jul 27 2009, 17:56:30) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import libvirt vc = libvirt.open('xen:///') vc.getFreeMemory() 7521595392L vc.listDomainsID() [0, 4, 33, 44, 46, 47, 48]
[root@node1 pyper]# ./event-test.py xen:/// Using uri:xen:/// Traceback (most recent call last): File "./event-test.py", line 93, in myRemoveHandle mypoll.unregister(h_fd) KeyError: 0 Traceback (most recent call last): File "./event-test.py", line 93, in myRemoveHandle mypoll.unregister(h_fd) KeyError: 0 Traceback (most recent call last): File "./event-test.py", line 93, in myRemoveHandle mypoll.unregister(h_fd) KeyError: 0 . . . .
Although, it does run fine with the default URI of qemu:///, it does not catch any events when I test. The physical server I am testing on works great, and has many virtual domains running on it. I am able to use -- and have used -- Libvirt every way imaginable to manipulate those virtual domains. Everything works fine with the Libvirt Python API and Xen, with the exception of event handling. Cheers. Chris Pyper On 2009-10-12, at 7:29 AM, Daniel P. Berrange wrote:
On Fri, Oct 09, 2009 at 06:46:40PM -0400, Christopher Pyper wrote:
I have been looking into registering some domain events though the python Libvir API. However, I am getting errors and I believe it may be due to lack of event support in Xen. This is the error I am getting:
libvir: Xen error : this function is not supported by the hypervisor: xenUnifiedDomainEventRegister Traceback (most recent call last): File "./testcallback.py", line 19, in ? conn.domainEventRegister(callback,None) File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1578, in domainEventRegister if ret == -1: raise libvirtError ('virConnectDomainEventRegister () failed', conn=self) libvirt.libvirtError: this function is not supported by the hypervisor: xenUnifiedDomainEventRegister
The Xen driver does support events. I think this is probably a misleading error message which in fact is trying to tell you that you need to provide an event loop first.
Take a look at examples/domain-events/events-py.py for a good example of how to use events. I've not tested it with Xen recently, but it ought to work
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 :|
participants (2)
-
Christopher Pyper
-
Daniel P. Berrange