libvirt remote uri format

Andrea Bolognani abologna at redhat.com
Mon Apr 6 08:45:49 UTC 2020


On Fri, 2020-04-03 at 19:37 -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://myuser@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://myuser@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.
> 
> remote host is ubuntu 20.04 running libvirtd (libvirt) 6.0.0 under systemd

Is the client machine running macOS by any chance?

There is a long-standing issue where that platform will use different
paths for certain resources, including the libvirtd socket, and the
way it currently works is that the default socket path is chosen by
the client, so any mismatch will result in something like the above.

The plan is to replace our use of nc with a custom virt-nc helper
that will link against libvirt on the host side and will thus be able
to use the default socket path appropriate for the system; however,
as far as I'm aware nobody is currently working on it.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvirt-users mailing list