Richard W.M. Jones
2018-Jan-23 19:04 UTC
[Libguestfs] [PATCH nbdkit] 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. --- TODO | 6 ++++++ docs/nbdkit.pod | 29 +++++++++++++++-------------- src/main.c | 2 +- tests/test-single.sh | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/TODO b/TODO index bb99456..dba5aba 100644 --- a/TODO +++ b/TODO @@ -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. diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod index 2d17b74..1167245 100644 --- a/docs/nbdkit.pod +++ b/docs/nbdkit.pod @@ -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 @@ -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. @@ -175,8 +175,10 @@ 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> @@ -184,10 +186,11 @@ protocol. See L</NEW STYLE VS OLD STYLE PROTOCOL> below. =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 @@ -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: diff --git a/src/main.c b/src/main.c index e5d9093..67cbbde 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ diff --git a/tests/test-single.sh b/tests/test-single.sh index 5f60367..d7783a6 100755 --- a/tests/test-single.sh +++ b/tests/test-single.sh @@ -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 -- 2.13.2
Eric Blake
2018-Jan-23 20:19 UTC
Re: [Libguestfs] [PATCH nbdkit] Change the default protocol to newstyle.
On 01/23/2018 01:04 PM, Richard W.M. Jones wrote:> 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.Looks right to me.> --- > TODO | 6 ++++++ > docs/nbdkit.pod | 29 +++++++++++++++-------------- > src/main.c | 2 +- > tests/test-single.sh | 2 +- > 4 files changed, 23 insertions(+), 16 deletions(-)(Yay - my test-nbd was already set up for proper explicit use of -o vs. -n, so it still covers both styles regardless of the default) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Reasonably Related Threads
- [nbdkit PATCH 2/2] server: Add --mask-handshake option for integration testing
- [nbdkit PATCH v2] main: Add option to disable SR advertisement
- [PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
- [nbdkit PATCH v2 7/7] server: Better newstyle .open failure handling
- [PATCH nbdkit] server: Use bool for types which are really booleans.