diff options
author | Jiffin Tony Thottan <jthottan@redhat.com> | 2017-10-16 14:24:29 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@gmail.com> | 2019-08-24 02:08:57 +0000 |
commit | 673f2f90f35e5ea381bd22a43403278f89c957a5 (patch) | |
tree | 297f645a4cc6dfbe48609b03da26a1e93607ab7d /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 3fe34c921146a8d11875dc3d904e3a5994eb1cb6 (diff) |
Revert "glusterd: (storhaug) remove ganesha (843e1b0)"
please note as an additional change, macro GLUSTERD_GET_SNAP_DIR
moved from glusterd-store.c to glusterd-snapshot-utils.h
Change-Id: I811efefc148453fe32e4f0d322e80455447cec71
updates: #663
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index da0d8c945e2..881ee9cff4f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1165,6 +1165,13 @@ glusterd_op_stage_set_volume(dict_t *dict, char **op_errstr) if (ret) goto out; + if ((strcmp(key, "ganesha.enable") == 0) && + (strcmp(value, "off") == 0)) { + ret = ganesha_manage_export(dict, "off", _gf_true, op_errstr); + if (ret) + goto out; + } + ret = glusterd_check_quota_cmd(key, value, errstr, sizeof(errstr)); if (ret) goto out; @@ -1585,6 +1592,20 @@ glusterd_op_stage_reset_volume(dict_t *dict, char **op_errstr) goto out; } + /* * + * If key ganesha.enable is set, then volume should be unexported from + * ganesha server. Also it is a volume-level option, perform only when + * volume name not equal to "all"(in other words if volinfo != NULL) + */ + if (volinfo && (!strcmp(key, "all") || !strcmp(key, "ganesha.enable"))) { + if (glusterd_check_ganesha_export(volinfo)) { + ret = ganesha_manage_export(dict, "off", _gf_true, op_errstr); + if (ret) + gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NFS_GNS_RESET_FAIL, + "Could not reset ganesha.enable key"); + } + } + if (strcmp(key, "all")) { exists = glusterd_check_option_exists(key, &key_fixed); if (exists == -1) { @@ -2267,6 +2288,16 @@ glusterd_op_reset_volume(dict_t *dict, char **op_rspstr) } } + if (!strcmp(key, "ganesha.enable") || !strcmp(key, "all")) { + if (glusterd_check_ganesha_export(volinfo) && + is_origin_glusterd(dict)) { + ret = manage_export_config(volname, "off", op_rspstr); + if (ret) + gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_NFS_GNS_RESET_FAIL, + "Could not reset ganesha.enable key"); + } + } + out: GF_FREE(key_fixed); if (quorum_action) @@ -2837,6 +2868,10 @@ glusterd_op_set_volume(dict_t *dict, char **errstr) } } + ret = glusterd_check_ganesha_cmd(key, value, errstr, dict); + if (ret == -1) + goto out; + if (!is_key_glusterd_hooks_friendly(key)) { ret = glusterd_check_option_exists(key, &key_fixed); GF_ASSERT(ret); @@ -4319,7 +4354,8 @@ glusterd_op_build_payload(dict_t **req, char **op_errstr, dict_t *op_ctx) case GD_OP_SYNC_VOLUME: case GD_OP_COPY_FILE: - case GD_OP_SYS_EXEC: { + case GD_OP_SYS_EXEC: + case GD_OP_GANESHA: { dict_copy(dict, req_dict); } break; @@ -5772,6 +5808,10 @@ glusterd_op_stage_validate(glusterd_op_t op, dict_t *dict, char **op_errstr, ret = glusterd_op_stage_set_volume(dict, op_errstr); break; + case GD_OP_GANESHA: + ret = glusterd_op_stage_set_ganesha(dict, op_errstr); + break; + case GD_OP_RESET_VOLUME: ret = glusterd_op_stage_reset_volume(dict, op_errstr); break; @@ -5902,7 +5942,9 @@ glusterd_op_commit_perform(glusterd_op_t op, dict_t *dict, char **op_errstr, case GD_OP_SET_VOLUME: ret = glusterd_op_set_volume(dict, op_errstr); break; - + case GD_OP_GANESHA: + ret = glusterd_op_set_ganesha(dict, op_errstr); + break; case GD_OP_RESET_VOLUME: ret = glusterd_op_reset_volume(dict, op_errstr); break; |