From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, Paolo Bonzini <pbonzini@redhat.com>,
"open list:Network Block Dev..." <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PATCH v2 2/2] nbd/client: fix error messages in nbd_handle_reply_err
Date: Mon, 26 Feb 2018 10:57:23 -0600 [thread overview]
Message-ID: <20180226165723.17818-3-eblake@redhat.com> (raw)
In-Reply-To: <20180226165723.17818-1-eblake@redhat.com>
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1. NBD_REP_ERR_INVALID is not only about length, so, make message more
general
2. hex format is not very good: it's hard to read something like
"option a (set meta context)", so switch to dec.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <1518702707-7077-6-git-send-email-vsementsov@virtuozzo.com>
[eblake: expand scope of patch: ALL uses of nbd_opt_lookup are now
decimal, all uses of nbd_rep_lookup are prefixed hex]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
nbd/client.c | 20 ++++++++++----------
nbd/server.c | 4 ++--
nbd/trace-events | 8 ++++----
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/nbd/client.c b/nbd/client.c
index 89f80f95905..756e110f895 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -180,22 +180,22 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply,
goto cleanup;
case NBD_REP_ERR_POLICY:
- error_setg(errp, "Denied by server for option %" PRIx32 " (%s)",
+ error_setg(errp, "Denied by server for option %" PRIu32 " (%s)",
reply->option, nbd_opt_lookup(reply->option));
break;
case NBD_REP_ERR_INVALID:
- error_setg(errp, "Invalid data length for option %" PRIx32 " (%s)",
+ error_setg(errp, "Invalid parameters for option %" PRIu32 " (%s)",
reply->option, nbd_opt_lookup(reply->option));
break;
case NBD_REP_ERR_PLATFORM:
- error_setg(errp, "Server lacks support for option %" PRIx32 " (%s)",
+ error_setg(errp, "Server lacks support for option %" PRIu32 " (%s)",
reply->option, nbd_opt_lookup(reply->option));
break;
case NBD_REP_ERR_TLS_REQD:
- error_setg(errp, "TLS negotiation required before option %" PRIx32
+ error_setg(errp, "TLS negotiation required before option %" PRIu32
" (%s)", reply->option, nbd_opt_lookup(reply->option));
break;
@@ -204,17 +204,17 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply,
break;
case NBD_REP_ERR_SHUTDOWN:
- error_setg(errp, "Server shutting down before option %" PRIx32 " (%s)",
+ error_setg(errp, "Server shutting down before option %" PRIu32 " (%s)",
reply->option, nbd_opt_lookup(reply->option));
break;
case NBD_REP_ERR_BLOCK_SIZE_REQD:
- error_setg(errp, "Server requires INFO_BLOCK_SIZE for option %" PRIx32
+ error_setg(errp, "Server requires INFO_BLOCK_SIZE for option %" PRIu32
" (%s)", reply->option, nbd_opt_lookup(reply->option));
break;
default:
- error_setg(errp, "Unknown error code when asking for option %" PRIx32
+ error_setg(errp, "Unknown error code when asking for option %" PRIu32
" (%s)", reply->option, nbd_opt_lookup(reply->option));
break;
}
@@ -378,8 +378,8 @@ static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
return 1;
}
if (reply.type != NBD_REP_INFO) {
- error_setg(errp, "unexpected reply type %" PRIx32
- " (%s), expected %x",
+ error_setg(errp, "unexpected reply type 0x%" PRIx32
+ " (%s), expected 0x%x",
reply.type, nbd_rep_lookup(reply.type), NBD_REP_INFO);
nbd_send_opt_abort(ioc);
return -1;
@@ -534,7 +534,7 @@ static int nbd_request_simple_option(QIOChannel *ioc, int opt, Error **errp)
if (reply.type != NBD_REP_ACK) {
error_setg(errp, "Server answered option %d (%s) with unexpected "
- "reply %" PRIx32 " (%s)", opt, nbd_opt_lookup(opt),
+ "reply 0x%" PRIx32 " (%s)", opt, nbd_opt_lookup(opt),
reply.type, nbd_rep_lookup(reply.type));
nbd_send_opt_abort(ioc);
return -1;
diff --git a/nbd/server.c b/nbd/server.c
index 112e3f69dff..4990a5826e6 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -806,7 +806,7 @@ static int nbd_negotiate_options(NBDClient *client, uint16_t myflags,
default:
ret = nbd_opt_drop(client, NBD_REP_ERR_UNSUP, errp,
- "Unsupported option 0x%" PRIx32 " (%s)",
+ "Unsupported option %" PRIu32 " (%s)",
option, nbd_opt_lookup(option));
break;
}
@@ -822,7 +822,7 @@ static int nbd_negotiate_options(NBDClient *client, uint16_t myflags,
errp);
default:
- error_setg(errp, "Unsupported option 0x%" PRIx32 " (%s)",
+ error_setg(errp, "Unsupported option %" PRIu32 " (%s)",
option, nbd_opt_lookup(option));
return -EINVAL;
}
diff --git a/nbd/trace-events b/nbd/trace-events
index 2b8268ce8c3..ac19a366aac 100644
--- a/nbd/trace-events
+++ b/nbd/trace-events
@@ -1,7 +1,7 @@
# nbd/client.c
nbd_send_option_request(uint32_t opt, const char *name, uint32_t len) "Sending option request %" PRIu32" (%s), len %" PRIu32
-nbd_receive_option_reply(uint32_t option, const char *optname, uint32_t type, const char *typename, uint32_t length) "Received option reply 0x%" PRIx32" (%s), type 0x%" PRIx32" (%s), len %" PRIu32
-nbd_reply_err_unsup(uint32_t option, const char *name) "server doesn't understand request 0x%" PRIx32 " (%s), attempting fallback"
+nbd_receive_option_reply(uint32_t option, const char *optname, uint32_t type, const char *typename, uint32_t length) "Received option reply %" PRIu32" (%s), type 0x%" PRIx32" (%s), len %" PRIu32
+nbd_reply_err_unsup(uint32_t option, const char *name) "server doesn't understand request %" PRIu32 " (%s), attempting fallback"
nbd_opt_go_start(const char *name) "Attempting NBD_OPT_GO for export '%s'"
nbd_opt_go_success(void) "Export is good to go"
nbd_opt_go_info_unknown(int info, const char *name) "Ignoring unknown info %d (%s)"
@@ -33,7 +33,7 @@ nbd_receive_structured_reply_chunk(uint16_t flags, uint16_t type, const char *na
nbd_unknown_error(int err) "Squashing unexpected error %d to EINVAL"
# nbd/server.c
-nbd_negotiate_send_rep_len(uint32_t opt, const char *optname, uint32_t type, const char *typename, uint32_t len) "Reply opt=0x%" PRIx32 " (%s), type=0x%" PRIx32 " (%s), len=%" PRIu32
+nbd_negotiate_send_rep_len(uint32_t opt, const char *optname, uint32_t type, const char *typename, uint32_t len) "Reply opt=%" PRIu32 " (%s), type=0x%" PRIx32 " (%s), len=%" PRIu32
nbd_negotiate_send_rep_err(const char *msg) "sending error message \"%s\""
nbd_negotiate_send_rep_list(const char *name, const char *desc) "Advertising export name '%s' description '%s'"
nbd_negotiate_handle_export_name(void) "Checking length"
@@ -46,7 +46,7 @@ nbd_negotiate_handle_starttls(void) "Setting up TLS"
nbd_negotiate_handle_starttls_handshake(void) "Starting TLS handshake"
nbd_negotiate_options_flags(uint32_t flags) "Received client flags 0x%" PRIx32
nbd_negotiate_options_check_magic(uint64_t magic) "Checking opts magic 0x%" PRIx64
-nbd_negotiate_options_check_option(uint32_t option, const char *name) "Checking option 0x%" PRIx32 " (%s)"
+nbd_negotiate_options_check_option(uint32_t option, const char *name) "Checking option %" PRIu32 " (%s)"
nbd_negotiate_begin(void) "Beginning negotiation"
nbd_negotiate_old_style(uint64_t size, unsigned flags) "advertising size %" PRIu64 " and flags 0x%x"
nbd_negotiate_new_style_size_flags(uint64_t size, unsigned flags) "advertising size %" PRIu64 " and flags 0x%x"
--
2.14.3
next prev parent reply other threads:[~2018-02-26 16:57 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 13:51 [Qemu-devel] [PATCH 0/9] nbd block status base:allocation Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 1/9] nbd/server: add nbd_opt_invalid helper Vladimir Sementsov-Ogievskiy
2018-02-15 22:01 ` Eric Blake
2018-03-02 12:40 ` Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 2/9] nbd: change indenting in nbd.h Vladimir Sementsov-Ogievskiy
2018-02-15 22:03 ` Eric Blake
2018-02-15 13:51 ` [Qemu-devel] [PATCH 3/9] nbd: BLOCK_STATUS for standard get_block_status function: server part Vladimir Sementsov-Ogievskiy
2018-02-15 23:02 ` Eric Blake
2018-02-16 11:09 ` Vladimir Sementsov-Ogievskiy
2018-02-16 11:45 ` Eric Blake
2018-02-16 13:21 ` Eric Blake
2018-02-16 14:43 ` Vladimir Sementsov-Ogievskiy
2018-02-16 17:01 ` Eric Blake
2018-03-01 11:36 ` Vladimir Sementsov-Ogievskiy
2018-03-02 15:07 ` Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 4/9] block/nbd-client: save first fatal error in nbd_iter_error Vladimir Sementsov-Ogievskiy
2018-02-16 17:35 ` Eric Blake
2018-02-15 13:51 ` [Qemu-devel] [PATCH 5/9] nbd/client: fix error messages in nbd_handle_reply_err Vladimir Sementsov-Ogievskiy
2018-02-16 17:38 ` Eric Blake
2018-03-01 11:38 ` Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 6/9] nbd: BLOCK_STATUS for standard get_block_status function: client part Vladimir Sementsov-Ogievskiy
2018-02-16 20:40 ` Eric Blake
2018-03-09 18:47 ` Vladimir Sementsov-Ogievskiy
2018-03-12 9:06 ` Vladimir Sementsov-Ogievskiy
2018-03-12 9:23 ` Vladimir Sementsov-Ogievskiy
2018-03-12 9:48 ` Vladimir Sementsov-Ogievskiy
2018-03-12 13:13 ` Vladimir Sementsov-Ogievskiy
2018-03-12 14:00 ` Eric Blake
2018-02-15 13:51 ` [Qemu-devel] [PATCH 7/9] iotests.py: tiny refactor: move system imports up Vladimir Sementsov-Ogievskiy
2018-02-16 20:44 ` Eric Blake
2018-03-09 18:54 ` Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 8/9] iotests: add file_path helper Vladimir Sementsov-Ogievskiy
2018-02-16 20:46 ` Eric Blake
2018-02-20 5:42 ` Jeff Cody
2018-03-12 10:04 ` Vladimir Sementsov-Ogievskiy
2018-02-15 13:51 ` [Qemu-devel] [PATCH 9/9] iotests: new test 206 for NBD BLOCK_STATUS Vladimir Sementsov-Ogievskiy
2018-02-16 21:02 ` Eric Blake
2018-03-01 11:51 ` Vladimir Sementsov-Ogievskiy
2018-03-01 18:23 ` Eric Blake
2018-02-22 19:30 ` [Qemu-devel] [PATCH 0/9] nbd block status base:allocation no-reply
2018-02-23 14:02 ` no-reply
2018-02-24 6:48 ` no-reply
2018-02-26 16:57 ` [Qemu-devel] [PATCH v2 0/2] nbd block status initial patches Eric Blake
2018-02-26 16:57 ` [Qemu-devel] [PATCH v2 1/2] nbd: BLOCK_STATUS constants Eric Blake
2018-03-01 12:06 ` Vladimir Sementsov-Ogievskiy
2018-02-26 16:57 ` Eric Blake [this message]
2018-03-01 12:10 ` [Qemu-devel] [PATCH v2 2/2] nbd/client: fix error messages in nbd_handle_reply_err Vladimir Sementsov-Ogievskiy
2018-03-01 18:25 ` Eric Blake
2018-03-09 19:08 ` [Qemu-devel] [PATCH 0/9] nbd block status base:allocation Eric Blake
2018-03-09 19:28 ` Vladimir Sementsov-Ogievskiy
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=20180226165723.17818-3-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).