Guido Winkelmann
2013-Apr-25 17:49 UTC
[libvirt-users] How to tell if a hypervisor connection has died?
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... Guido
Eric Blake
2013-Apr-25 18:04 UTC
[libvirt-users] How to tell if a hypervisor connection has died?
On 04/25/2013 11:49 AM, 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)Try using virConnectIsAlive(). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 621 bytes Desc: OpenPGP digital signature URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130425/c91f9557/attachment.sig>
Daniel P. Berrange
2013-Apr-25 19:25 UTC
[libvirt-users] How to tell if a hypervisor connection has died?
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 :|