14f8ab
From 8ba7e04362019ea2d0e80e67eb214d53dca58774 Mon Sep 17 00:00:00 2001
14f8ab
From: Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
Date: Thu, 17 Nov 2016 12:44:38 +0530
14f8ab
Subject: [PATCH 089/124] glusterd/gNFS : On post upgrade to 3.2, disable gNFS
14f8ab
 for all volumes
14f8ab
14f8ab
Currently on 3.2 gNFS is dsiabled for newly created volumes or old volumes
14f8ab
with default value. There will be volumes which have explicitly turn off
14f8ab
nfs.disable option. This change disable gNFS even for that volume as well.
14f8ab
14f8ab
label : DOWNSTREAM ONLY
14f8ab
14f8ab
Change-Id: I4ddeb23690271034b0bbb3fc50b359350b5eae87
14f8ab
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/90425
14f8ab
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
14f8ab
Tested-by: Atin Mukherjee <amukherj@redhat.com>
14f8ab
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/167573
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
14f8ab
---
14f8ab
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 43 ++++++++++++++++++------------
14f8ab
 1 file changed, 26 insertions(+), 17 deletions(-)
14f8ab
14f8ab
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
index 10e2d48..06ea8cf 100644
14f8ab
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
@@ -2501,26 +2501,35 @@ glusterd_update_volumes_dict(glusterd_volinfo_t *volinfo)
14f8ab
     GF_VALIDATE_OR_GOTO(this->name, conf, out);
14f8ab
 
14f8ab
     /* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
14f8ab
-     * from anything below than 3.9.0 to 3.9.x the volume's dictionary will
14f8ab
-     * not have 'nfs.disable' key set which means the same will not be set
14f8ab
-     * to on until explicitly done. setnfs.disable to 'on' at op-version
14f8ab
-     * bump up flow is the ideal way here. The same is also applicable for
14f8ab
-     * transport.address-family where if the transport type is set to tcp
14f8ab
-     * then transport.address-family is defaulted to 'inet'.
14f8ab
+     * from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
14f8ab
+     * set to 'on' for all volumes even if it is explicitly set to 'off' in
14f8ab
+     * previous version. This change is only applicable to downstream code.
14f8ab
+     * Setting nfs.disable to 'on' at op-version bump up flow is the ideal
14f8ab
+     * way here. The same is also applicable for transport.address-family
14f8ab
+     * where if the transport type is set to tcp then transport.address-family
14f8ab
+     * is defaulted to 'inet'.
14f8ab
      */
14f8ab
     if (conf->op_version >= GD_OP_VERSION_3_9_0) {
14f8ab
-        if (dict_get_str_boolean(volinfo->dict, NFS_DISABLE_MAP_KEY, 1)) {
14f8ab
-            ret = dict_set_dynstr_with_alloc(volinfo->dict, NFS_DISABLE_MAP_KEY,
14f8ab
-                                             "on");
14f8ab
-            if (ret) {
14f8ab
-                gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
14f8ab
-                       "Failed to set "
14f8ab
-                       "option ' NFS_DISABLE_MAP_KEY ' on "
14f8ab
-                       "volume %s",
14f8ab
-                       volinfo->volname);
14f8ab
-                goto out;
14f8ab
-            }
14f8ab
+        if (!(dict_get_str_boolean(volinfo->dict, NFS_DISABLE_MAP_KEY, 0))) {
14f8ab
+            gf_msg(this->name, GF_LOG_INFO, 0, 0,
14f8ab
+                   "Gluster NFS is"
14f8ab
+                   " being deprecated in favor of NFS-Ganesha, "
14f8ab
+                   "hence setting nfs.disable to 'on' for volume "
14f8ab
+                   "%s. Please re-enable it if requires",
14f8ab
+                   volinfo->volname);
14f8ab
+        }
14f8ab
+
14f8ab
+        ret = dict_set_dynstr_with_alloc(volinfo->dict, NFS_DISABLE_MAP_KEY,
14f8ab
+                                         "on");
14f8ab
+        if (ret) {
14f8ab
+            gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
14f8ab
+                   "Failed to set "
14f8ab
+                   "option ' NFS_DISABLE_MAP_KEY ' on "
14f8ab
+                   "volume %s",
14f8ab
+                   volinfo->volname);
14f8ab
+            goto out;
14f8ab
         }
14f8ab
+
14f8ab
         ret = dict_get_strn(volinfo->dict, "transport.address-family",
14f8ab
                             SLEN("transport.address-family"),
14f8ab
                             &address_family_str);
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab