From ee824ccb10e28489907fbf978a2d36b0b2c5dc8c Mon Sep 17 00:00:00 2001 From: anand Date: Sat, 13 Jun 2015 16:46:10 +0530 Subject: glusterd: rebalance support for cluster.rc framework Issue:Rebalance is failing in cluster framework (any simulated cluster environment in same node ). RCA: 1. we are passing always "localhost" as volfile server for rebalance xlator . 2. Rebalance daemons are overwriting unix socket and log files each other. (All rebalance processes are creating socket with same name) . Fix: set vol_file_server, unix socket and log files properly. Change-Id: I6654461e00c2a164b2f1f1db24a316c4180dd8d5 BUG: 1231437 Signed-off-by: anand Reviewed-on: http://review.gluster.org/11210 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Raghavendra G Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 03cc53c6cce..c4674f56c33 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -193,6 +193,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, char logfile[PATH_MAX] = {0,}; char volname[PATH_MAX] = {0,}; char valgrind_logfile[PATH_MAX] = {0,}; + char *volfileserver = NULL; priv = THIS->private; @@ -253,8 +254,26 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, } snprintf (volname, sizeof(volname), "rebalance/%s", volinfo->volname); + + if (dict_get_str (THIS->options, "transport.socket.bind-address", + &volfileserver) == 0) { + /*In the case of running multiple glusterds on a single machine, + *we should ensure that log file and unix socket file shouls be + *unique in given cluster */ + + GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD (sockfile, volinfo, + priv); + snprintf (logfile, PATH_MAX, "%s/%s-%s-%s.log", + DEFAULT_LOG_FILE_DIRECTORY, volinfo->volname, + (cmd == GF_DEFRAG_CMD_START_TIER ? "tier":"rebalance"), + uuid_utoa(MY_UUID)); + + } else { + volfileserver = "localhost"; + } + runner_add_args (&runner, SBIN_DIR"/glusterfs", - "-s", "localhost", "--volfile-id", volname, + "-s", volfileserver, "--volfile-id", volname, "--xlator-option", "*dht.use-readdirp=yes", "--xlator-option", "*dht.lookup-unhashed=yes", "--xlator-option", "*dht.assert-no-child-down=yes", -- cgit