[libvirt-users] Lifecycle of a connection to libvirtd
Vincent Bernat
bernat at luffy.cx
Fri Aug 26 18:54:01 UTC 2016
❦ 24 juillet 2016 23:13 CEST, Vincent Bernat <bernat at luffy.cx> :
> I am trying to figure out how to reliably maintain a connection to
> libvirtd. From the documentation, I would expect something like that:
>
> - virConnectOpen()
> - virConnectRegisterCloseCallback()
> - virConnectSetKeepAlive()
> - Application logic
>
> And in the registered callback, I would:
>
> - virConnectUnregisterCloseCallback()
> - virConnectClose()
> - virConnectOpen()
> - virConnectRegisterCloseCallback()
> - virConnectSetKeepAlive()
Well, I am now doing that and it doesn't work as expected. If the
connection is unexpectedly disconnected, I get an error when calling
virConnectUnregisterclosecallback():
[Code-55] [Domain-20] Requested operation is not valid: A different callback was requested
If I don't unregister the callback, virConnectClose() indicates a leak.
The same happens for domain events. If the connection is closed
unexpectedly, I get:
[Code-1] [Domain-7] internal error: client socket is closed
I am not even sure that I don't get a leak whatever I do about since I
don't see anything that would unset the callbacks when the connection is
closed (while this happens for close callback).
I see that virsh has the same problem. If I restart libvirt while
connected, I get a "One or more references were leaked after disconnect
from the hypervisor".
--
Tempt not a desperate man.
-- William Shakespeare, "Romeo and Juliet"
More information about the libvirt-users
mailing list