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