geo-rep: Fix sync-method config

Problem:
When 'use_tarssh' is set to true, it exits with successful
message but the default 'rsync' was used as sync-engine.
The new config 'sync-method' is not allowed to set from cli.

Analysis and Fix:
The 'use_tarssh' config is deprecated with new
config framework and 'sync-method' is the new
config to choose sync-method i.e. tarssh or rsync.
This patch fixes the 'sync-method' config. The allowed
values are tarssh and rsync.

Backport of:
 > Patch: https://review.gluster.org/22683
 > Change-Id: I0edb0319cad0455b29e49f2f08a64ce324735e84
 > BUG: 1707686
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>

Change-Id: I0edb0319cad0455b29e49f2f08a64ce324735e84
fixes: bz#1709737
Signed-off-by: Kotresh HR <khiremat@redhat.com>
This commit is contained in:
Kotresh HR 2019-05-08 10:56:31 +05:30 committed by Amar Tumballi
parent 219c9bc92c
commit 072a21576a
4 changed files with 11 additions and 9 deletions

View File

@ -128,10 +128,11 @@ value=
value=5
type=int
[use-tarssh]
value=false
type=bool
help=Use sync-mode as tarssh
[sync-method]
value=rsync
help=Sync method for data sync. Available methods are tar over ssh and rsync. Default is rsync.
validation=choice
allowed_values=tarssh,rsync
[remote-gsyncd]
value =

View File

@ -1512,7 +1512,7 @@ class SSH(object):
return po
def tarssh(self, files, slaveurl, log_err=False):
def tarssh(self, files, log_err=False):
"""invoke tar+ssh
-z (compress) can be use if needed, but omitting it now
as it results in weird error (tar+ssh errors out (errcode: 2)
@ -1520,10 +1520,11 @@ class SSH(object):
if not files:
raise GsyncdError("no files to sync")
logging.debug("files: " + ", ".join(files))
(host, rdir) = slaveurl.split(':')
(host, rdir) = self.slaveurl.split(':')
tar_cmd = ["tar"] + \
["--sparse", "-cf", "-", "--files-from", "-"]
ssh_cmd = gconf.get("ssh-command-tar").split() + \
ssh_cmd = gconf.get("ssh-command").split() + \
gconf.get("ssh-options-tar").split() + \
["-p", str(gconf.get("ssh-port"))] + \
[host, "tar"] + \

View File

@ -81,7 +81,7 @@ TEST $GEOREP_CLI $master $slave config use_meta_volume true
TEST $CLI volume set $GMV0 changelog.rollover-time 3
#Config tarssh as sync-engine
TEST $GEOREP_CLI $master $slave config use_tarssh true
TEST $GEOREP_CLI $master $slave config sync-method tarssh
#Wait for common secret pem file to be created
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file

View File

@ -81,7 +81,7 @@ TEST $GEOREP_CLI $master $slave config use_meta_volume true
TEST $CLI volume set $GMV0 changelog.rollover-time 3
#Config tarssh as sync-engine
TEST $GEOREP_CLI $master $slave config use_tarssh true
TEST $GEOREP_CLI $master $slave config sync-method tarssh
#Wait for common secret pem file to be created
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file