On Tue, Nov 28, 2023 at 13:22:47 +0000, Daniel P. Berrangé wrote:
On Tue, Nov 28, 2023 at 01:02:40PM +0100, Martin Kletzander wrote:
> Before this patch users might be confused with the error when no daemon
> nor systemd socket unit is running due to the error message being a bit
> vague when running as root with no URI:
>
> # virsh list
> error: failed to connect to the hypervisor
> error: Operation not supported: Cannot use direct socket mode if no
> URI is set
>
> Instead of merely suggesting to start any daemon, also give a hint as to
> what socket we have tried looking up:
>
> # virsh list
> error: failed to connect to the hypervisor
> error: Operation not supported: Cannot connect to
> '/var/run/libvirt/virtqemud-sock' and no URI is set, is any virt
> daemon or systemd socket unit started?
As Peter points out, this is a misleading message because it is
arbitrarily reporting the first compiled in driver, which may
be no resemblance to what the user was expecting to run. I think
Exactly. E.g. on Fedora and other distros which enable most features
you'd get:
error: Operation not supported: Cannot connect to
'/var/run/libvirt/virtxend-sock' and no URI is set, is any virt daemon or systemd
socket unit started?
And running xen is not what most users want to do when they install
libvirt.
we should not include the sock path here, but we could include
the sock *directory*, as that would help diagnose when someone
built with the wrong install prefix, eg
"No active daemon socket found in /var/run/libvirt, and no
URI is set. Is any libvirt daemon or socket unit started ?"
This sounds much better. I also don't think we should be putting any
command examples here as suggested by Rich as there isn't a good default
value we could use because of exactly the same reason.