diff options
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/gsyncd.py | 6 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 28 |
2 files changed, 33 insertions, 1 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index efb0e3aa5..387900e6c 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -17,7 +17,7 @@ from ipaddr import IPAddress, IPNetwork from gconf import gconf from syncdutils import FreeObject, norm, grabpidfile, finalize, log_raise_exception -from syncdutils import GsyncdError, select, set_term_handler +from syncdutils import GsyncdError, select, set_term_handler, privileged from configinterface import GConffile import resource from monitor import monitor @@ -157,6 +157,7 @@ def main_i(): op.add_option('--mountbroker', metavar='LABEL') op.add_option('-p', '--pid-file', metavar='PIDF', type=str, action='callback', callback=store_abs) op.add_option('-l', '--log-file', metavar='LOGF', type=str, action='callback', callback=store_abs) + op.add_option('--log-file-mbr', metavar='LOGF', type=str, action='callback', callback=store_abs) op.add_option('--state-file', metavar='STATF', type=str, action='callback', callback=store_abs) op.add_option('--ignore-deletes', default=False, action='store_true') op.add_option('--use-rsync-xattrs', default=False, action='store_true') @@ -357,6 +358,9 @@ def main_i(): raise GsyncdError('cannot recognize log level "%s"' % lvl0) gconf.log_level = lvl2 + if not privileged() and gconf.log_file_mbr: + gconf.log_file = gconf.log_file_mbr + if checkpoint_change: try: GLogger._gsyncd_loginit(log_file=gconf.log_file, label='conf') diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index cde6c84fe..c2d8d70e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -455,6 +455,7 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf) goto out; } + /* Slave log file directory */ if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves") >= PATH_MAX) { ret = -1; gf_log ("glusterd", GF_LOG_CRITICAL, @@ -470,6 +471,22 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf) goto out; } + /* MountBroker log file directory */ + if (strlen(DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr") >= PATH_MAX) { + ret = -1; + gf_log ("glusterd", GF_LOG_CRITICAL, + "Unable to create "GEOREP" moubtbroker directory %s", + georepdir); + goto out; + } + ret = mkdir_p (DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr", 0777, + _gf_true); + if (-1 == ret) { + gf_log ("glusterd", GF_LOG_CRITICAL, + "Unable to create "GEOREP" mountbroker slave log directory"); + goto out; + } + ret = dict_get_str (THIS->options, GEOREP"-log-group", &greplg_s); if (ret) ret = 0; @@ -487,6 +504,9 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf) if (ret == 0) ret = group_write_allow (DEFAULT_LOG_FILE_DIRECTORY"/" GEOREP"-slaves", gr->gr_gid); + if (ret == 0) + ret = group_write_allow (DEFAULT_LOG_FILE_DIRECTORY"/" + GEOREP"-slaves/mbr", gr->gr_gid); } out: @@ -641,6 +661,14 @@ configure_syncdaemon (glusterd_conf_t *conf) ".", NULL); RUN_GSYNCD_CMD; + /* MountBroker log-file */ + runinit_gsyncd_setrx (&runner, conf); + runner_add_args (&runner, + "log-file-mbr", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/mbr/${session_owner}:${eSlave}.log", + ".", NULL); + RUN_GSYNCD_CMD; + /* gluster-log-file */ runinit_gsyncd_setrx (&runner, conf); runner_add_args (&runner, |