diff options
| author | Kaushik BV <kaushikbv@gluster.com> | 2011-08-31 18:04:19 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2011-09-13 00:04:59 -0700 | 
| commit | 8778c0bf72cc28a56becf0fd989bf66df51fd8a3 (patch) | |
| tree | 49551ebe4340f25e80bd9bb887bce2b57778e775 | |
| parent | 58c5e9feae1fdf618bb120f4c8ea318cc628dd06 (diff) | |
mgmt/glusterd: fail glusterd if gsyncd does not behave as expected
Change-Id: Ic54220328f15c579dcf441de2aad8620751a97ef
BUG: 2744
Reviewed-on: http://review.gluster.com/331
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Csaba Henk <csaba@gluster.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 36 | 
1 files changed, 26 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index cb7f9769dbe..d85777b1bf1 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -263,7 +263,7 @@ extern int mkdir_if_missing (char *path);  #if SYNCDAEMON_COMPILE  static int -glusterd_check_gsync_present () +glusterd_check_gsync_present (int *valid_state)  {          char                buff[PATH_MAX] = {0, };          runner_t            runner = {0,}; @@ -274,28 +274,43 @@ glusterd_check_gsync_present ()          runner_add_args (&runner, GSYNCD_PREFIX"/gsyncd", "--version", NULL);          runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);          ret = runner_start (&runner); -        if (ret == -1) +        if (ret == -1) { +                if (errno == ENOENT) { +                        gf_log ("glusterd", GF_LOG_INFO, GEOREP +                                 " module not installed in the system"); +                        *valid_state = 0; +                } +                else { +                        gf_log ("glusterd", GF_LOG_ERROR, GEOREP +                                  " module not working as desired"); +                        *valid_state = -1; +                }                  goto out; +        }          ptr = fgets(buff, sizeof(buff), runner_chio (&runner, STDOUT_FILENO));          if (ptr) {                  if (!strstr (buff, "gsyncd")) {                          ret = -1; +                        gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not " +                                 "working as desired"); +                        *valid_state = -1;                          goto out;                  }          } else {                  ret = -1; +                gf_log ("glusterd", GF_LOG_ERROR, GEOREP" module not " +                         "working as desired"); +                *valid_state = -1;                  goto out;          } +          ret = 0;   out: -        ret = runner_end (&runner); -        if (ret == -1) -                        gf_log ("", GF_LOG_INFO, "geo-replication module not" -                                " installed in the system"); +        runner_end (&runner); -        gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); +        gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);          return ret;  } @@ -430,16 +445,17 @@ configure_syncdaemon (glusterd_conf_t *conf)  #if SYNCDAEMON_COMPILE          runner_t runner = {0,};          char georepdir[PATH_MAX] = {0,}; +        int valid_state = 0;          ret = setenv ("_GLUSTERD_CALLED_", "1", 1);          if (ret < 0) {                  ret = 0;                  goto out;          } - -        ret = glusterd_check_gsync_present (); +        valid_state = -1; +        ret = glusterd_check_gsync_present (&valid_state);          if (-1 == ret) { -                ret = 0; +                ret = valid_state;                  goto out;          }  | 
