summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.c29
-rw-r--r--rpc/rpc-lib/src/protocol-common.h1
-rw-r--r--xlators/protocol/client/src/client-handshake.c15
3 files changed, 18 insertions, 27 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 3da01a4..68d2e24 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3082,32 +3082,13 @@ _gf_timestuff (gf_timefmts *fmt, const char ***fmts, const char ***zeros)
char *
generate_glusterfs_ctx_id (void)
{
- char tmp_str[1024] = {0,};
- char hostname[256] = {0,};
- struct timeval tv = {0,};
- char now_str[32];
+ uuid_t ctxid;
+ char *tmp = NULL;
- if (gettimeofday (&tv, NULL) == -1) {
- gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
- LG_MSG_GETTIMEOFDAY_FAILED, "gettimeofday: "
- "failed");
- }
-
- if (gethostname (hostname, 256) == -1) {
- gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
- LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed");
- }
-
- gf_time_fmt (now_str, sizeof now_str, tv.tv_sec, gf_timefmt_Ymd_T);
- snprintf (tmp_str, sizeof tmp_str, "%s-%d-%s:%"
-#ifdef GF_DARWIN_HOST_OS
- PRId32,
-#else
- "ld",
-#endif
- hostname, getpid(), now_str, tv.tv_usec);
+ gf_uuid_generate (ctxid);
+ tmp = uuid_utoa (ctxid);
- return gf_strdup (tmp_str);
+ return gf_strdup (tmp);
}
char *
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index d4b64e1..ccb3c50 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -360,4 +360,5 @@ typedef enum gf_get_snapshot_info_type gf_get_snapshot_info_type;
#define GD_VOLUME_NAME_MAX 256 /* Maximum size of volume name */
+#define GLUSTER_PROCESS_UUID_FMT "CTX_ID:%s-GRAPH_ID:%d-PID:%d-HOST:%s-PC_NAME:%s-RECON_NO:%s"
#endif /* !_PROTOCOL_COMMON_H */
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 587e256..ca3d140 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -1312,6 +1312,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
clnt_conf_t *conf = NULL;
dict_t *options = NULL;
char counter_str[32] = {0};
+ char hostname[256] = {0,};
options = this->options;
conf = this->private;
@@ -1354,9 +1355,17 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
"-%"PRIu64, conf->setvol_count);
conf->setvol_count++;
}
- ret = gf_asprintf (&process_uuid_xl, "%s-%s-%d%s",
- this->ctx->process_uuid, this->name,
- this->graph->id, counter_str);
+
+ if (gethostname (hostname, 256) == -1) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed");
+
+ goto fail;
+ }
+
+ ret = gf_asprintf (&process_uuid_xl, GLUSTER_PROCESS_UUID_FMT,
+ this->ctx->process_uuid, this->graph->id, getpid(),
+ hostname, this->name, counter_str);
if (-1 == ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
PC_MSG_PROCESS_UUID_SET_FAIL, "asprintf failed while "