From 2e5383266869c13ee27ceaee5b24b686e2415df4 Mon Sep 17 00:00:00 2001 From: Samikshan Bairagya Date: Wed, 28 Dec 2016 20:33:54 +0530 Subject: glusterd: Add info on op-version for clients in vol status output Currently the `gluster volume status clients` command gives us the following information on clients: 1. Brick name 2. Client count for each brick 3. hostname:port for each client 4. Bytes read and written for each client There is no information regarding op-version for each client. This patch adds that to the output. Change-Id: Ib2ece93ab00c234162bb92b7c67a7d86f3350a8d BUG: 1409078 Signed-off-by: Samikshan Bairagya Reviewed-on: http://review.gluster.org/16303 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/protocol/server/src/server-handshake.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'xlators/protocol/server/src/server-handshake.c') diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index 1230cdf7ab5..a33efb8c33a 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -431,6 +431,8 @@ server_setvolume (rpcsvc_request_t *req) uint32_t lk_version = 0; char *buf = NULL; gf_boolean_t cancelled = _gf_false; + uint32_t opversion = 0; + rpc_transport_t *xprt = NULL; params = dict_new (); reply = dict_new (); @@ -669,6 +671,22 @@ server_setvolume (rpcsvc_request_t *req) gf_msg_debug (this->name, 0, "failed to set " "peer-info"); } + + ret = dict_get_uint32 (params, "opversion", &opversion); + if (ret) + gf_msg (this->name, GF_LOG_INFO, 0, + PS_MSG_CLIENT_OPVERSION_GET_FAILED, + "Failed to get client opversion"); + + /* Assign op-version value to the client */ + pthread_mutex_lock (&conf->mutex); + list_for_each_entry (xprt, &conf->xprt_list, list) { + if (strcmp (peerinfo->identifier, xprt->peerinfo.identifier)) + continue; + xprt->peerinfo.max_op_version = opversion; + } + pthread_mutex_unlock (&conf->mutex); + if (conf->auth_modules == NULL) { gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED, "Authentication module not initialized"); -- cgit