summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-20 13:23:08 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-20 02:05:36 -0700
commit83e7318961e622c10d25a7673b6dedc2f848785b (patch)
tree71aeea7b724a4702e9b4c88eab697d699265c7e4
parent780b9668b0e49126e720edd79c10bf2a87ad0a85 (diff)
glusterfs protocol: handshake to log the version of the peer
* As RPC program's name is just used for logging, we now have 'PACKAGE_VERSION' part of the string, which gets logged in client side. * From client, we send the PACKAGE_VERSION in handshake dictionary, which gets logged on serverside handshake. The change doesn't break any compatibility between client or server as it would only enhance the logging part of handshake. Change-Id: Ie7f498af2f5d3f97be37c8d982061cb6021883ce BUG: 3589 Reviewed-on: http://review.gluster.com/469 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/protocol/client/src/client-handshake.c8
-rw-r--r--xlators/protocol/server/src/server-handshake.c18
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c2
3 files changed, 23 insertions, 5 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index d969536..e6796f9 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -932,6 +932,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
"asprintf failed while setting process_uuid");
goto fail;
}
+
ret = dict_set_dynstr (options, "process-uuid", process_uuid_xl);
if (ret < 0) {
gf_log (this->name, GF_LOG_ERROR,
@@ -940,6 +941,13 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
goto fail;
}
+ ret = dict_set_str (options, "client-version", PACKAGE_VERSION);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to set client-version(%s) in handshake msg",
+ PACKAGE_VERSION);
+ }
+
if (this->ctx->cmd_args.volfile_server) {
if (this->ctx->cmd_args.volfile_id) {
ret = dict_set_str (options, "volfile-key",
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 0522bb8..1c6190c 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -345,6 +345,7 @@ server_setvolume (rpcsvc_request_t *req)
dict_t *params = NULL;
char *name = NULL;
char *process_uuid = NULL;
+ char *clnt_version = NULL;
xlator_t *xl = NULL;
char *msg = NULL;
char *volfile_key = NULL;
@@ -526,13 +527,20 @@ server_setvolume (rpcsvc_request_t *req)
"Authentication module not initialized");
}
+ ret = dict_get_str (params, "client-version", &clnt_version);
+ if (ret)
+ gf_log (this->name, GF_LOG_INFO, "client-version not set, "
+ "may be of older version");
+
ret = gf_authenticate (params, config_params,
conf->auth_modules);
if (ret == AUTH_ACCEPT) {
+
gf_log (this->name, GF_LOG_INFO,
- "accepted client from %s",
- (peerinfo)?peerinfo->identifier:"");
+ "accepted client from %s (version: %s)",
+ (peerinfo) ? peerinfo->identifier : "<>",
+ (clnt_version) ? clnt_version : "old");
op_ret = 0;
conn->bound_xl = xl;
ret = dict_set_str (reply, "ERROR", "Success");
@@ -541,8 +549,10 @@ server_setvolume (rpcsvc_request_t *req)
"failed to set error msg");
} else {
gf_log (this->name, GF_LOG_ERROR,
- "Cannot authenticate client from %s",
- (peerinfo)? peerinfo->identifier:"<>");
+ "Cannot authenticate client from %s %s",
+ (peerinfo) ? peerinfo->identifier : "<>",
+ (clnt_version) ? clnt_version : "old");
+
op_ret = -1;
op_errno = EACCES;
ret = dict_set_str (reply, "ERROR", "Authentication failed");
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 591b512..776a671 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -5129,7 +5129,7 @@ rpcsvc_actor_t glusterfs3_1_fop_actors[] = {
struct rpcsvc_program glusterfs3_1_fop_prog = {
- .progname = "GlusterFS-3.1.0",
+ .progname = "GlusterFS " PACKAGE_VERSION,
.prognum = GLUSTER3_1_FOP_PROGRAM,
.progver = GLUSTER3_1_FOP_VERSION,
.numactors = GLUSTER3_1_FOP_PROCCNT,