From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: pbonzini@redhat.com, eblake@redhat.com, mreitz@redhat.com,
kwolf@redhat.com, vsementsov@virtuozzo.com, den@virtuozzo.com,
rjones@redhat.com, berrange@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] qemu-nbd: drop old-style negotiation
Date: Wed, 3 Oct 2018 20:02:27 +0300 [thread overview]
Message-ID: <20181003170228.95973-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20181003170228.95973-1-vsementsov@virtuozzo.com>
Use new-style negotiation always, with default "" (empty) export name
if it is not specified with '-x' option.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
qemu-nbd.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 51b9d38c72..57e79e30ea 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -56,7 +56,6 @@
#define MBR_SIZE 512
static NBDExport *exp;
-static bool newproto;
static int verbose;
static char *srcpath;
static SocketAddress *saddr;
@@ -84,8 +83,8 @@ static void usage(const char *name)
" -e, --shared=NUM device can be shared by NUM clients (default '1')\n"
" -t, --persistent don't exit on the last connection\n"
" -v, --verbose display extra debugging information\n"
-" -x, --export-name=NAME expose export by name\n"
-" -D, --description=TEXT with -x, also export a human-readable description\n"
+" -x, --export-name=NAME expose export by name (default is empty string)\n"
+" -D, --description=TEXT export a human-readable description\n"
"\n"
"Exposing part of the image:\n"
" -o, --offset=OFFSET offset into the image\n"
@@ -354,8 +353,7 @@ static void nbd_accept(QIONetListener *listener, QIOChannelSocket *cioc,
nb_fds++;
nbd_update_server_watch();
- nbd_client_new(newproto ? NULL : exp, cioc,
- tlscreds, NULL, nbd_client_closed);
+ nbd_client_new(NULL, cioc, tlscreds, NULL, nbd_client_closed);
}
static void nbd_update_server_watch(void)
@@ -549,7 +547,7 @@ int main(int argc, char **argv)
Error *local_err = NULL;
BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF;
QDict *options = NULL;
- const char *export_name = NULL;
+ const char *export_name = ""; /* Default export name */
const char *export_description = NULL;
const char *tlscredsid = NULL;
bool imageOpts = false;
@@ -808,11 +806,6 @@ int main(int argc, char **argv)
error_report("TLS is not supported with a host device");
exit(EXIT_FAILURE);
}
- if (!export_name) {
- /* Set the default NBD protocol export name, since
- * we *must* use new style protocol for TLS */
- export_name = "";
- }
tlscreds = nbd_get_tls_creds(tlscredsid, &local_err);
if (local_err) {
error_report("Failed to get TLS creds %s",
@@ -1013,14 +1006,8 @@ int main(int argc, char **argv)
error_report_err(local_err);
exit(EXIT_FAILURE);
}
- if (export_name) {
- nbd_export_set_name(exp, export_name);
- nbd_export_set_description(exp, export_description);
- newproto = true;
- } else if (export_description) {
- error_report("Export description requires an export name");
- exit(EXIT_FAILURE);
- }
+ nbd_export_set_name(exp, export_name);
+ nbd_export_set_description(exp, export_description);
if (device) {
int ret;
--
2.18.0
next prev parent reply other threads:[~2018-10-03 17:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 17:02 [Qemu-devel] [PATCH 0/2] nbd server: drop old-style negotiation Vladimir Sementsov-Ogievskiy
2018-10-03 17:02 ` Vladimir Sementsov-Ogievskiy [this message]
2018-10-03 17:31 ` [Qemu-devel] [PATCH 1/2] qemu-nbd: " Eric Blake
2018-10-03 17:02 ` [Qemu-devel] [PATCH 2/2] nbd/server: " Vladimir Sementsov-Ogievskiy
2018-10-03 17:35 ` Eric Blake
2018-10-03 17:32 ` [Qemu-devel] [PATCH 0/2] nbd server: " Eric Blake
2018-10-03 17:59 ` Vladimir Sementsov-Ogievskiy
2018-10-03 18:08 ` Eric Blake
2018-10-03 20:30 ` Richard W.M. Jones
2018-10-04 12:10 ` Vladimir Sementsov-Ogievskiy
2018-10-04 12:22 ` Richard W.M. Jones
2018-10-03 20:44 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181003170228.95973-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=berrange@redhat.com \
--cc=den@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).