-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
21.08.2013 09:46, Alexandr пишет:
21.08.2013 09:32, Martin Kletzander пишет:
> On Wed 21 Aug 2013 01:03:37 AM CEST, Alexandr wrote:
>>
>> good day. i trying to make callback function for
>> VIR_DOMAIN_EVENT_ID_LIFECYCLE, i have successfully registering
>> callback, but it never called, i need to know when domain
>> started, stopped or crashed, i have write following code
>>
>> static int domain_event_handler(virConnectPtr conn,
>> virDomainPtr dom, int event, int detail, void * opaque) {
>> switch(event) { } return 0; }
>>
>> ..... 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; } .....
>>
>>
>> but "domain_event_handler" is never called, what is wrong here
>> ?
> Are you running an event loop? You can have a look at our
> examples [1] and see what's being done there. Especially note
> the virEventRunDefaultImpl() [2] there.
> Martin
> [1]
>
http://libvirt.org/git/?p=libvirt.git;a=blob;f=examples/domain-events/eve...
>
[2]
>
http://libvirt.org/git/?p=libvirt.git;a=blob;f=examples/domain-events/eve...
>
oh..., i missed it, thx for hint and sorry for stupid questions .
_______________________________________________ libvirt-users
mailing list libvirt-users(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users
now it's working except for events from other connections, for example
i want to handle domain started by virt-manager, now i do not have
event when it's started, is exists any api to handle this events, or i
need to implement internal polling of domains state in my application ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -
http://www.enigmail.net/
iQEcBAEBAgAGBQJSFIoGAAoJEH3ap8veG8EHD3kIALAivHCNxKX6WN99MRbQQcUb
wLuZL1DALOrRr0YEI5fm+rWGb2nYJjMrkRGTmD1/sW7oGLfYz9hzEj3f6vnOOkH+
DlfNU8Td7ssPicIBhNrKXqDF/1OebImCcYivEVEyhNigwoSIjJ8Y3KkON9TO7jc1
pu8POIoxG/7nBuxaNBlaBioLx8QwGtFG0fWU2UhTK63dVVTjCqTwI5STHugAAQhf
ws3xJxkeLKbtDajaIvgzh5oZ/4zHNEeViviR2qW4VqHq1MWiOkj1T8Q4sGzSzpLe
5ALXdVjnUfPxMI3szrz80XuqEyRR0CrHEfoz8dnWaR2s84B7gfwu7oV/TdJnIts=
=lJBr
-----END PGP SIGNATURE-----