On Fri, Apr 03, 2020 at 07:37:19PM -0500, Joe Muro wrote: > > Hi, > > I am using python libvirt api to get domain information. When using a uri > without specifying the socket path, an error occurs. > > uri = "qemu+ssh://myu...@some.kvm.host/system" > conn = libvirt.open(uri) > > This results in the following: > > libvirt: XML-RPC error : internal error: received hangup event on socket > > If I append the socket path to the URI, it works. e.g. > > qemu+ssh://myu...@some.kvm.host/system?socket=/var/run/libvirt/libvirt-sock > > Is this the recommended way to construct an ssh uri? My concern is that the > socket path may be different when connecting to different libvirt hosts.
Generally you should *not* need to specify the socket path. The libvirt client will attempt to use the same socket path on the remote host, as it would use on the source host. Note that this assumes that libvirt was built with the same set of --prefix, --localstatedir, --rundir options on both hosts. If that is not the case, then the socket must be given explicitly. 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 :|