On Sat, Sep 09, 2023 at 02:57:53PM +0100, Richard W.M. Jones wrote:
> Example after applying this patch:
> 
>   $ ./nbdkit -fv --port 9999 -e foo null 1M
>   /home/rjones/d/nbdkit/server/nbdkit -f -v --port=9999 -e foo -- 
> /home/rjones/d/nbdkit/plugins/null/.libs/nbdkit-null-plugin.so 1M
>   nbdkit: debug: nbdkit 1.35.12
>   nbdkit: debug: TLS disabled: could not load TLS certificates
>   nbdkit: debug: NBD URI: nbd://localhost:9999/foo
> 
> An alternative I considered was adding a --print-uri option which
> would print the URI on stdout.  Maybe we could do this as an
> alternative later.  Normally the server does not print anything on
> stdout, and it is problematic in some modes, like when using -s.

Yeah, we'd have to print to stderr, even though it is informative.  I
don't think we'll need a --print-uri option in the short term, but as
you mention, it's always something we can add later if need arises.

> ---
>  server/main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/server/main.c b/server/main.c
> index 54eb348ba..0c9019d94 100644
> --- a/server/main.c
> +++ b/server/main.c
> @@ -637,6 +637,8 @@ main (int argc, char *argv[])
>     * Note this may be NULL.
>     */
>    uri = make_uri ();
> +  if (uri)
> +    debug ("NBD URI: %s", uri);

Reviewed-by: Eric Blake <ebl...@redhat.com>

Do we also want to output a debug statement when a URI is not
possible, such as under -s?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to