summaryrefslogtreecommitdiff
path: root/nbd/server.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2018-03-30 08:09:50 -0500
committerEric Blake <eblake@redhat.com>2018-04-02 09:10:49 -0500
commit2b53af2523f6a3387f71372f59d3717f1f7d5fd9 (patch)
tree32cd778d01afae8347a074f765f429b970ed648b /nbd/server.c
parent260e34dbb7646b23d6f93bb5f2b208acf60f1088 (diff)
downloadqemu-2b53af2523f6a3387f71372f59d3717f1f7d5fd9.tar.gz
nbd: trace meta context negotiation
Having a more detailed log of the interaction between client and server is invaluable in debugging how meta context negotiation actually works. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20180330130950.1931229-1-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'nbd/server.c')
-rw-r--r--nbd/server.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nbd/server.c b/nbd/server.c
index cea158913b..9e1f227178 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -726,6 +726,7 @@ static int nbd_negotiate_send_meta_context(NBDClient *client,
context_id = 0;
}
+ trace_nbd_negotiate_meta_query_reply(context, context_id);
set_be_option_rep(&opt.h, client->opt, NBD_REP_META_CONTEXT,
sizeof(opt) - sizeof(opt.h) + iov[1].iov_len);
stl_be_p(&opt.context_id, context_id);
@@ -752,10 +753,12 @@ static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
if (client->opt == NBD_OPT_LIST_META_CONTEXT) {
meta->base_allocation = true;
}
+ trace_nbd_negotiate_meta_query_parse("base:");
return 1;
}
if (len != alen) {
+ trace_nbd_negotiate_meta_query_skip("not base:allocation");
return nbd_opt_skip(client, len, errp);
}
@@ -768,6 +771,7 @@ static int nbd_meta_base_query(NBDClient *client, NBDExportMetaContexts *meta,
meta->base_allocation = true;
}
+ trace_nbd_negotiate_meta_query_parse("base:allocation");
return 1;
}
@@ -800,6 +804,7 @@ static int nbd_negotiate_meta_query(NBDClient *client,
/* The only supported namespace for now is 'base'. So query should start
* with 'base:'. Otherwise, we can ignore it and skip the remainder. */
if (len < baselen) {
+ trace_nbd_negotiate_meta_query_skip("length too short");
return nbd_opt_skip(client, len, errp);
}
@@ -809,6 +814,7 @@ static int nbd_negotiate_meta_query(NBDClient *client,
return ret;
}
if (strncmp(query, "base:", baselen) != 0) {
+ trace_nbd_negotiate_meta_query_skip("not for base: namespace");
return nbd_opt_skip(client, len, errp);
}
@@ -858,6 +864,8 @@ static int nbd_negotiate_meta_queries(NBDClient *client,
return ret;
}
cpu_to_be32s(&nb_queries);
+ trace_nbd_negotiate_meta_context(nbd_opt_lookup(client->opt),
+ meta->export_name, nb_queries);
if (client->opt == NBD_OPT_LIST_META_CONTEXT && !nb_queries) {
/* enable all known contexts */