Skip to content

Commit 8158e77

Browse files
committed
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.
1 parent c5e6d71 commit 8158e77

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

TODO

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ nbdkit processes.
7474
The nbd plugin (plugins/nbd) already contains an NBD client, so we
7575
could factor this client out and make it available to other plugins to
7676
use.
77+
78+
Tests
79+
-----
80+
81+
* tests/test-single.sh: This test (of the -s option) needs
82+
considerable work.

docs/nbdkit.pod

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ L<guestfish(1)>:
6767
Serve file F<disk.img> on port 10809, requiring clients to use
6868
encrypted (TLS) connections:
6969

70-
nbdkit --newstyle --tls=require file file=disk.img
70+
nbdkit --tls=require file file=disk.img
7171

7272
=head2 Combining plugins and filters
7373

@@ -128,7 +128,7 @@ This option implies I<--foreground>.
128128

129129
=item B<--exportname> EXPORTNAME
130130

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

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

176176
=item B<--newstyle>
177177

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

181183
=item B<-o>
182184

183185
=item B<--old-style>
184186

185187
=item B<--oldstyle>
186188

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

192195
=item B<-P> PIDFILE
193196

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

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

537538
Some common clients and the protocol they require:
538539

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int exit_with_parent; /* --exit-with-parent */
8080
const char *exportname; /* -e */
8181
int foreground; /* -f */
8282
const char *ipaddr; /* -i */
83-
int newstyle; /* -n */
83+
int newstyle = 1; /* 0 = -o, 1 = -n */
8484
char *pidfile; /* -P */
8585
const char *port; /* -p */
8686
int readonly; /* -r */

tests/test-single.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ source ./functions.sh
3838
# Test nbdkit -s option.
3939
# XXX Not sure what is a really good test of this.
4040

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

0 commit comments

Comments
 (0)