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