[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] nbd: Flip qemu-nbd to prefer newstyle; add -O f
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] nbd: Flip qemu-nbd to prefer newstyle; add -O for old behavior |
Date: |
Wed, 3 Oct 2018 12:45:26 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/3/18 12:38 PM, Vladimir Sementsov-Ogievskiy wrote:
03.10.2018 20:19, Eric Blake wrote:
Oldstyle NBD negotiation cannot perform any of the extensions that
we have recently been relying on. While you can always pass -x ""
to get newstyle negotiation, these days, it is better to just default
to newstyle (with an empty export name) and fall back to oldstyle
only on an explicit request.
+ if (oldstyle && (export_name || export_description)) {
+ error_report("oldstyle negotiation cannot set export details");
+ exit(EXIT_FAILURE);
+ }
if (export_name) {
nbd_export_set_name(exp, export_name);
nbd_export_set_description(exp, export_description);
newproto = true;
a bit strange, to have both newproto and oldstyle variables which are
opposite by value.
Yeah. I added a function-local 'oldstyle' before noticing that there was
a file static 'newproto'. We could squash this in:
diff --git i/qemu-nbd.c w/qemu-nbd.c
index 8571a4f93d8..2b0f7de86d0 100644
--- i/qemu-nbd.c
+++ w/qemu-nbd.c
@@ -56,7 +56,7 @@
#define MBR_SIZE 512
static NBDExport *exp;
-static bool newproto;
+static bool oldstyle;
static int verbose;
static char *srcpath;
static SocketAddress *saddr;
@@ -355,7 +355,7 @@ static void nbd_accept(QIONetListener *listener,
QIOChannelSocket *cioc,
nb_fds++;
nbd_update_server_watch();
- nbd_client_new(newproto ? NULL : exp, cioc,
+ nbd_client_new(oldstyle ? exp : NULL, cioc,
tlscreds, NULL, nbd_client_closed);
}
@@ -553,7 +553,6 @@ int main(int argc, char **argv)
QDict *options = NULL;
const char *export_name = NULL;
const char *export_description = NULL;
- bool oldstyle = false;
const char *tlscredsid = NULL;
bool imageOpts = false;
bool writethrough = true;
@@ -1030,7 +1029,6 @@ int main(int argc, char **argv)
if (export_name) {
nbd_export_set_name(exp, export_name);
nbd_export_set_description(exp, export_description);
- newproto = true;
}
if (device) {
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org