Hey! 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() However, looking at the source code of virsh, I see that it additional stuff, notably: - virConnectIsAlive() - checking error codes of all calls to check if they are the result of a disconnect Are those steps needed? Randomly checking virConnectIsAlive() doesn't seem reliable. Checking individual error codes either (maybe I will miss one of them or misinterpret another one). virsh code uses those error codes to check if there is a disconnection: (((last_error->code == VIR_ERR_SYSTEM_ERROR) && (last_error->domain == VIR_FROM_REMOTE)) || (last_error->code == VIR_ERR_RPC) || (last_error->code == VIR_ERR_NO_CONNECT) || (last_error->code == VIR_ERR_INVALID_CONN)))) Any hint? -- Program defensively. - The Elements of Programming Style (Kernighan & Plauger) _______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users