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