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