|
|
256ebe |
From d148248aa3f0dfe7356a13d6fd029f0c6b3746cf Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
256ebe |
Date: Wed, 8 May 2019 10:56:31 +0530
|
|
|
256ebe |
Subject: [PATCH 162/169] geo-rep: Fix sync-method config
|
|
|
256ebe |
|
|
|
256ebe |
Problem:
|
|
|
256ebe |
When 'use_tarssh' is set to true, it exits with successful
|
|
|
256ebe |
message but the default 'rsync' was used as sync-engine.
|
|
|
256ebe |
The new config 'sync-method' is not allowed to set from cli.
|
|
|
256ebe |
|
|
|
256ebe |
Analysis and Fix:
|
|
|
256ebe |
The 'use_tarssh' config is deprecated with new
|
|
|
256ebe |
config framework and 'sync-method' is the new
|
|
|
256ebe |
config to choose sync-method i.e. tarssh or rsync.
|
|
|
256ebe |
This patch fixes the 'sync-method' config. The allowed
|
|
|
256ebe |
values are tarssh and rsync.
|
|
|
256ebe |
|
|
|
256ebe |
Backport of:
|
|
|
256ebe |
> Patch: https://review.gluster.org/22683
|
|
|
256ebe |
> Change-Id: I0edb0319cad0455b29e49f2f08a64ce324735e84
|
|
|
256ebe |
> BUG: 1707686
|
|
|
256ebe |
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: I0edb0319cad0455b29e49f2f08a64ce324735e84
|
|
|
256ebe |
fixes: bz#1708067
|
|
|
256ebe |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/172394
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Sunny Kumar <sunkumar@redhat.com>
|
|
|
256ebe |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
geo-replication/gsyncd.conf.in | 9 +++++----
|
|
|
256ebe |
geo-replication/syncdaemon/resource.py | 7 ++++---
|
|
|
256ebe |
tests/00-geo-rep/georep-basic-dr-rsync-arbiter.t | 4 ++--
|
|
|
256ebe |
tests/00-geo-rep/georep-basic-dr-rsync.t | 4 ++--
|
|
|
256ebe |
tests/00-geo-rep/georep-basic-dr-tarssh-arbiter.t | 6 +++---
|
|
|
256ebe |
tests/00-geo-rep/georep-basic-dr-tarssh.t | 6 +++---
|
|
|
256ebe |
tests/geo-rep.rc | 3 ++-
|
|
|
256ebe |
7 files changed, 21 insertions(+), 18 deletions(-)
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in
|
|
|
256ebe |
index 6160c7c..c2e4f0d 100644
|
|
|
256ebe |
--- a/geo-replication/gsyncd.conf.in
|
|
|
256ebe |
+++ b/geo-replication/gsyncd.conf.in
|
|
|
256ebe |
@@ -128,10 +128,11 @@ value=
|
|
|
256ebe |
value=5
|
|
|
256ebe |
type=int
|
|
|
256ebe |
|
|
|
256ebe |
-[use-tarssh]
|
|
|
256ebe |
-value=false
|
|
|
256ebe |
-type=bool
|
|
|
256ebe |
-help=Use sync-mode as tarssh
|
|
|
256ebe |
+[sync-method]
|
|
|
256ebe |
+value=rsync
|
|
|
256ebe |
+help=Sync method for data sync. Available methods are tar over ssh and rsync. Default is rsync.
|
|
|
256ebe |
+validation=choice
|
|
|
256ebe |
+allowed_values=tarssh,rsync
|
|
|
256ebe |
|
|
|
256ebe |
[remote-gsyncd]
|
|
|
256ebe |
value =
|
|
|
256ebe |
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
|
|
|
256ebe |
index f54ccd9..522279b 100644
|
|
|
256ebe |
--- a/geo-replication/syncdaemon/resource.py
|
|
|
256ebe |
+++ b/geo-replication/syncdaemon/resource.py
|
|
|
256ebe |
@@ -1512,7 +1512,7 @@ class SSH(object):
|
|
|
256ebe |
|
|
|
256ebe |
return po
|
|
|
256ebe |
|
|
|
256ebe |
- def tarssh(self, files, slaveurl, log_err=False):
|
|
|
256ebe |
+ def tarssh(self, files, log_err=False):
|
|
|
256ebe |
"""invoke tar+ssh
|
|
|
256ebe |
-z (compress) can be use if needed, but omitting it now
|
|
|
256ebe |
as it results in weird error (tar+ssh errors out (errcode: 2)
|
|
|
256ebe |
@@ -1520,10 +1520,11 @@ class SSH(object):
|
|
|
256ebe |
if not files:
|
|
|
256ebe |
raise GsyncdError("no files to sync")
|
|
|
256ebe |
logging.debug("files: " + ", ".join(files))
|
|
|
256ebe |
- (host, rdir) = slaveurl.split(':')
|
|
|
256ebe |
+ (host, rdir) = self.slaveurl.split(':')
|
|
|
256ebe |
+
|
|
|
256ebe |
tar_cmd = ["tar"] + \
|
|
|
256ebe |
["--sparse", "-cf", "-", "--files-from", "-"]
|
|
|
256ebe |
- ssh_cmd = gconf.get("ssh-command-tar").split() + \
|
|
|
256ebe |
+ ssh_cmd = gconf.get("ssh-command").split() + \
|
|
|
256ebe |
gconf.get("ssh-options-tar").split() + \
|
|
|
256ebe |
["-p", str(gconf.get("ssh-port"))] + \
|
|
|
256ebe |
[host, "tar"] + \
|
|
|
256ebe |
diff --git a/tests/00-geo-rep/georep-basic-dr-rsync-arbiter.t b/tests/00-geo-rep/georep-basic-dr-rsync-arbiter.t
|
|
|
256ebe |
index 1a55ed2..8b90347 100644
|
|
|
256ebe |
--- a/tests/00-geo-rep/georep-basic-dr-rsync-arbiter.t
|
|
|
256ebe |
+++ b/tests/00-geo-rep/georep-basic-dr-rsync-arbiter.t
|
|
|
256ebe |
@@ -159,7 +159,7 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1
|
|
|
256ebe |
|
|
|
256ebe |
#logrotate
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
|
|
|
256ebe |
#CREATE+RENAME
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file
|
|
|
256ebe |
@@ -209,7 +209,7 @@ TEST create_rename_with_existing_destination ${master_mnt}
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rename_with_existing_destination ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Verify arequal for whole volume
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Stop Geo-rep
|
|
|
256ebe |
TEST $GEOREP_CLI $master $slave stop
|
|
|
256ebe |
diff --git a/tests/00-geo-rep/georep-basic-dr-rsync.t b/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
256ebe |
index d0c0fc9..428e9ed 100644
|
|
|
256ebe |
--- a/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
256ebe |
+++ b/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
256ebe |
@@ -160,7 +160,7 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1
|
|
|
256ebe |
|
|
|
256ebe |
#logrotate
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
|
|
|
256ebe |
#CREATE+RENAME
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file
|
|
|
256ebe |
@@ -210,7 +210,7 @@ TEST create_rename_with_existing_destination ${master_mnt}
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rename_with_existing_destination ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Verify arequal for whole volume
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Stop Geo-rep
|
|
|
256ebe |
TEST $GEOREP_CLI $master $slave stop
|
|
|
256ebe |
diff --git a/tests/00-geo-rep/georep-basic-dr-tarssh-arbiter.t b/tests/00-geo-rep/georep-basic-dr-tarssh-arbiter.t
|
|
|
256ebe |
index cb530ad..8fed929 100644
|
|
|
256ebe |
--- a/tests/00-geo-rep/georep-basic-dr-tarssh-arbiter.t
|
|
|
256ebe |
+++ b/tests/00-geo-rep/georep-basic-dr-tarssh-arbiter.t
|
|
|
256ebe |
@@ -81,7 +81,7 @@ TEST $GEOREP_CLI $master $slave config use_meta_volume true
|
|
|
256ebe |
TEST $CLI volume set $GMV0 changelog.rollover-time 3
|
|
|
256ebe |
|
|
|
256ebe |
#Config tarssh as sync-engine
|
|
|
256ebe |
-TEST $GEOREP_CLI $master $slave config use_tarssh true
|
|
|
256ebe |
+TEST $GEOREP_CLI $master $slave config sync-method tarssh
|
|
|
256ebe |
|
|
|
256ebe |
#Wait for common secret pem file to be created
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file
|
|
|
256ebe |
@@ -162,7 +162,7 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1
|
|
|
256ebe |
|
|
|
256ebe |
#logrotate
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
|
|
|
256ebe |
#CREATE+RENAME
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file
|
|
|
256ebe |
@@ -208,7 +208,7 @@ TEST create_rename_with_existing_destination ${master_mnt}
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rename_with_existing_destination ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Verify arequal for whole volume
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Stop Geo-rep
|
|
|
256ebe |
TEST $GEOREP_CLI $master $slave stop
|
|
|
256ebe |
diff --git a/tests/00-geo-rep/georep-basic-dr-tarssh.t b/tests/00-geo-rep/georep-basic-dr-tarssh.t
|
|
|
256ebe |
index 9e2f613..feb2de7 100644
|
|
|
256ebe |
--- a/tests/00-geo-rep/georep-basic-dr-tarssh.t
|
|
|
256ebe |
+++ b/tests/00-geo-rep/georep-basic-dr-tarssh.t
|
|
|
256ebe |
@@ -81,7 +81,7 @@ TEST $GEOREP_CLI $master $slave config use_meta_volume true
|
|
|
256ebe |
TEST $CLI volume set $GMV0 changelog.rollover-time 3
|
|
|
256ebe |
|
|
|
256ebe |
#Config tarssh as sync-engine
|
|
|
256ebe |
-TEST $GEOREP_CLI $master $slave config use_tarssh true
|
|
|
256ebe |
+TEST $GEOREP_CLI $master $slave config sync-method tarssh
|
|
|
256ebe |
|
|
|
256ebe |
#Wait for common secret pem file to be created
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file
|
|
|
256ebe |
@@ -162,7 +162,7 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 chown_file_ok ${slave_mnt}/changelog_chown_f1
|
|
|
256ebe |
|
|
|
256ebe |
#logrotate
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/logrotate
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt}/logrotate ${slave_mnt}/logrotate
|
|
|
256ebe |
|
|
|
256ebe |
#CREATE+RENAME
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 create_rename_ok ${slave_mnt}/create_rename_test_file
|
|
|
256ebe |
@@ -208,7 +208,7 @@ TEST create_rename_with_existing_destination ${master_mnt}
|
|
|
256ebe |
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rename_with_existing_destination ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Verify arequal for whole volume
|
|
|
256ebe |
-EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
+EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
256ebe |
|
|
|
256ebe |
#Stop Geo-rep
|
|
|
256ebe |
TEST $GEOREP_CLI $master $slave stop
|
|
|
256ebe |
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
|
|
|
256ebe |
index e357ba8..2035b9f 100644
|
|
|
256ebe |
--- a/tests/geo-rep.rc
|
|
|
256ebe |
+++ b/tests/geo-rep.rc
|
|
|
256ebe |
@@ -168,7 +168,8 @@ function arequal_checksum()
|
|
|
256ebe |
{
|
|
|
256ebe |
master=$1
|
|
|
256ebe |
slave=$2
|
|
|
256ebe |
- diff <(arequal-checksum -p $master) <(arequal-checksum -p $slave) | wc -l
|
|
|
256ebe |
+ ret=$(diff <(arequal-checksum -p $master) <(arequal-checksum -p $slave) | wc -l)
|
|
|
256ebe |
+ echo x$ret
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
function symlink_ok()
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|