diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-03-14 05:01:31 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-14 04:57:00 -0700 |
commit | 9043b0f8b927e687decc738cf736e603436e9e51 (patch) | |
tree | d9a16bf5040e33c1197e6d0ca31b265a5594dcda /xlators/mgmt/glusterd/src/glusterd.c | |
parent | eadce9083876fb71d1be8f77715866fc8af45ba4 (diff) |
mgmt/Glusterd: Make use of regexp pattern-matching sections to set a sane value for remote-gsyncd
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2427 (set a proper default for remote syncdaemon)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2427
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 732a9a3e2b5..570fd1662a8 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -233,6 +233,7 @@ init (xlator_t *this) char dirname [PATH_MAX]; char cmd_log_filename [PATH_MAX] = {0,}; int first_time = 0; + char cmd [PATH_MAX] = {0,}; dir_data = dict_get (this->options, "working-directory"); @@ -323,7 +324,41 @@ init (xlator_t *this) " ,errno = %d", voldir, errno); exit (1); } +#if (SYNCDAEMON_COMPILE) + snprintf (voldir, PATH_MAX, "%s/gsync", dirname); + ret = mkdir (voldir, 0777); + if ((-1 == ret) && (errno != EEXIST)) { + gf_log (this->name, GF_LOG_CRITICAL, + "Unable to create gsync directory %s" + " ,errno = %d", voldir, errno); + exit (1); + } + + ret = snprintf (cmd, PATH_MAX, GSYNCD_PREFIX "/gsyncd -c %s/%s " + " --config-set-rx remote-gsyncd %s/gsyncd . ." + , dirname, GSYNC_CONF, GSYNCD_PREFIX); + if (ret <= 0) { + ret = -1; + goto out; + } + + ret = system (cmd); + if (ret == -1) + goto out; + ret = snprintf (cmd, 1024, GSYNCD_PREFIX "/gsyncd -c %s/%s " + " --config-set-rx remote-gsyncd" + " /usr/local/libexec/glusterfs/gsyncd . ^ssh:" + , dirname, GSYNC_CONF); + if (ret <= 0) { + ret = -1; + goto out; + } + + ret = system (cmd); + if (ret == -1) + goto out; +#endif rpc = rpcsvc_init (this->ctx, this->options); if (rpc == NULL) { gf_log (this->name, GF_LOG_ERROR, |