diff options
author | Venky Shankar <vshankar@redhat.com> | 2014-03-19 19:32:15 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2014-06-10 09:55:55 -0700 |
commit | ec5d64eafcd77b1746b83173de16f7ec742af7a6 (patch) | |
tree | 0da4e4dded44f3f5031748f2ed96b249bfa0d04d | |
parent | 99781d55f16373e793138c7b011eea09a62075b9 (diff) |
gsyncd / geo-rep: FSH recommended log locations
Upgrading "working_dir" on the fly is a bit unclean yet
(though it works) as currently config upgrade does not
support "old" values to be expanded by using configuration
variables.
Change-Id: I44ed65c281f2e0ce3b6b467addc5c1c88ac674e7
BUG: 1077516
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Kotresh H R <khiremat@redhat.com>
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Signed-off-by: Ajeet Jha <ajha@redhat.com>
Reviewed-on: http://review.gluster.org/7375
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | cli/src/cli-rpc-ops.c | 1 | ||||
-rw-r--r-- | geo-replication/syncdaemon/configinterface.py | 13 | ||||
-rw-r--r-- | geo-replication/syncdaemon/gsyncd.py | 9 | ||||
-rw-r--r-- | geo-replication/syncdaemon/master.py | 11 | ||||
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 6 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 15 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 1 |
8 files changed, 50 insertions, 11 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 37424c68559..b998fff3f4c 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3914,6 +3914,7 @@ gf_cli_gsync_config_command (dict_t *dict) runinit (&runner); runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "-c", NULL); runner_argprintf (&runner, "%s", confpath); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); if (master) runner_argprintf (&runner, ":%s", master); runner_add_arg (&runner, slave); diff --git a/geo-replication/syncdaemon/configinterface.py b/geo-replication/syncdaemon/configinterface.py index c4d47b5dbda..a94e07f0d4b 100644 --- a/geo-replication/syncdaemon/configinterface.py +++ b/geo-replication/syncdaemon/configinterface.py @@ -47,6 +47,19 @@ CONFIGS = ( "", "ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no " "-i /var/lib/glusterd/geo-replication/tar_ssh.pem"), + ("peersrx . .", + "changelog_log_file", + "", + "${iprefix}/log/glusterfs/geo-replication/${mastervol}" + "/${eSlave}${local_id}-changes.log"), + ("peersrx . .", + "working_dir", + "/var/run/gluster/${mastervol}/${eSlave}", + "${iprefix}/lib/misc/glusterfsd/${mastervol}/${eSlave}"), + ("peersrx . .", + "working_dir", + "/usr/local/var/run/gluster/${mastervol}/${eSlave}", + "${iprefix}/lib/misc/glusterfsd/${mastervol}/${eSlave}"), ) diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 7ddd51267a6..b307b87ae14 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -216,6 +216,10 @@ def main_i(): action='callback', callback=store_abs) op.add_option('-l', '--log-file', metavar='LOGF', type=str, action='callback', callback=store_abs) + op.add_option('--iprefix', metavar='LOGD', type=str, + action='callback', callback=store_abs) + op.add_option('--changelog-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, @@ -253,6 +257,7 @@ def main_i(): op.add_option('--state-socket-unencoded', metavar='SOCKF', type=str, action='callback', callback=store_abs) op.add_option('--checkpoint', metavar='LABEL', default='') + # tunables for failover/failback mechanism: # None - gsyncd behaves as normal # blind - gsyncd works with xtime pairs to identify @@ -302,7 +307,9 @@ def main_i(): setattr( a[-1].values, 'log_file', '-'), setattr(a[-1].values, 'log_level', - 'DEBUG'))), + 'DEBUG'), + setattr(a[-1].values, + 'changelog_log_file', '-'))) op.add_option('--path', type=str, action='append') for a in ('check', 'get'): diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py index 875f2791e0d..94c58bb3c9d 100644 --- a/geo-replication/syncdaemon/master.py +++ b/geo-replication/syncdaemon/master.py @@ -725,6 +725,9 @@ class GMasterChangelogMixin(GMasterCommon): # maximum retries per changelog before giving up MAX_RETRIES = 10 + CHANGELOG_LOG_LEVEL = 9 + CHANGELOG_CONN_RETRIES = 5 + def fallback_xsync(self): logging.info('falling back to xsync mode') gconf.configinterface.set('change-detector', 'xsync') @@ -732,10 +735,8 @@ class GMasterChangelogMixin(GMasterCommon): def setup_working_dir(self): workdir = os.path.join(gconf.working_dir, md5hex(gconf.local_path)) - logfile = os.path.join(workdir, 'changes.log') - logging.debug('changelog working dir %s (log: %s)' % - (workdir, logfile)) - return (workdir, logfile) + logging.debug('changelog working dir %s' % workdir) + return workdir def process_change(self, change, done, retry): pfx = gauxpfx() @@ -1216,7 +1217,7 @@ class GMasterXsyncMixin(GMasterChangelogMixin): self.comlist = [] self.stimes = [] self.sleep_interval = 60 - self.tempdir = self.setup_working_dir()[0] + self.tempdir = self.setup_working_dir() self.tempdir = os.path.join(self.tempdir, 'xsync') logging.info('xsync temp directory: %s' % self.tempdir) try: diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 8192a54b0d4..ca1dd4cf43b 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -1279,12 +1279,14 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): g1.register() try: - (workdir, logfile) = g2.setup_working_dir() + workdir = g2.setup_working_dir() # register with the changelog library # 9 == log level (DEBUG) # 5 == connection retries changelog_agent.register(gconf.local_path, - workdir, logfile, 9, 5) + workdir, gconf.changelog_log_file, + g2.CHANGELOG_LOG_LEVEL, + g2.CHANGELOG_CONN_RETRIES) g2.register(changelog_agent) g3.register(changelog_agent) except ChangelogException as e: diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index aad23158a1d..4867da42aff 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -156,8 +156,9 @@ #define ZR_FILE_CONTENT_REQUEST(key) (!strncmp(key, ZR_FILE_CONTENT_STR, \ ZR_FILE_CONTENT_STRLEN)) -#define DEFAULT_VAR_RUN_DIRECTORY DATADIR "/run/gluster" -#define GF_REPLICATE_TRASH_DIR ".landfill" +#define DEFAULT_VAR_RUN_DIRECTORY DATADIR "/run/gluster" +#define DEFAULT_GLUSTERFSD_MISC_DIRETORY DATADIR "/lib/misc/glusterfsd" +#define GF_REPLICATE_TRASH_DIR ".landfill" /* GlusterFS's maximum supported Auxilary GIDs */ /* TODO: Keeping it to 200, so that we can fit in 2KB buffer for auth data diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index aa3cc99fbff..51496606e2d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -652,6 +652,7 @@ glusterd_gsync_get_config (char *master, char *slave, char *conf_path, dict_t *d runinit (&runner); runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "-c", NULL); runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); runner_argprintf (&runner, ":%s", master); runner_add_args (&runner, slave, "--config-get-all", NULL); @@ -668,6 +669,7 @@ glusterd_gsync_get_param_file (char *prmfile, const char *param, char *master, runinit (&runner); runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "-c", NULL); runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); runner_argprintf (&runner, ":%s", master); runner_add_args (&runner, slave, "--config-get", NULL); runner_argprintf (&runner, "%s-file", param); @@ -1930,6 +1932,7 @@ glusterd_create_status_file (char *master, char *slave, char *slave_ip, status, "-c", NULL); runner_argprintf (&runner, "%s/"GEOREP"/%s_%s_%s/gsyncd.conf", priv->workdir, master, slave_ip, slave_vol); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); runner_argprintf (&runner, ":%s", master); runner_add_args (&runner, slave, NULL); synclock_unlock (&priv->big_lock); @@ -3071,6 +3074,7 @@ glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, runinit (&runner); runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "-c", NULL); runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); if (volinfo) { master = volinfo->volname; runner_argprintf (&runner, ":%s", master); @@ -4019,6 +4023,7 @@ glusterd_gsync_delete (glusterd_volinfo_t *volinfo, char *slave, char *slave_ip, runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "--delete", "-c", NULL); runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); if (volinfo) { master = volinfo->volname; @@ -4896,6 +4901,14 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) ".", ".", NULL); RUN_GSYNCD_CMD; + /* changelog-log-file */ + runinit_gsyncd_setrx (&runner, conf_path); + runner_add_args (&runner, + "changelog-log-file", + DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"/${mastervol}/${eSlave}${local_id}-changes.log", + ".", ".", NULL); + RUN_GSYNCD_CMD; + /* gluster-log-file */ runinit_gsyncd_setrx (&runner, conf_path); runner_add_args (&runner, @@ -4922,7 +4935,7 @@ create_conf_file (glusterd_conf_t *conf, char *conf_path) runinit_gsyncd_setrx (&runner, conf_path); runner_add_arg(&runner, "working-dir"); runner_argprintf(&runner, "%s/${mastervol}/${eSlave}", - DEFAULT_VAR_RUN_DIRECTORY); + DEFAULT_GLUSTERFSD_MISC_DIRETORY); runner_add_args (&runner, ".", ".", NULL); RUN_GSYNCD_CMD; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 1f0e3ef49b5..216dff6e737 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -8515,6 +8515,7 @@ glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave, runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", path_list, "--monitor", "-c", NULL); runner_argprintf (&runner, "%s", conf_path); + runner_argprintf (&runner, "--iprefix=%s", DATADIR); runner_argprintf (&runner, ":%s", master_vol->volname); runner_argprintf (&runner, "--glusterd-uuid=%s", uuid_utoa (priv->uuid)); |