From c7cc5252a350ff78b5f8396d05c85b9d2ade17b8 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 2 Aug 2013 15:34:00 +0530 Subject: glusterd: Saving geo-rep session details in a more specific path Now saving the session details in /var/lib/glusterd/geo-replication/__ repo to distinguish between two master-slave sessions where the slavename is same across two different clusters. Change-Id: I57c93f55cc9bd4fe2bffe579028aaf5e4335b223 BUG: 991501 Signed-off-by: Avra Sengupta Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/5488 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-rpc-ops.c | 68 ++++++--------------------------------------------- 1 file changed, 8 insertions(+), 60 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index ea80f9362..25e2796a3 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3757,54 +3757,6 @@ out: return ret; } -static int -gf_cli_get_slave_volname (char *slave, char **slave_vol) -{ - char *tmp = NULL; - char *buf = NULL; - char *save_ptr = NULL; - char *slave_buf = NULL; - int32_t ret = -1; - - GF_ASSERT (slave); - - slave_buf = gf_strdup(slave); - if (!slave_buf) { - gf_log ("", GF_LOG_ERROR, - "Failed to gf_strdup"); - ret = -1; - goto out; - } - - tmp = strtok_r (slave_buf, ":", &save_ptr); - while (tmp) { - buf = tmp; - tmp = strtok_r (NULL, ":", &save_ptr); - } - - if (buf) { - *slave_vol = gf_strdup (buf); - if (!*slave_vol) { - gf_log ("", GF_LOG_ERROR, - "Failed to gf_strdup"); - ret = -1; - goto out; - } - gf_log ("", GF_LOG_DEBUG, "Slave Vol : %s", *slave_vol); - ret = 0; - } else { - gf_log ("", GF_LOG_ERROR, "Invalid slave name"); - goto out; - } - -out: - if (slave_buf) - GF_FREE(slave_buf); - - gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); - return ret; -} - int gf_cli_gsync_config_command (dict_t *dict) { @@ -3812,7 +3764,7 @@ gf_cli_gsync_config_command (dict_t *dict) char *subop = NULL; char *gwd = NULL; char *slave = NULL; - char *slave_vol = NULL; + char *confpath = NULL; char *master = NULL; char *op_name = NULL; int ret = -1; @@ -3835,21 +3787,17 @@ gf_cli_gsync_config_command (dict_t *dict) if (dict_get_str (dict, "op_name", &op_name) != 0) op_name = NULL; - ret = gf_cli_get_slave_volname (slave, &slave_vol); - if (ret) { - gf_log ("", GF_LOG_ERROR, - "Unable to fetch slave volume name."); - return -1; + ret = dict_get_str (dict, "conf_path", &confpath); + if (!confpath) { + ret = snprintf (conf_path, sizeof(conf_path) - 1, + "%s/"GEOREP"/gsyncd_template.conf", gwd); + conf_path[ret] = '\0'; + confpath = conf_path; } - ret = snprintf (conf_path, sizeof(conf_path) - 1, - "%s/"GEOREP"/%s-%s/gsyncd.conf", - gwd, master, slave_vol); - conf_path[ret] = '\0'; - runinit (&runner); runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "-c", NULL); - runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "%s", confpath); if (master) runner_argprintf (&runner, ":%s", master); runner_add_arg (&runner, slave); -- cgit