On 14.10.2013 02:42, Alexandr wrote: > good day to all. > i still have not solved my problem with event handling. > currently i have following code > > > void libvirt_eventloop_thr_func() > { > while(true) //TODO: stop somehow on exit > { > if(virEventRunDefaultImpl() < 0) > { > virErrorPtr err = virGetLastError(); > fprintf(stderr, "Failed to run event loop: %s\n", err && > err->message ? err->message : "Unknown error"); > } > } > } > > > > ... > > virSetErrorFunc(NULL, libvirt_error_handler); > libvirt_connection = virConnectOpen("qemu:///system"); Move this line ^^^ ... > if (virEventRegisterDefaultImpl() < 0) > { > virErrorPtr err = virGetLastError(); > fprintf(stderr, "Failed to register event implementation: %s\n", > err && err->message ? err->message: "Unknown error"); > return -1; > } > { > int callback = > virConnectDomainEventRegisterAny(libvirt_connection, NULL, > VIR_DOMAIN_EVENT_ID_LIFECYCLE, > VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL); > if(callback == -1) > { > std::cout<<"Error: failed to register domain event handle > callback\n"; > return -1; > } > } > > boost::thread(boost::bind(&libvirt_eventloop_thr_func)); ... over here. The virConnectOpen detects if there's an even loop registered. And in your case you don't have any registered when calling it. Michal _______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users