summaryrefslogtreecommitdiffstats
path: root/geo-replication
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2017-11-24 12:11:16 +0530
committerKotresh HR <khiremat@redhat.com>2017-11-27 06:22:47 +0000
commit493545657bd122ba63d77553873c7f433fb74d04 (patch)
treec6dcee900e2eabce5755353b27bfd92ce13b949e /geo-replication
parent683b15a6a2e6c0efbb45db3fd97b9cf08c4f7194 (diff)
geo-rep: Fix slave side custom config issue
Slave gsyncd will not use session config files, Slave configs are stored in Master config file itself and sent as argument to slave gsyncd. With this patch, gconf default values are overwritten if argument name starts with "slave-" Change-Id: Iebc51f52232c0cd30b29199f03015f97b70ce537 Signed-off-by: Aravinda VK <avishwan@redhat.com> BUG: 1517068
Diffstat (limited to 'geo-replication')
-rw-r--r--geo-replication/syncdaemon/gsyncd.py8
-rw-r--r--geo-replication/syncdaemon/gsyncdconfig.py17
2 files changed, 21 insertions, 4 deletions
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
index f58b532bcda..ae7b701a10c 100644
--- a/geo-replication/syncdaemon/gsyncd.py
+++ b/geo-replication/syncdaemon/gsyncd.py
@@ -235,11 +235,17 @@ def main():
rconf.config_file = config_file
+ # Override gconf values from argument values only if it is slave gsyncd
+ override_from_args = False
+ if args.subcmd == "slave":
+ override_from_args = True
+
# Load Config file
gconf.load(GLUSTERFS_CONFDIR + "/gsyncd.conf",
config_file,
vars(args),
- extra_tmpl_args)
+ extra_tmpl_args,
+ override_from_args)
# Default label to print in log file
label = args.subcmd
diff --git a/geo-replication/syncdaemon/gsyncdconfig.py b/geo-replication/syncdaemon/gsyncdconfig.py
index a5843801671..9ca6ef37105 100644
--- a/geo-replication/syncdaemon/gsyncdconfig.py
+++ b/geo-replication/syncdaemon/gsyncdconfig.py
@@ -19,7 +19,7 @@ class GconfInvalidValue(Exception):
class Gconf(object):
def __init__(self, default_conf_file, custom_conf_file=None,
- args={}, extra_tmpl_args={}):
+ args={}, extra_tmpl_args={}, override_from_args=False):
self.default_conf_file = default_conf_file
self.custom_conf_file = custom_conf_file
self.tmp_conf_file = None
@@ -35,6 +35,7 @@ class Gconf(object):
self.session_conf_items = []
self.args = args
self.extra_tmpl_args = extra_tmpl_args
+ self.override_from_args = override_from_args
self._load()
def _tmpl_substitute(self):
@@ -197,6 +198,14 @@ class Gconf(object):
self.session_conf_items.append(k)
self.gconf[k] = v.strip()
+ # Overwrite the Slave configurations which are sent as
+ # arguments to gsyncd slave
+ if self.override_from_args:
+ for k, v in self.args.items():
+ k = k.replace("_", "-")
+ if k.startswith("slave-") and k in self.gconf:
+ self.gconf[k] = v
+
self._tmpl_substitute()
self._do_typecast()
@@ -345,9 +354,11 @@ def getr(name, default_value=None):
return _gconf.getr(name, default_value)
-def load(default_conf, custom_conf=None, args={}, extra_tmpl_args={}):
+def load(default_conf, custom_conf=None, args={}, extra_tmpl_args={},
+ override_from_args=False):
global _gconf
- _gconf = Gconf(default_conf, custom_conf, args, extra_tmpl_args)
+ _gconf = Gconf(default_conf, custom_conf, args, extra_tmpl_args,
+ override_from_args)
def setconfig(name, value):