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