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? Resolves: https://issues.redhat.com/browse/RHEL-700 Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- src/remote/remote_sockets.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index c21970cd31e7..0c0e31e4eb78 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -311,6 +311,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, g_autofree char *daemon_name = NULL; g_autofree char *direct_sock_name = NULL; g_autofree char *legacy_sock_name = NULL; + g_autofree char *default_socket = NULL; #ifdef REMOTE_DRIVER_AUTOSTART_DIRECT g_autofree char *guessdriver = NULL; #endif @@ -345,7 +346,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, } else { if (remoteProbeSystemDriverFromSocket(flags & REMOTE_DRIVER_OPEN_RO, &guessdriver, - NULL) < 0) + &default_socket) < 0) return NULL; } driver = guessdriver; @@ -404,8 +405,14 @@ remoteGetUNIXSocket(remoteDriverTransport transport, } if (!direct_sock_name) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("Cannot use direct socket mode if no URI is set")); + if (default_socket) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("Cannot connect to '%1$s' and no URI is set, is any virt daemon or systemd socket unit started?"), + default_socket); + } else { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Cannot use direct socket mode if no URI is set")); + } return NULL; } -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx