On Wed, Dec 13, 2023 at 11:04:54AM +0000, John Levon wrote: > > These two functions are currently private to libvirt, hence not available to > consumers. Would it be possible to make them public? Without them, there's no > way to do any libvirt call without stomping on an existing error that you may > want to preserve. > > I have multiple threads sharing a remote connection (to local libvirtd). I need > to be able to handle connection drops (e.g. libvirtd restart). Long story short, > the only approach I've found that actually works properly is that there's one > main conn object, each thread has a virConnectRef() to it, and whenever a thread > gets an error, we check in the error callback if !virConnectIsAlive(). If so, we > close the thread's conn, and potentially also clean up the main conn. Is there a real need to call virConnectIsAlive synchronously after every API error scenario ? That is going to be checking for libvirtd restart both too frequently, and at the same time, not frequently enough - ie you don't detect the libvirtd restart until after the next time you make an API call If you use the virConnectRegisterCloseCallback() method, you should get notified of the connection drop at precisely the right time, every time, regardless of whether you happen to be making an API call at the time. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx