Re: [PATCH 1/2] Report first tried socket from remoteProbeSystemDriverFromSocket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 28, 2023 at 01:02:39PM +0100, Martin Kletzander wrote:
> This will improve an error message later on.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/remote/remote_daemon_dispatch.c |  2 +-
>  src/remote/remote_sockets.c         | 11 +++++++++--
>  src/remote/remote_sockets.h         |  2 +-
>  3 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
> index 7daf503b517a..497469e80657 100644
> --- a/src/remote/remote_daemon_dispatch.c
> +++ b/src/remote/remote_daemon_dispatch.c
> @@ -2015,7 +2015,7 @@ remoteDispatchProbeURI(bool readonly,
>  
>          suffix = "session";
>      } else {
> -        if (remoteProbeSystemDriverFromSocket(readonly, &driver) < 0)
> +        if (remoteProbeSystemDriverFromSocket(readonly, &driver, NULL) < 0)
>              return -1;
>  
>          suffix = "system";
> diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c
> index 4ab3d72933e2..c21970cd31e7 100644
> --- a/src/remote/remote_sockets.c
> +++ b/src/remote/remote_sockets.c
> @@ -204,7 +204,7 @@ remoteProbeSessionDriverFromBinary(char **driver)
>  
>  
>  int
> -remoteProbeSystemDriverFromSocket(bool readonly, char **driver)
> +remoteProbeSystemDriverFromSocket(bool readonly, char **driver, char **first_socket)
>  {
>      /* Order these the same as virDriverLoadModule
>       * calls in daemonInitialize, so we replicate
> @@ -232,6 +232,9 @@ remoteProbeSystemDriverFromSocket(bool readonly, char **driver)
>      };
>      ssize_t i;
>  
> +    if (first_socket)
> +        *first_socket = NULL;
> +
>      for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers); i++) {
>          g_autofree char *sockname =
>              g_strdup_printf("%s/libvirt/virt%sd-%s", RUNSTATEDIR,
> @@ -243,6 +246,9 @@ remoteProbeSystemDriverFromSocket(bool readonly, char **driver)
>              return 0;
>          }
>  
> +        if (first_socket && !*first_socket)
> +            *first_socket = g_steal_pointer(&sockname);
> +
>          VIR_DEBUG("Missing sock %s for driver %s", sockname, drivers[i]);
>      }
>  
> @@ -338,7 +344,8 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
>                  return NULL;
>          } else {
>              if (remoteProbeSystemDriverFromSocket(flags & REMOTE_DRIVER_OPEN_RO,
> -                                                  &guessdriver) < 0)
> +                                                  &guessdriver,
> +                                                  NULL) < 0)
>                  return NULL;
>          }
>          driver = guessdriver;
> diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h
> index 00e654d46c2a..6505639c92a3 100644
> --- a/src/remote/remote_sockets.h
> +++ b/src/remote/remote_sockets.h
> @@ -65,7 +65,7 @@ remoteSplitURIScheme(virURI *uri,
>  int
>  remoteProbeSessionDriverFromBinary(char **driver);
>  int
> -remoteProbeSystemDriverFromSocket(bool readonly, char **driver);
> +remoteProbeSystemDriverFromSocket(bool readonly, char **driver, char **first_socket);
>  int
>  remoteProbeSessionDriverFromSocket(bool readonly, char **driver);
>  

Reviewed-by: Richard W.M. Jones <rjones@xxxxxxxxxx>



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux