3604df
From 5bede9e73bf0c3c4b5a9426ed8e7329131cd160c Mon Sep 17 00:00:00 2001
3604df
From: Jiffin Tony Thottan <jthottan@redhat.com>
3604df
Date: Thu, 15 Dec 2016 17:14:01 +0530
3604df
Subject: [PATCH 245/246] glusterd/gNFS : explicitly set "nfs.disable" to "off"
3604df
 after 3.2 upgrade
3604df
3604df
Gluster NFS was enabled by default for all volumes till 3.1. But 3.2 onwards
3604df
for the new volumes it will be disabled by setting "nfs.disable" to "on".
3604df
This take patch will take care of existing volume in such a way that if the
3604df
option is not configured, it will set "nfs.disable" to "off" during op-version
3604df
bump up.
3604df
3604df
Also this patch removes the warning message while enabling gluster NFS for
3604df
a volume.
3604df
3604df
label : DOWNSTREAM ONLY
3604df
3604df
Change-Id: Ib199c3180204f917791b4627c58d846750d18a5a
3604df
BUG: 1404996
3604df
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/93146
3604df
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 cli/src/cli-cmd-parser.c                   | 14 --------------
3604df
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 29 ++++++++++++-----------------
3604df
 2 files changed, 12 insertions(+), 31 deletions(-)
3604df
3604df
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
3604df
index a40dcb1..4b97623 100644
3604df
--- a/cli/src/cli-cmd-parser.c
3604df
+++ b/cli/src/cli-cmd-parser.c
3604df
@@ -1680,20 +1680,6 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
3604df
                                 goto out;
3604df
                         }
3604df
                 }
3604df
-                if ((!strcmp (key, "nfs.disable")) &&
3604df
-                            (!strcmp (value, "off"))) {
3604df
-                        question = "Gluster NFS is being deprecated in favor "
3604df
-                                   "of NFS-Ganesha Enter \"yes\" to continue "
3604df
-                                   "using Gluster NFS";
3604df
-                        answer = cli_cmd_get_confirmation (state, question);
3604df
-                        if (GF_ANSWER_NO == answer) {
3604df
-                                gf_log ("cli", GF_LOG_ERROR, "Operation "
3604df
-                                        "cancelled, exiting");
3604df
-                                *op_errstr = gf_strdup ("Aborted by user.");
3604df
-                                ret = -1;
3604df
-                                goto out;
3604df
-                        }
3604df
-                }
3604df
         }
3604df
 
3604df
         ret = dict_set_int32 (dict, "count", wordcount-3);
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
index 31b16e8..b0543fe 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
3604df
@@ -2302,9 +2302,9 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
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 value for nfs.disable is
3604df
-         * set to 'on' for all volumes even if it is explicitly set to 'off' in
3604df
+         * set to 'off' for all volumes even if it is not explicitly set in the
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
+         * Setting nfs.disable to 'off' 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
@@ -2312,23 +2312,18 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
3604df
         if (conf->op_version >= GD_OP_VERSION_3_9_0) {
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
+                        ret = dict_set_dynstr_with_alloc (volinfo->dict,
3604df
+                                                           NFS_DISABLE_MAP_KEY,
3604df
+                                                           "off");
3604df
+                        if (ret) {
3604df
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
3604df
+                                        GD_MSG_DICT_SET_FAILED, "Failed to turn "
3604df
+                                        "off ' NFS_DISABLE_MAP_KEY ' option for "
3604df
+                                        "volume %s", volinfo->volname);
3604df
+                                goto out;
3604df
+                        }
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
                 if (ret) {
3604df
-- 
3604df
2.9.3
3604df