summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-09-14 03:42:26 -0400
committerKotresh HR <khiremat@redhat.com>2018-09-19 04:10:40 +0000
commit112b50070861101be2d6cc8d8e96af75359a8ca3 (patch)
tree450d36c88a0e57d159188f7b720450fcbc65206d
parentf4594a3c88cb0a76e260010d57632dc1c718fd5f (diff)
geo-rep: Fix issues related config set
1. '--ignore-mising-args' option for rsync is not being used even though the rsync version is greater than 3.1.0. Fixed the same. 2. '--existing' option for rsync is also not being used. Fixed the same. 3. geo-rep config fails to set rsync-options as the value contains '--'. Interestingly, python argsparse treats the value with '--' (e.g., --ignore-missing-args) as option. But when passed with something like --value=--ignore-missing-args, it succeeds. Fixed the same. Backport of: > Patch: https://review.gluster.org/21191 > Change-Id: Iaeb838acaff1c2920fee9c7f920c99edce13a0a1 > Signed-off-by: Kotresh HR <khiremat@redhat.com> > BUG: 1629561 (cherry picked from commit b977b44dd0adfcd7a3b432844260de4b8d1c4adf) Change-Id: Iaeb838acaff1c2920fee9c7f920c99edce13a0a1 Signed-off-by: Kotresh HR <khiremat@redhat.com> fixes: bz#1630673
-rw-r--r--geo-replication/gsyncd.conf.in6
-rw-r--r--geo-replication/syncdaemon/argsupgrade.py8
-rw-r--r--geo-replication/syncdaemon/gsyncd.py4
-rw-r--r--tests/00-geo-rep/georep-basic-dr-rsync.t4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c4
6 files changed, 20 insertions, 11 deletions
diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in
index ce4ef9b663a..b93af282cb3 100644
--- a/geo-replication/gsyncd.conf.in
+++ b/geo-replication/gsyncd.conf.in
@@ -307,10 +307,12 @@ value=
value=
[rsync-opt-ignore-missing-args]
-value=
+value=true
+type=bool
[rsync-opt-existing]
-value=
+value=true
+type=bool
[log-rsync-performance]
value=false
diff --git a/geo-replication/syncdaemon/argsupgrade.py b/geo-replication/syncdaemon/argsupgrade.py
index 632271daf81..4018143b8b4 100644
--- a/geo-replication/syncdaemon/argsupgrade.py
+++ b/geo-replication/syncdaemon/argsupgrade.py
@@ -268,7 +268,9 @@ def upgrade():
p = ArgumentParser()
p.add_argument("master")
p.add_argument("slave")
- p.add_argument("--config-set", nargs=2)
+ p.add_argument("--config-set", action='store_true')
+ p.add_argument("name")
+ p.add_argument("--value")
p.add_argument("-c")
pargs = p.parse_known_args(sys.argv[1:])[0]
@@ -280,8 +282,8 @@ def upgrade():
"config-set",
pargs.master.strip(":"),
slave_url(pargs.slave),
- pargs.config_set[0],
- pargs.config_set[1]
+ "--name=%s" % pargs.name,
+ "--value=%s" % pargs.value
]
elif "--config-check" in sys.argv:
# --config-check georep_session_working_dir
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
index a7ee5553deb..037f351151b 100644
--- a/geo-replication/syncdaemon/gsyncd.py
+++ b/geo-replication/syncdaemon/gsyncd.py
@@ -165,8 +165,8 @@ def main():
p = sp.add_parser("config-set")
p.add_argument("master", help="Master Volume Name")
p.add_argument("slave", help="Slave")
- p.add_argument("name", help="Config Name")
- p.add_argument("value", help="Config Value")
+ p.add_argument("-n", "--name", help="Config Name")
+ p.add_argument("-v", "--value", help="Config Value")
p.add_argument("-c", "--config-file", help="Config File")
p.add_argument("--debug", action="store_true")
diff --git a/tests/00-geo-rep/georep-basic-dr-rsync.t b/tests/00-geo-rep/georep-basic-dr-rsync.t
index 347961f3f54..4c330de1c10 100644
--- a/tests/00-geo-rep/georep-basic-dr-rsync.t
+++ b/tests/00-geo-rep/georep-basic-dr-rsync.t
@@ -196,6 +196,10 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_hardlink_rename_data ${slave_mnt}
#rsnapshot usecase
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rsnapshot_data ${slave_mnt}
+#Test rsync-options set BUG:1629561
+TEST gluster volume geo-rep $master $slave config rsync-options "--whole-file"
+TEST "echo sampledata > $master_mnt/rsync_option_test_file"
+
#Verify arequal for whole volume
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt}
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 075fdf74369..39617be827b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -4314,8 +4314,9 @@ glusterd_gsync_configure(glusterd_volinfo_t *volinfo, char *slave,
runner_add_arg(&runner, slave);
runner_argprintf(&runner, "--config-%s", subop);
runner_add_arg(&runner, op_name);
- if (op_value)
- runner_add_arg(&runner, op_value);
+ if (op_value) {
+ runner_argprintf(&runner, "--value=%s", op_value);
+ }
if (strcmp(op_name, "checkpoint") != 0 && strtail(subop, "set")) {
ret = glusterd_gsync_op_already_set(master, slave, conf_path, op_name,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index d1efce4aef1..1214b6cbb19 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -8151,8 +8151,8 @@ glusterd_start_gsync(glusterd_volinfo_t *master_vol, char *slave,
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", path_list, "-c", NULL);
runner_argprintf(&runner, "%s", conf_path);
runner_argprintf(&runner, ":%s", master_vol->volname);
- runner_add_args(&runner, slave, "--config-set", "session-owner", uuid_str,
- NULL);
+ runner_add_args(&runner, slave, "--config-set", "session-owner", NULL);
+ runner_argprintf(&runner, "--value=%s", uuid_str);
synclock_unlock(&priv->big_lock);
ret = runner_run(&runner);
synclock_lock(&priv->big_lock);