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