[libvirt-users] virConnectIsAlive

Ján Tomko jtomko at redhat.com
Tue Oct 17 08:15:13 UTC 2017


On Tue, Oct 17, 2017 at 01:51:57PM +0800, llilulu wrote:
>Hi
>    In my program , When libvirtd restart , the old libvirtd connection(virConnectPtr) has to reconnect, Before usr old virConnectPtr , I call virConnectIsAlive. but when I restart libvirtd , virConnectIsAlive return 1, and I continue other operate use the old virConnectPtr, program will receive signal pipe.
>    I use libvirt event. before any api use, I call virEventRegisterDefaultImpl, and run virEventRunDefaultImpl. then use virConnectIsAlive, when I restart libvirtd, virConnectIsAlive will return 0, I want know how to use virConnectIsAlive, if virConnectIsAlive use  keep alive message, what default the interval and count.

Hi,

using virConnectIsAlive without running an event loop is pointless.
It only tells you about the state of virConnectPtr's internal data
and this state changes after the event loop processes it:
https://libvirt.org/html/libvirt-libvirt-event.html#virEventRegisterDefaultImpl

By default the daemon does send keepalive messages (and the client needs
to run the event loop to process them), to send keepalive messages
from the client you need to call virConnectSetKeepAlive:
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectSetKeepAlive

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20171017/f5f69578/attachment.sig>


More information about the libvirt-users mailing list