Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change the default protocol to newstyle.
nbdkit <= 1.1.28 defaulted to the oldstyle protocol for compatibility
with qemu and libguestfs.  However qemu >= 2.6 can now work with
either protocol and is widely installed.  Also newstyle is required
for newer features such as export names and TLS.  In addition
nbd-client dropped support for oldstyle entirely.

You can select the oldstyle protocol by adding ‘-o’, and it is still
tested.
  • Loading branch information
rwmjones committed Jan 23, 2018
1 parent c5e6d71 commit 8158e77
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
6 changes: 6 additions & 0 deletions TODO
Expand Up @@ -74,3 +74,9 @@ nbdkit processes.
The nbd plugin (plugins/nbd) already contains an NBD client, so we
could factor this client out and make it available to other plugins to
use.

Tests
-----

* tests/test-single.sh: This test (of the -s option) needs
considerable work.
29 changes: 15 additions & 14 deletions docs/nbdkit.pod
Expand Up @@ -67,7 +67,7 @@ L<guestfish(1)>:
Serve file F<disk.img> on port 10809, requiring clients to use
encrypted (TLS) connections:

nbdkit --newstyle --tls=require file file=disk.img
nbdkit --tls=require file file=disk.img

=head2 Combining plugins and filters

Expand Down Expand Up @@ -128,7 +128,7 @@ This option implies I<--foreground>.

=item B<--exportname> EXPORTNAME

Set the exportname and use the newstyle protocol (implies I<-n>).
Set the exportname.

If not set, exportname C<""> (empty string) is used. Exportnames are
not allowed with the oldstyle protocol.
Expand Down Expand Up @@ -175,19 +175,22 @@ interfaces. See also I<-p>.

=item B<--newstyle>

Use the newstyle NBD protocol instead of the default (oldstyle)
protocol. See L</NEW STYLE VS OLD STYLE PROTOCOL> below.
Use the newstyle NBD protocol protocol. This is the default in nbdkit
E<ge> 1.1.29. In earlier versions the default was oldstyle.

See L</NEW STYLE VS OLD STYLE PROTOCOL> below.

=item B<-o>

=item B<--old-style>

=item B<--oldstyle>

Use the oldstyle NBD protocol. This is currently the default (unless
you use I<-n> or I<-e>), so this flag does nothing, but it is possible
we might change the default protocol in future. See L</NEW STYLE VS
OLD STYLE PROTOCOL> below.
Use the oldstyle NBD protocol. This I<was> the default in nbdkit
E<le> 1.1.28, but now the default is newstyle. Note this is
incompatible with newer features such as export names and TLS.

See L</NEW STYLE VS OLD STYLE PROTOCOL> below.

=item B<-P> PIDFILE

Expand Down Expand Up @@ -527,12 +530,10 @@ The NBD protocol comes in two incompatible forms that we call
use depends on the client and cannot be known in advance, nor can it
be negotiated from the server side.

nbdkit currently defaults to the oldstyle protocol for compatibility
with qemu and libguestfs. This is also the same behaviour as qemu-nbd
E<le> 2.5. Use the I<-n> or I<--newstyle> flag on the command line to
use the newstyle protocol. Use the I<-e> or I<--exportname> flag to
set the exportname for the newstyle protocol. Use the I<-o> or
I<--oldstyle> flag to force the oldstyle protocol.
nbdkit defaults to the newstyle protocol since nbdkit E<ge> 1.1.29.
Use the I<-e> or I<--exportname> flag to set the optional exportname
for the newstyle protocol. Use the I<-o> or I<--oldstyle> flag to
force the oldstyle protocol.

Some common clients and the protocol they require:

Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Expand Up @@ -80,7 +80,7 @@ int exit_with_parent; /* --exit-with-parent */
const char *exportname; /* -e */
int foreground; /* -f */
const char *ipaddr; /* -i */
int newstyle; /* -n */
int newstyle = 1; /* 0 = -o, 1 = -n */
char *pidfile; /* -P */
const char *port; /* -p */
int readonly; /* -r */
Expand Down
2 changes: 1 addition & 1 deletion tests/test-single.sh
Expand Up @@ -38,4 +38,4 @@ source ./functions.sh
# Test nbdkit -s option.
# XXX Not sure what is a really good test of this.

nbdkit -s example1 </dev/null
nbdkit -o -s example1 </dev/null

0 comments on commit 8158e77

Please sign in to comment.