Re: [Libguestfs] [PATCH nbdkit 05/10] server: Add the NBD URI to debug output

2023-09-11 Thread Richard W.M. Jones
On Mon, Sep 11, 2023 at 09:04:13AM -0500, Eric Blake wrote:
> Do we also want to output a debug statement when a URI is not
> possible, such as under -s?

Yes, I'll add something for those two cases.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



Re: [Libguestfs] [PATCH nbdkit 05/10] server: Add the NBD URI to debug output

2023-09-11 Thread Eric Blake
On Sat, Sep 09, 2023 at 02:57:53PM +0100, Richard W.M. Jones wrote:
> Example after applying this patch:
> 
>   $ ./nbdkit -fv --port  -e foo null 1M
>   /home/rjones/d/nbdkit/server/nbdkit -f -v --port= -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:/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 

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



[Libguestfs] [PATCH nbdkit 05/10] server: Add the NBD URI to debug output

2023-09-09 Thread Richard W.M. Jones
Example after applying this patch:

  $ ./nbdkit -fv --port  -e foo null 1M
  /home/rjones/d/nbdkit/server/nbdkit -f -v --port= -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:/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.
---
 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);
 
   /* The remaining command line arguments are the plugin name and
* parameters.  If --help, --version or --dump-plugin were specified
-- 
2.41.0

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs