Scroll to navigation

nbdkit-protocol(1) NBDKIT nbdkit-protocol(1)

NAME

nbdkit - which parts of the NBD protocol nbdkit supports

SYNOPSIS

 nbdkit [-n|--newstyle] [-o|--oldstyle] [-e|--exportname EXPORTNAME]
        [...]

DESCRIPTION

This page documents the level of support in nbdkit for various parts of the NBD protocol.

NEW STYLE VS OLD STYLE PROTOCOL

The NBD protocol comes in two incompatible forms that we call "oldstyle" and "newstyle". Unfortunately which protocol you should use depends on the client and cannot be known in advance, nor can it be negotiated from the server side.

nbdkit defaults to the newstyle protocol since nbdkit ≥ 1.3. The newstyle protocol is better in every respect than the oldstyle protocol and you should prefer it if possible.

Use the -e or --exportname flag to set the optional exportname for the newstyle protocol.

Use the -o or --oldstyle flag to force the oldstyle protocol.

Common clients and the protocol they require

 Client                          Protocol
 ------------------------------------------------------------
 qemu <= 2.5 without exportname  oldstyle
 qemu <= 2.5 with exportname     newstyle
 qemu >= 2.6                     client can talk either protocol
 nbd-client < 3.10               client can talk either protocol
 nbd-client >= 3.10              newstyle
 any TLS (encrypted) client      newstyle
 nbdkit nbd plugin               client can talk either protocol

Errors seen if using the wrong protocol

If you use qemu ≤ 2.5 without the exportname field against a newstyle server, it will give the error:

 Server requires an export name

If you use qemu ≤ 2.5 with the exportname field against an oldstyle server, it will give the error:

 Server does not support export names

If you use the oldstyle protocol with nbd-client ≥ 3.10, it will give the error:

 Error: It looks like you're trying to connect to an oldstyle server.

NBD protocol and port number

Port 10809/tcp is reserved by IANA for the NBD protocol, but you can use nbdkit on any port or on Unix domain sockets.

The NBD protocol specification claims that you should always use newstyle when using port 10809, and use oldstyle on all other ports, but this claim is not based on the reality of what NBD servers do, and nbdkit does not require or encourage this.

NBD PROTOCOL FEATURES SUPPORTED BY NBDKIT

newstyle protocol
Supported in nbdkit ≥ 1.1.12, and the default in nbdkit ≥ 1.3.
export names
Supported in nbdkit ≥ 1.1.12.

nbdkit can advertise an export name, but ignores any export name sent by the client. nbdkit does not support serving different data on different export names.

"NBD_FLAG_NO_ZEROES"
Supported in nbdkit ≥ 1.1.13.

This protocol optimization avoids sending a useless block of zero bytes during protocol negotiation.

"NBD_CMD_WRITE_ZEROES"
Supported in nbdkit ≥ 1.1.13.
TLS with X.509 certificates
Supported in nbdkit ≥ 1.1.15.
TLS with Pre-Shared Keys (PSK)
Supported in nbdkit ≥ 1.4.0.
"NBD_OPT_GO"
Supported in nbdkit ≥ 1.5.3.

This protocol enhancement allows the server to return errors when negotiating the export name.

"NBD_OPT_INFO"
Supported in nbdkit ≥ 1.9.3.

This protocol enhancement allows a client to inspect details about the export without actually connecting.

"NBD_FLAG_CAN_MULTI_CONN"
Supported in nbdkit ≥ 1.9.9.
Structured Replies
Not supported.
Block Status
Not supported.
Resize Extension
Not supported.

SEE ALSO

nbdkit(1), https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md, https://nbd.sourceforge.io/.

AUTHORS

Eric Blake

Richard W.M. Jones

Pino Toscano

COPYRIGHT

Copyright (C) 2013-2018 Red Hat Inc.

LICENSE

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2019-01-26 nbdkit-1.10.3