summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeghana M <mmadhusu@redhat.com>2015-08-03 03:03:07 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-08-10 17:36:20 -0700
commitcdf238e7c90273beff73617481d19d77fc8014db (patch)
tree8e27bf2c2ba65a8207bf388d52ca4f8e716bab0f
parenta2e40a318aacfeec01f824c7496567734f9863df (diff)
Set nfs.disable to "on" when global NFS-Ganesha key is enabled
"nfs.disable" gets set to "on" for all the existing volumes, when the command "gluster nfs-ganesha enable" is executed. When a new volume is created,it gets exported via Gluster-NFS on the nodes outside the NFS-Ganesha. To fix this, the "nfs.disable" key is set to "on" before starting the volume, whenever the global option is set to "enable". Change-Id: I7ce58928c36eadb8c122cded5bdcea271a0a4ffa BUG: 1251857 Signed-off-by: Meghana M <mmadhusu@redhat.com> Reviewed-on: http://review.gluster.org/11871 Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 650f3e630d6..3174c114875 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2372,6 +2372,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
char *brick_mount_dir = NULL;
char key[PATH_MAX] = "";
char *volname = NULL;
+ char *str = NULL;
+ gf_boolean_t option = _gf_false;
int flags = 0;
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
@@ -2425,6 +2427,28 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
}
}
+ ret = dict_get_str (conf->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
+ if (ret == -1) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_DICT_GET_FAILED, "Global dict not present.");
+ ret = 0;
+
+ } else {
+ ret = gf_string2boolean (str, &option);
+ /* Check if the feature is enabled and set nfs-disable to true */
+ if (option) {
+ gf_msg_debug (this->name, 0, "NFS-Ganesha is enabled");
+ /* Gluster-nfs should not start when NFS-Ganesha is enabled*/
+ ret = dict_set_str (volinfo->dict, "nfs.disable", "on");
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED, "Failed to set nfs.disable for"
+ "volume %s", volname);
+ goto out;
+ }
+ }
+ }
+
ret = glusterd_start_volume (volinfo, flags, _gf_true);
if (ret)
goto out;