diff options
author | Aravinda VK <avishwan@redhat.com> | 2016-12-12 13:06:15 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-01-08 02:56:22 -0800 |
commit | 84a3d13d723fcfc7a6c194d9f34e031b20554984 (patch) | |
tree | 618ef52306307f358e8c665d88e2a948f4e38493 /geo-replication/syncdaemon | |
parent | 8e67e8a74a9a64844cc7ffc0528771fca3321965 (diff) |
geo-rep: Fix log-rsync-performance config issue
If log-rsync-performance config is not set, gconf.get_realtime
will return None, Added default value as False if config file
doesn't have this option set.
> BUG: 1393678
> Change-Id: I89016ab480a16179db59913d635d8553beb7e14f
> Signed-off-by: Aravinda VK <avishwan@redhat.com>
> Reviewed-on: http://review.gluster.org/16102
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Tested-by: Kotresh HR <khiremat@redhat.com>
> Reviewed-by: Kotresh HR <khiremat@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
BUG: 1402728
Change-Id: I89016ab480a16179db59913d635d8553beb7e14f
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/16340
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon')
-rw-r--r-- | geo-replication/syncdaemon/configinterface.py.in | 17 | ||||
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 9 |
2 files changed, 14 insertions, 12 deletions
diff --git a/geo-replication/syncdaemon/configinterface.py.in b/geo-replication/syncdaemon/configinterface.py.in index e1cf007a2b8..97afff1dda7 100644 --- a/geo-replication/syncdaemon/configinterface.py.in +++ b/geo-replication/syncdaemon/configinterface.py.in @@ -234,7 +234,7 @@ class GConffile(object): self.config.readfp(fp) self._normconfig() - def get_realtime(self, opt): + def get_realtime(self, opt, default_value=None): try: sres = os.stat(self.path) except (OSError, IOError): @@ -248,7 +248,7 @@ class GConffile(object): sres[ST_INO] != self.ino or self.mtime != sres[ST_MTIME]: self._load() - return self.get(opt, printValue=False) + return self.get(opt, printValue=False, default_value=default_value) def section(self, rx=False): """get the section name of the section representing .peers @@ -347,7 +347,7 @@ class GConffile(object): if self.config.has_section(self.section()): update_from_sect(self.section(), MultiDict(dct, *self.auxdicts)) - def get(self, opt=None, printValue=True): + def get(self, opt=None, printValue=True, default_value=None): """print the matching key/value pairs from .config, or if @opt given, the value for @opt (according to the logic described in .update_to) @@ -356,12 +356,13 @@ class GConffile(object): self.update_to(d, allow_unresolved=True) if opt: opt = norm(opt) - v = d.get(opt) - if v: - if printValue: + v = d.get(opt, default_value) + + if printValue: + if v is not None: print(v) - else: - return v + else: + return v else: for k, v in d.iteritems(): if k == '__name__': diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 7daf7e49211..ecb94d56c7f 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -1003,8 +1003,10 @@ class SlaveRemote(object): (boolify(gconf.sync_acls) and ['--acls'] or []) + \ ['.'] + list(args) - if boolify(gconf.configinterface.get_realtime( - "log_rsync_performance")): + log_rsync_performance = boolify(gconf.configinterface.get_realtime( + "log_rsync_performance", default_value=False)) + + if log_rsync_performance: # use stdout=PIPE only when log_rsync_performance enabled # Else rsync will write to stdout and nobody is their # to consume. If PIPE is full rsync hangs. @@ -1023,8 +1025,7 @@ class SlaveRemote(object): for errline in stderr.strip().split("\n")[:-1]: logging.error("SYNC Error(Rsync): %s" % errline) - if boolify(gconf.configinterface.get_realtime( - "log_rsync_performance")): + if log_rsync_performance: rsync_msg = [] for line in stdout.split("\n"): if line.startswith("Number of files:") or \ |