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