[libvirt-users] Event&Callback in QEMU

Hi buddy, I wanna to monitor a domain's life cycle event, so i register a event an a virConnectDomainEventCallback, the code segment is as below: ------------------------ int DomainEventCallback(virConnectPtr conn, virDomainPtr dom, int event, int detail, void * opaque){ /*My code */ ....... } int main(){ /* .....*/ virDomainPtr dom = domain.getDomains("xp"); virFreeCallback freecb = NULL; void *opaque =NULL; virConnectDomainEventCallback cb =DomainEventCallback; virConnectDomainEventRegisterAny(conn, dom, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK(cb),opaque,freecb); /* .....*/ } but such a error happened: libvir: Remote error : this function is not supported by the connection driver: no event support and the libvirt version is 0.9; the driver is QEMU-KVM ,version is 0.14.0. I want to know why this Error will happen? Is the QEMU not support the LIFECYCLE Event ? If it is , how can i monitor the domain's life cycle event( such as started,defined and stopped..) Pls help~~

On Fri, Nov 04, 2011 at 11:42:00AM +0800, huachao yao wrote:
Hi buddy, I wanna to monitor a domain's life cycle event, so i register a event an a
virConnectDomainEventCallback, the code segment is as below:
------------------------ int DomainEventCallback(virConnectPtr conn, virDomainPtr dom, int event, int detail, void * opaque){ /*My code */ ....... }
int main(){
/* .....*/ virDomainPtr dom = domain.getDomains("xp"); virFreeCallback freecb = NULL; void *opaque =NULL; virConnectDomainEventCallback cb =DomainEventCallback; virConnectDomainEventRegisterAny(conn, dom, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK(cb),opaque,freecb); /* .....*/ }
but such a error happened: libvir: Remote error : this function is not supported by the connection driver: no event support
and the libvirt version is 0.9; the driver is QEMU-KVM ,version is 0.14.0.
I want to know why this Error will happen? Is the QEMU not support the LIFECYCLE Event ? If it is , how can i monitor the domain's life cycle event( such as started,defined and stopped..)
This means you have not registered any event loop implementation. Take a look at examples/domain-events/events-c/event-test.c for a good example of how to deal with the events APIs. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
huachao yao