[libvirt-users] How to tell if a hypervisor connection has died?

Daniel P. Berrange berrange at redhat.com
Thu Apr 25 19:25:38 UTC 2013


On Thu, Apr 25, 2013 at 07:49:02PM +0200, Guido Winkelmann wrote:
> Hi,
> 
> What's the best way to tell if a virConnect object is not good to use anymore? 
> (For example because the libvirtd on the other side crashed/has been stopped 
> or because of some network failure)
> 
> When I try this, the first API call I do on a broken connection yields an 
> error with error number 38 (VIR_ERR_SYSTEM_ERROR) and all subsequent calls 
> yield an error number 1 (VIR_ERR_INTERNAL_ERROR). Both of those are really 
> unhelpful and could mean just about anything...

Use the virConnectRegisterCloseCallback API to register a callback. This
will be invoked when the connection is closed for any reason.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list