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