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