[Libguestfs] [nbdkit PATCH] connections: Be less noisy when client sends NBD_OPT_ABORT

Eric Blake eblake at redhat.com
Wed Nov 28 19:39:11 UTC 2018

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 at 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:

More information about the Libguestfs mailing list