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