summaryrefslogtreecommitdiffstats
path: root/geo-replication
diff options
context:
space:
mode:
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):