diff options
| author | Kaushik BV <kaushikbv@gluster.com> | 2011-04-21 06:55:45 +0000 | 
|---|---|---|
| committer | Anand Avati <avati@gluster.com> | 2011-04-22 03:52:28 -0700 | 
| commit | 2017d5ed79a0843262695394bfff61968902e9ef (patch) | |
| tree | 7f0fd11955b678c158333b27326b709094586d2e /xlators/mgmt/glusterd/src | |
| parent | 49603aec03e98a2a38fad66627593b69b6269cbf (diff) | |
cli: check if gsyncd is present in the configured place, enable geo-replication if present
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2744 (make geo-replication package friendly)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2744
Diffstat (limited to 'xlators/mgmt/glusterd/src')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 50 | 
1 files changed, 50 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index f72f058134a..b2cf345c714 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -242,6 +242,50 @@ out:  extern int mkdir_if_missing (char *path);  static int +glusterd_check_gsync_present () +{ +        FILE               *in = NULL; +        char                buff[PATH_MAX] = {0, }; +        char                cmd[PATH_MAX + 256] = {0, }; +        char               *ptr = NULL; +        int                 ret = 0; + +        if (strlen (GSYNCD_PREFIX)+1 > PATH_MAX-strlen("/gsyncd")) { +                ret = -1; +                goto out; +        } + +        snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd --version"); + +        if (!(in = popen(cmd, "r"))) { +                gf_log ("", GF_LOG_INFO, "geo-replication module not installed" +                        " in the system"); +                ret = -1; +                goto out; +        } + +        ptr = fgets(buff, sizeof(buff), in); +        if (ptr) { +                if (!strstr (buff, "gsyncd")) { +                        ret = -1; +                        goto out; +                } +        } +        ret = 0; + out: +        if (in) +                if (-1 == pclose (in)) { +                        ret = -1; +                        gf_log ("", GF_LOG_INFO, "geo-replication module not" +                                " installed in the system"); +                } + +        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); +        return ret; + +} + +int  configure_syncaemon (glusterd_conf_t *conf)  {          int ret = 0; @@ -273,6 +317,12 @@ configure_syncaemon (glusterd_conf_t *conf)                          "Unable to create "GEOREP" slave log directory");                  return -1;          } +        ret = glusterd_check_gsync_present (); +        if (-1 == ret) { +                ret = 0; +                goto out; +        } +          blen = snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd -c %s/"GSYNC_CONF                           " --config-set-rx ", conf->workdir);  | 
