summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-06-15 17:20:46 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-06-18 23:37:31 -0700
commit84479bfa28f91c993b4e4a1f0f259a3ae1576791 (patch)
tree8887c08a9039140c337ddab37c8c4bdd7d533e43 /cli/src
parentc4d4d2247b3aeb96e37a05aeb0f73cec54360094 (diff)
glusterd: Fix snapshot of a volume with geo-rep
Problem: Snapshot fails for a volume configured with geo-rep if geo-rep is created with root user with the following syntax. gluster vol geo-rep <master_vol> root@<slave_host>::<slave_vol> It works fine if created with following syntax. gluster vol geo-rep <master_vol> <slave_host>::<slave_vol> Cause: Geo-rep maintains persistent dictionary of slave associated with master volume. The dictionary saves the slave info along with 'root@' as sent from cli. Snapshot while constructing the working dir path to copy configuration files, constructs using this dictionary. But the actual working dir is created with out considering 'root@'. Hence the issue. Fix: Fix is done at two layers. 1. Parse and negelect 'root@' in cli itself. 2. For existing geo-rep sessions and upgrade scenarios, parse and neglect 'root@' in snapshot code as well. BUG: 1233056 Change-Id: Ic666e43a1c4ac2f3f0fb957caa77770e1eee4129 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/11233 Reviewed-on: http://review.gluster.org/11310 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index e72b8a36b6b..aec5384bd01 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2427,6 +2427,9 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
"push-pem", "detail", "pause",
"resume", NULL };
char *w = NULL;
+ char *save_ptr = NULL;
+ char *slave_temp = NULL;
+ char *token = NULL;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -2583,14 +2586,29 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
ret = dict_set_str (dict, "volname",
(char *)words[masteri]);
}
- if (!ret && slavei)
- ret = dict_set_str (dict, "slave", (char *)words[slavei]);
+ if (!ret && slavei) {
+ /* If geo-rep is created with root user using the syntax
+ * gluster vol geo-rep <mastervol> root@<slavehost> ...
+ * pass down only <slavehost> else pass as it is.
+ */
+ slave_temp = gf_strdup (words[slavei]);
+ token = strtok_r (slave_temp, "@", &save_ptr);
+ if (token && !strcmp (token, "root")) {
+ ret = dict_set_str (dict, "slave",
+ (char *)words[slavei]+5);
+ } else {
+ ret = dict_set_str (dict, "slave",
+ (char *)words[slavei]);
+ }
+ }
if (!ret)
ret = dict_set_int32 (dict, "type", type);
if (!ret && type == GF_GSYNC_OPTION_TYPE_CONFIG)
ret = config_parse (words, wordcount, dict, cmdi, glob);
out:
+ if (slave_temp)
+ GF_FREE (slave_temp);
if (ret) {
if (dict)
dict_destroy (dict);