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