diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 939b40a881a..45fd74ded77 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -773,12 +773,14 @@ out: static int glusterd_validate_shared_storage (char *key, char *value, char *errstr) { - int32_t ret = -1; - int32_t exists = -1; - int32_t count = -1; - char *op = NULL; - xlator_t *this = NULL; - glusterd_conf_t *conf = NULL; + int32_t ret = -1; + int32_t exists = -1; + int32_t count = -1; + char *op = NULL; + char hook_script[PATH_MAX] = ""; + xlator_t *this = NULL; + glusterd_conf_t *conf = NULL; + struct stat stbuf = {0,}; this = THIS; GF_VALIDATE_OR_GOTO ("glusterd", this, out); @@ -807,6 +809,21 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr) goto out; } + snprintf (hook_script, sizeof(hook_script), + "%s"GLUSTERD_SHRD_STRG_HOOK_SCRIPT, conf->workdir); + + ret = sys_lstat (hook_script, &stbuf); + if (ret) { + snprintf (errstr, PATH_MAX, + "The hook-script (%s) required " + "for this operation is not present. " + "Please install the hook-script " + "and retry", hook_script); + gf_msg (this->name, GF_LOG_ERROR, ENOENT, + GD_MSG_FILE_OP_FAILED, "%s", errstr); + goto out; + } + if (!strncmp (value, "disable", strlen ("disable"))) { ret = dict_get_str (conf->opts, GLUSTERD_SHARED_STORAGE_KEY, &op); |