[PATCH v2 5/8] virt-ssh-helper: Accept ?socket= in connection URI

Peter Krempa pkrempa at redhat.com
Wed Feb 8 15:46:54 UTC 2023


On Wed, Feb 08, 2023 at 16:19:11 +0100, Michal Privoznik wrote:
> Similarly to the previous commit, let's accept "socket" parameter
> in the connection URI. This change will allow us to use
> virt-ssh-helper instead of 'nc' in all cases (done in one of
> future commits).
> 
> Please note, when the parameter is used it effectively disables
> automatic daemon spawning and an error is reported. But this is
> intentional - so that the helper behaves just like regular
> virConnectOpen() with different transport than ssh, e.g. unix.
> 
> But this 'change' is acceptable - there's no way for users to
> make our remote code pass the argument to virt-ssh-helper, yet.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/remote/remote_ssh_helper.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)

[....]

> @@ -447,11 +450,12 @@ int main(int argc, char **argv)
>          exit(EXIT_FAILURE);
>      }
>  
> -    sock_path = remoteGetUNIXSocket(transport,
> -                                    mode,
> -                                    driver,
> -                                    flags,
> -                                    &daemon_path);
> +    if (!sock_path &&
> +        !(sock_path = remoteGetUNIXSocket(transport, mode,
> +                                          driver, flags, &daemon_path))) {
> +        g_printerr(_("%s: failed to generate UNIX socket path"), argv[0]);

This made me wonder how errors were reported until now, but I didn't
really manage to make it report an error.

Anyways:

Reviewed-by: Peter Krempa <pkrempa at redhat.com>


More information about the libvir-list mailing list