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