21ab4e
From f34a1a12427043c9409df0861a3b95e6350e1107 Mon Sep 17 00:00:00 2001
21ab4e
From: Kotresh HR <khiremat@redhat.com>
21ab4e
Date: Tue, 10 Jan 2017 15:39:55 -0500
21ab4e
Subject: [PATCH 312/361] geo-rep: Separate slave mount logs for each
21ab4e
 connection
21ab4e
21ab4e
Geo-rep worker mounts the slave volume on the slave
21ab4e
node. If multiple worker connects to same slave node,
21ab4e
all workers share the same mount log file. This
21ab4e
is very difficult to debug as logs are cluttered from
21ab4e
different mounts. Hence creating separate mount log
21ab4e
file for each connection from worker. Each connection
21ab4e
from worker is identified uniquely using 'mastervol uuid',
21ab4e
'master host', 'master brickpath', 'salve vol'. The log
21ab4e
file name will be combination of the above.
21ab4e
21ab4e
mainline:
21ab4e
> BUG: 1412689
21ab4e
> Reviewed-on: http://review.gluster.org/16384
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
21ab4e
(cherry picked from commit 67d1410d2cc8539a026ce6e62f9783c836b2f407)
21ab4e
21ab4e
BUG: 1414750
21ab4e
Change-Id: I67871dc8e8ea5864e2ad55e2a82063be0138bf0c
21ab4e
Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/101292
21ab4e
Tested-by: Milind Changire <mchangir@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 geo-replication/syncdaemon/configinterface.py | 12 ++++++++++++
21ab4e
 geo-replication/syncdaemon/gsyncd.py          |  4 +++-
21ab4e
 geo-replication/syncdaemon/resource.py        |  6 ++++++
21ab4e
 xlators/mgmt/glusterd/src/glusterd-geo-rep.c  |  6 +++---
21ab4e
 xlators/mgmt/glusterd/src/glusterd.c          |  6 +++---
21ab4e
 5 files changed, 27 insertions(+), 7 deletions(-)
21ab4e
21ab4e
diff --git a/geo-replication/syncdaemon/configinterface.py b/geo-replication/syncdaemon/configinterface.py
21ab4e
index b5935df..50e7aed 100644
21ab4e
--- a/geo-replication/syncdaemon/configinterface.py
21ab4e
+++ b/geo-replication/syncdaemon/configinterface.py
21ab4e
@@ -78,6 +78,18 @@ CONFIGS = (
21ab4e
      "${slavevol}/${eSlave}.status",
21ab4e
      GLUSTERD_WORKDIR + "/geo-replication/${mastervol}_${remotehost}_"
21ab4e
      "${slavevol}/monitor.status"),
21ab4e
+    ("peersrx .",
21ab4e
+     "log_file",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${eSlave}.log",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log"),
21ab4e
+    ("peersrx .",
21ab4e
+     "log_file_mbr",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/mbr/${session_owner}:${eSlave}.log",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log"),
21ab4e
+    ("peersrx .",
21ab4e
+     "gluster_log_file",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${eSlave}.gluster.log",
21ab4e
+     "${iprefix}/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log")
21ab4e
 )
21ab4e
 
21ab4e
 
21ab4e
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
21ab4e
index 76d9939..eccc5ea 100644
21ab4e
--- a/geo-replication/syncdaemon/gsyncd.py
21ab4e
+++ b/geo-replication/syncdaemon/gsyncd.py
21ab4e
@@ -413,7 +413,8 @@ def main_i():
21ab4e
                 if (o.callback in (store_abs, 'store_true', None) and
21ab4e
                     o.get_opt_string() not in ('--version', '--help'))]
21ab4e
     remote_tunables = ['listen', 'go_daemon', 'timeout',
21ab4e
-                       'session_owner', 'config_file', 'use_rsync_xattrs']
21ab4e
+                       'session_owner', 'config_file', 'use_rsync_xattrs',
21ab4e
+                       'local_id', 'local_node']
21ab4e
     rq_remote_tunables = {'listen': True}
21ab4e
 
21ab4e
     # precedence for sources of values: 1) commandline, 2) cfg file, 3)
21ab4e
@@ -541,6 +542,7 @@ def main_i():
21ab4e
                 namedict[name + 'vol'] = x.volume
21ab4e
                 if name == 'remote':
21ab4e
                     namedict['remotehost'] = x.remotehost
21ab4e
+
21ab4e
     if not 'config_file' in rconf:
21ab4e
         rconf['config_file'] = TMPL_CONFIG_FILE
21ab4e
 
21ab4e
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
21ab4e
index be97b16..9ac5c2d 100644
21ab4e
--- a/geo-replication/syncdaemon/resource.py
21ab4e
+++ b/geo-replication/syncdaemon/resource.py
21ab4e
@@ -970,6 +970,12 @@ class SlaveRemote(object):
21ab4e
         so = getattr(gconf, 'session_owner', None)
21ab4e
         if so:
21ab4e
             extra_opts += ['--session-owner', so]
21ab4e
+        li = getattr(gconf, 'local_id', None)
21ab4e
+        if li:
21ab4e
+            extra_opts += ['--local-id', li]
21ab4e
+        ln = getattr(gconf, 'local_node', None)
21ab4e
+        if ln:
21ab4e
+            extra_opts += ['--local-node', ln]
21ab4e
         if boolify(gconf.use_rsync_xattrs):
21ab4e
             extra_opts.append('--use-rsync-xattrs')
21ab4e
         po = Popen(rargs + gconf.remote_gsyncd.split() + extra_opts +
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
21ab4e
index 9a702b7..872f3ff 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
21ab4e
@@ -6123,7 +6123,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path)
21ab4e
         runinit_gsyncd_setrx (&runner, conf_path);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "log-file",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
@@ -6131,7 +6131,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path)
21ab4e
         runinit_gsyncd_setrx (&runner, conf_path);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "log-file-mbr",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${eSlave}.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
@@ -6139,7 +6139,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path)
21ab4e
         runinit_gsyncd_setrx (&runner, conf_path);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "gluster-log-file",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.gluster.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
21ab4e
index 3bcf2d5..6599c53 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd.c
21ab4e
@@ -804,7 +804,7 @@ configure_syncdaemon (glusterd_conf_t *conf)
21ab4e
         runinit_gsyncd_setrx (&runner, conf);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "log-file",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
@@ -812,7 +812,7 @@ configure_syncdaemon (glusterd_conf_t *conf)
21ab4e
         runinit_gsyncd_setrx (&runner, conf);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "log-file-mbr",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${eSlave}.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
@@ -820,7 +820,7 @@ configure_syncdaemon (glusterd_conf_t *conf)
21ab4e
         runinit_gsyncd_setrx (&runner, conf);
21ab4e
         runner_add_args (&runner,
21ab4e
                          "gluster-log-file",
21ab4e
-                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.gluster.log",
21ab4e
+                         DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log",
21ab4e
                          ".", NULL);
21ab4e
         RUN_GSYNCD_CMD;
21ab4e
 
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e