d1681e
From 14bfa98824d40ff1f721a905f8e8ffd557f96eef Mon Sep 17 00:00:00 2001
d1681e
From: Jiffin Tony Thottan <jthottan@redhat.com>
d1681e
Date: Thu, 15 Dec 2016 17:14:01 +0530
d1681e
Subject: [PATCH 26/74] glusterd/gNFS : explicitly set "nfs.disable" to "off"
d1681e
 after 3.2 upgrade
d1681e
d1681e
Gluster NFS was enabled by default for all volumes till 3.1. But 3.2 onwards
d1681e
for the new volumes it will be disabled by setting "nfs.disable" to "on".
d1681e
This take patch will take care of existing volume in such a way that if the
d1681e
option is not configured, it will set "nfs.disable" to "off" during op-version
d1681e
bump up.
d1681e
d1681e
Also this patch removes the warning message while enabling gluster NFS for
d1681e
a volume.
d1681e
d1681e
label : DOWNSTREAM ONLY
d1681e
d1681e
Change-Id: Ib199c3180204f917791b4627c58d846750d18a5a
d1681e
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/93146
d1681e
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 cli/src/cli-cmd-parser.c                   | 14 --------------
d1681e
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 29 ++++++++++++-----------------
d1681e
 2 files changed, 12 insertions(+), 31 deletions(-)
d1681e
d1681e
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
d1681e
index c8ed367..ca4d906 100644
d1681e
--- a/cli/src/cli-cmd-parser.c
d1681e
+++ b/cli/src/cli-cmd-parser.c
d1681e
@@ -1621,20 +1621,6 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
d1681e
                                 goto out;
d1681e
                         }
d1681e
                 }
d1681e
-                if ((!strcmp (key, "nfs.disable")) &&
d1681e
-                            (!strcmp (value, "off"))) {
d1681e
-                        question = "Gluster NFS is being deprecated in favor "
d1681e
-                                   "of NFS-Ganesha Enter \"yes\" to continue "
d1681e
-                                   "using Gluster NFS";
d1681e
-                        answer = cli_cmd_get_confirmation (state, question);
d1681e
-                        if (GF_ANSWER_NO == answer) {
d1681e
-                                gf_log ("cli", GF_LOG_ERROR, "Operation "
d1681e
-                                        "cancelled, exiting");
d1681e
-                                *op_errstr = gf_strdup ("Aborted by user.");
d1681e
-                                ret = -1;
d1681e
-                                goto out;
d1681e
-                        }
d1681e
-                }
d1681e
         }
d1681e
 
d1681e
         ret = dict_set_int32 (dict, "count", wordcount-3);
d1681e
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
d1681e
index 09be165..0557ad8 100644
d1681e
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
d1681e
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
d1681e
@@ -2438,9 +2438,9 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
d1681e
 
d1681e
         /* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
d1681e
          * from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
d1681e
-         * set to 'on' for all volumes even if it is explicitly set to 'off' in
d1681e
+         * set to 'off' for all volumes even if it is not explicitly set in the
d1681e
          * previous version. This change is only applicable to downstream code.
d1681e
-         * Setting nfs.disable to 'on' at op-version bump up flow is the ideal
d1681e
+         * Setting nfs.disable to 'off' at op-version bump up flow is the ideal
d1681e
          * way here. The same is also applicable for transport.address-family
d1681e
          * where if the transport type is set to tcp then transport.address-family
d1681e
          * is defaulted to 'inet'.
d1681e
@@ -2448,23 +2448,18 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
d1681e
         if (conf->op_version >= GD_OP_VERSION_3_9_0) {
d1681e
                 if (!(dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY,
d1681e
                                             0))) {
d1681e
-                        gf_msg (this->name, GF_LOG_INFO, 0, 0, "Gluster NFS is"
d1681e
-                                " being deprecated in favor of NFS-Ganesha, "
d1681e
-                                "hence setting nfs.disable to 'on' for volume "
d1681e
-                                "%s. Please re-enable it if requires",
d1681e
-                                volinfo->volname);
d1681e
+                        ret = dict_set_dynstr_with_alloc (volinfo->dict,
d1681e
+                                                           NFS_DISABLE_MAP_KEY,
d1681e
+                                                           "off");
d1681e
+                        if (ret) {
d1681e
+                                gf_msg (this->name, GF_LOG_ERROR, errno,
d1681e
+                                        GD_MSG_DICT_SET_FAILED, "Failed to turn "
d1681e
+                                        "off ' NFS_DISABLE_MAP_KEY ' option for "
d1681e
+                                        "volume %s", volinfo->volname);
d1681e
+                                goto out;
d1681e
+                        }
d1681e
                 }
d1681e
 
d1681e
-                ret = dict_set_dynstr_with_alloc (volinfo->dict,
d1681e
-                                                   NFS_DISABLE_MAP_KEY,
d1681e
-                                                   "on");
d1681e
-                if (ret) {
d1681e
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
d1681e
-                                GD_MSG_DICT_SET_FAILED, "Failed to set "
d1681e
-                                "option ' NFS_DISABLE_MAP_KEY ' on "
d1681e
-                                "volume %s", volinfo->volname);
d1681e
-                        goto out;
d1681e
-                }
d1681e
                 ret = dict_get_str (volinfo->dict, "transport.address-family",
d1681e
                                     &address_family_str);
d1681e
                 if (ret) {
d1681e
-- 
d1681e
1.8.3.1
d1681e