Eric Blake
2018-Nov-28 19:39 UTC
[Libguestfs] [nbdkit PATCH] connections: Be less noisy when client sends NBD_OPT_ABORT
At least 'nbd-client -l localhost' is a good demonstration of a client that legitimately sends NBD_OPT_ABORT - it exists only to enumerate the exports advertised by the server, rather than intending to connect to any of those exports. As such, we should downgrade the message for a client telling us it is going away to the same status as our debug message for NBD_CMD_DISC, given that the two have the same effect at different points in the protocol. This stops nbdkit from spamming stderr with nbdkit: file[1]: error: client sent NBD_OPT_ABORT to abort the connection messages due to a client that doesn't want to connect after all. Signed-off-by: Eric Blake <eblake@redhat.com> --- Found while implementing a similar 'qemu-nbd --list' that is nicer than nbd-client's version ;) src/connections.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections.c b/src/connections.c index e1ffeff..1b40e46 100644 --- a/src/connections.c +++ b/src/connections.c @@ -705,7 +705,7 @@ _negotiate_handshake_newstyle_options (struct connection *conn) case NBD_OPT_ABORT: if (send_newstyle_option_reply (conn, option, NBD_REP_ACK) == -1) return -1; - nbdkit_error ("client sent NBD_OPT_ABORT to abort the connection"); + debug ("client sent NBD_OPT_ABORT to abort the connection"); return -1; case NBD_OPT_LIST: -- 2.17.2
Richard W.M. Jones
2018-Nov-28 19:52 UTC
Re: [Libguestfs] [nbdkit PATCH] connections: Be less noisy when client sends NBD_OPT_ABORT
On Wed, Nov 28, 2018 at 01:39:11PM -0600, Eric Blake wrote:> At least 'nbd-client -l localhost' is a good demonstration of a > client that legitimately sends NBD_OPT_ABORT - it exists only > to enumerate the exports advertised by the server, rather than > intending to connect to any of those exports. As such, we should > downgrade the message for a client telling us it is going away > to the same status as our debug message for NBD_CMD_DISC, given > that the two have the same effect at different points in the > protocol. This stops nbdkit from spamming stderr with > > nbdkit: file[1]: error: client sent NBD_OPT_ABORT to abort the connection > > messages due to a client that doesn't want to connect after all. > > Signed-off-by: Eric Blake <eblake@redhat.com> > --- > > Found while implementing a similar 'qemu-nbd --list' that is > nicer than nbd-client's version ;) > > src/connections.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/connections.c b/src/connections.c > index e1ffeff..1b40e46 100644 > --- a/src/connections.c > +++ b/src/connections.c > @@ -705,7 +705,7 @@ _negotiate_handshake_newstyle_options (struct connection *conn) > case NBD_OPT_ABORT: > if (send_newstyle_option_reply (conn, option, NBD_REP_ACK) == -1) > return -1; > - nbdkit_error ("client sent NBD_OPT_ABORT to abort the connection"); > + debug ("client sent NBD_OPT_ABORT to abort the connection"); > return -1; > > case NBD_OPT_LIST:Yup, that's not an error :-) ACK. 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
Reasonably Related Threads
- [nbdkit PATCH] connections: Implement NBD_OPT_INFO
- [PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
- [nbdkit PATCH] connections: Don't use uninit memory on early client EOF
- [PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
- Re: [libnbd PATCH v2 06/13] api: Add nbd_opt_abort and nbd_aio_opt_abort