|
|
e3c68b |
From ed6cd2b7674896c810fdd059e35a0d319aacb068 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Shwetha K Acharya <sacharya@redhat.com>
|
|
|
e3c68b |
Date: Tue, 2 Jul 2019 15:00:25 +0530
|
|
|
e3c68b |
Subject: [PATCH 257/261] geo-rep: Test case for upgrading config file
|
|
|
e3c68b |
|
|
|
e3c68b |
Added test case for the patch
|
|
|
e3c68b |
https://review.gluster.org/#/c/glusterfs/+/22894/4
|
|
|
e3c68b |
|
|
|
e3c68b |
Also updated if else structure in gsyncdconfig.py to avoid
|
|
|
e3c68b |
repeated occurance of values in new configfile.
|
|
|
e3c68b |
|
|
|
e3c68b |
>fixes: bz#1707731
|
|
|
e3c68b |
>Change-Id: If97e1d37ac52dbd17d47be6cb659fc5a3ccab6d7
|
|
|
e3c68b |
>Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
|
|
|
e3c68b |
|
|
|
e3c68b |
backport of https://review.gluster.org/#/c/glusterfs/+/22982/
|
|
|
e3c68b |
|
|
|
e3c68b |
Bug: 1708064
|
|
|
e3c68b |
Change-Id: If97e1d37ac52dbd17d47be6cb659fc5a3ccab6d7
|
|
|
e3c68b |
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/176603
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
geo-replication/syncdaemon/gsyncdconfig.py | 11 +++++------
|
|
|
e3c68b |
tests/00-geo-rep/georep-basic-dr-rsync.t | 13 +++++++++++++
|
|
|
e3c68b |
2 files changed, 18 insertions(+), 6 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/geo-replication/syncdaemon/gsyncdconfig.py b/geo-replication/syncdaemon/gsyncdconfig.py
|
|
|
e3c68b |
index 7edc582..1fc451f 100644
|
|
|
e3c68b |
--- a/geo-replication/syncdaemon/gsyncdconfig.py
|
|
|
e3c68b |
+++ b/geo-replication/syncdaemon/gsyncdconfig.py
|
|
|
e3c68b |
@@ -353,15 +353,14 @@ def config_upgrade(config_file, ret):
|
|
|
e3c68b |
new_value = "tarssh"
|
|
|
e3c68b |
else:
|
|
|
e3c68b |
new_value = "rsync"
|
|
|
e3c68b |
- config.set('vars', new_key, new_value)
|
|
|
e3c68b |
-
|
|
|
e3c68b |
- if key == "timeout":
|
|
|
e3c68b |
+ config.set('vars', new_key, new_value)
|
|
|
e3c68b |
+ elif key == "timeout":
|
|
|
e3c68b |
new_key = "slave-timeout"
|
|
|
e3c68b |
config.set('vars', new_key, value)
|
|
|
e3c68b |
-
|
|
|
e3c68b |
#for changes like: ignore_deletes to ignore-deletes
|
|
|
e3c68b |
- new_key = key.replace("_", "-")
|
|
|
e3c68b |
- config.set('vars', new_key, value)
|
|
|
e3c68b |
+ else:
|
|
|
e3c68b |
+ new_key = key.replace("_", "-")
|
|
|
e3c68b |
+ config.set('vars', new_key, value)
|
|
|
e3c68b |
|
|
|
e3c68b |
with open(config_file, 'w') as configfile:
|
|
|
e3c68b |
config.write(configfile)
|
|
|
e3c68b |
diff --git a/tests/00-geo-rep/georep-basic-dr-rsync.t b/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
e3c68b |
index 428e9ed..b432635 100644
|
|
|
e3c68b |
--- a/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
e3c68b |
+++ b/tests/00-geo-rep/georep-basic-dr-rsync.t
|
|
|
e3c68b |
@@ -212,6 +212,19 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rename_with_existing_destination ${slave
|
|
|
e3c68b |
#Verify arequal for whole volume
|
|
|
e3c68b |
EXPECT_WITHIN $GEO_REP_TIMEOUT "x0" arequal_checksum ${master_mnt} ${slave_mnt}
|
|
|
e3c68b |
|
|
|
e3c68b |
+#Test config upgrade BUG: 1707731
|
|
|
e3c68b |
+config_file=$GLUSTERD_WORKDIR/geo-replication/${GMV0}_${SH0}_${GSV0}/gsyncd.conf
|
|
|
e3c68b |
+cat >> $config_file<
|
|
|
e3c68b |
+[peers ${GMV0} ${GSV0}]
|
|
|
e3c68b |
+use_tarssh = true
|
|
|
e3c68b |
+timeout = 1
|
|
|
e3c68b |
+EOL
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave stop
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave start
|
|
|
e3c68b |
+#verify that the config file is updated
|
|
|
e3c68b |
+EXPECT "1" echo $(grep -Fc "vars" $config_file)
|
|
|
e3c68b |
+EXPECT "1" echo $(grep -Fc "sync-method = tarssh" $config_file)
|
|
|
e3c68b |
+EXPECT "1" echo $(grep -Fc "slave-timeout = 1" $config_file)
|
|
|
e3c68b |
#Stop Geo-rep
|
|
|
e3c68b |
TEST $GEOREP_CLI $master $slave stop
|
|
|
e3c68b |
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|