cb8e9e
From efd88ab25c2a9ebb16da2200c5335e7b7c24f83e Mon Sep 17 00:00:00 2001
cb8e9e
From: Meghana M <mmadhusu@redhat.com>
cb8e9e
Date: Mon, 3 Aug 2015 03:03:07 +0530
cb8e9e
Subject: [PATCH 278/279] Set nfs.disable to "on" when global NFS-Ganesha key is enabled
cb8e9e
cb8e9e
"nfs.disable" gets set to "on" for all the existing volumes,
cb8e9e
when the command "gluster nfs-ganesha enable" is executed.
cb8e9e
When a new volume is created,it gets exported via Gluster-NFS on
cb8e9e
the nodes outside the NFS-Ganesha. To fix this,
cb8e9e
the "nfs.disable" key is set to "on" before starting the volume,
cb8e9e
whenever the global option is set to "enable".
cb8e9e
cb8e9e
This patch is a backport of the fix upstream,
cb8e9e
http://review.gluster.org/#/c/11871/
cb8e9e
cb8e9e
Change-Id: I5581d64d785ad3eb526c575dbafcf9044c76e593
cb8e9e
BUG: 1226817
cb8e9e
Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/55401
cb8e9e
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
cb8e9e
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
cb8e9e
Tested-by: Kaleb Keithley <kkeithle@redhat.com>
cb8e9e
---
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c |   24 +++++++++++++++++++++++
cb8e9e
 1 files changed, 24 insertions(+), 0 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
cb8e9e
index b52f832..d2716f8 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
cb8e9e
@@ -2377,6 +2377,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
cb8e9e
         char                       *brick_mount_dir = NULL;
cb8e9e
         char                        key[PATH_MAX]   = "";
cb8e9e
         char                       *volname         = NULL;
cb8e9e
+        char                       *str             = NULL;
cb8e9e
+        gf_boolean_t                option          = _gf_false;
cb8e9e
         int                         flags           = 0;
cb8e9e
         glusterd_volinfo_t         *volinfo         = NULL;
cb8e9e
         glusterd_brickinfo_t       *brickinfo       = NULL;
cb8e9e
@@ -2430,6 +2432,28 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
+        ret = dict_get_str (conf->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
cb8e9e
+        if (ret == -1) {
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        GD_MSG_DICT_GET_FAILED, "Global dict not present.");
cb8e9e
+                ret = 0;
cb8e9e
+
cb8e9e
+        } else {
cb8e9e
+                ret = gf_string2boolean (str, &option);
cb8e9e
+                /* Check if the feature is enabled and set nfs-disable to true */
cb8e9e
+                if (option) {
cb8e9e
+                        gf_msg_debug (this->name, 0, "NFS-Ganesha is enabled");
cb8e9e
+                        /* Gluster-nfs should not start when NFS-Ganesha is enabled*/
cb8e9e
+                        ret = dict_set_str (volinfo->dict, "nfs.disable", "on");
cb8e9e
+                        if (ret) {
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        GD_MSG_DICT_SET_FAILED, "Failed to set nfs.disable for"
cb8e9e
+                                        "volume %s", volname);
cb8e9e
+                                goto out;
cb8e9e
+                        }
cb8e9e
+                }
cb8e9e
+        }
cb8e9e
+
cb8e9e
         ret = glusterd_start_volume (volinfo, flags, _gf_true);
cb8e9e
         if (ret)
cb8e9e
                 goto out;
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e