geo-rep: Log Rsync performance
Introducing configurable option to log the rsync performance. gluster volume geo-replication <MASTERVOL> <SLAVEHOST>::<SLAVEVOL> \ config log-rsync-performance true Default value is False. Example log: [2015-03-31 16:48:34.572022] I [resource(/bricks/b1):857:rsync] SSH: rsync performance: Number of files: 2 (reg: 1, dir: 1), Number of regular files transferred: 1, Total file size: 178 bytes, Total transferred file size: 178 bytes, Literal data: 178 bytes, Matched data: 0 bytes, Total bytes sent: 294, Total bytes received: 32, sent 294 bytes received 32 bytes 652.00 bytes/sec Change-Id: If11467e29e6ac502fa114bd5742a8434b7084f98 Signed-off-by: Aravinda VK <avishwan@redhat.com> BUG: 764827 Reviewed-on: http://review.gluster.org/10070 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
cf5bf1863d
commit
fea8d97012
@ -233,6 +233,8 @@ def main_i():
|
||||
op.add_option('--use-rsync-xattrs', default=False, action='store_true')
|
||||
op.add_option('--sync-xattrs', default=True, action='store_true')
|
||||
op.add_option('--sync-acls', default=True, action='store_true')
|
||||
op.add_option('--log-rsync-performance', default=False,
|
||||
action='store_true')
|
||||
op.add_option('--pause-on-start', default=False, action='store_true')
|
||||
op.add_option('-L', '--log-level', metavar='LVL')
|
||||
op.add_option('-r', '--remote-gsyncd', metavar='CMD',
|
||||
|
@ -833,12 +833,29 @@ class SlaveRemote(object):
|
||||
(boolify(gconf.sync_xattrs) and ['--xattrs'] or []) + \
|
||||
(boolify(gconf.sync_acls) and ['--acls'] or []) + \
|
||||
['.'] + list(args)
|
||||
po = Popen(argv, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
po = Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
for f in files:
|
||||
po.stdin.write(f)
|
||||
po.stdin.write('\0')
|
||||
|
||||
po.stdin.close()
|
||||
|
||||
if gconf.log_rsync_performance:
|
||||
out = po.stdout.read()
|
||||
rsync_msg = []
|
||||
for line in out.split("\n"):
|
||||
if line.startswith("Number of files:") or \
|
||||
line.startswith("Number of regular files transferred:") or \
|
||||
line.startswith("Total file size:") or \
|
||||
line.startswith("Total transferred file size:") or \
|
||||
line.startswith("Literal data:") or \
|
||||
line.startswith("Matched data:") or \
|
||||
line.startswith("Total bytes sent:") or \
|
||||
line.startswith("Total bytes received:") or \
|
||||
line.startswith("sent "):
|
||||
rsync_msg.append(line)
|
||||
logging.info("rsync performance: %s" % ", ".join(rsync_msg))
|
||||
po.wait()
|
||||
po.terminate_geterr(fail_on_err=False)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user