17b94a
From ca3a4ebeddfef8c6909ff5388787a91ee52fd675 Mon Sep 17 00:00:00 2001
17b94a
From: Jiffin Tony Thottan <jthottan@redhat.com>
17b94a
Date: Thu, 15 Dec 2016 17:14:01 +0530
17b94a
Subject: [PATCH 091/124] glusterd/gNFS : explicitly set "nfs.disable" to "off"
17b94a
 after 3.2 upgrade
17b94a
17b94a
Gluster NFS was enabled by default for all volumes till 3.1. But 3.2 onwards
17b94a
for the new volumes it will be disabled by setting "nfs.disable" to "on".
17b94a
This take patch will take care of existing volume in such a way that if the
17b94a
option is not configured, it will set "nfs.disable" to "off" during op-version
17b94a
bump up.
17b94a
17b94a
Also this patch removes the warning message while enabling gluster NFS for
17b94a
a volume.
17b94a
17b94a
label : DOWNSTREAM ONLY
17b94a
17b94a
Change-Id: Ib199c3180204f917791b4627c58d846750d18a5a
17b94a
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/93146
17b94a
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
17b94a
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
17b94a
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/167574
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
17b94a
---
17b94a
 cli/src/cli-cmd-parser.c                   | 16 ---------------
17b94a
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 31 ++++++++++++------------------
17b94a
 2 files changed, 12 insertions(+), 35 deletions(-)
17b94a
17b94a
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
17b94a
index f85958b..92ceb8e 100644
17b94a
--- a/cli/src/cli-cmd-parser.c
17b94a
+++ b/cli/src/cli-cmd-parser.c
17b94a
@@ -1678,22 +1678,6 @@ cli_cmd_volume_set_parse(struct cli_state *state, const char **words,
17b94a
                 goto out;
17b94a
             }
17b94a
         }
17b94a
-        if ((!strcmp(key, "nfs.disable")) && (!strcmp(value, "off"))) {
17b94a
-            question =
17b94a
-                "Gluster NFS is being deprecated in favor "
17b94a
-                "of NFS-Ganesha Enter \"yes\" to continue "
17b94a
-                "using Gluster NFS";
17b94a
-            answer = cli_cmd_get_confirmation(state, question);
17b94a
-            if (GF_ANSWER_NO == answer) {
17b94a
-                gf_log("cli", GF_LOG_ERROR,
17b94a
-                       "Operation "
17b94a
-                       "cancelled, exiting");
17b94a
-                *op_errstr = gf_strdup("Aborted by user.");
17b94a
-                ret = -1;
17b94a
-                goto out;
17b94a
-            }
17b94a
-        }
17b94a
-
17b94a
         if ((strcmp(key, "cluster.brick-multiplex") == 0)) {
17b94a
             question =
17b94a
                 "Brick-multiplexing is supported only for "
17b94a
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
17b94a
index 06ea8cf..df8a6ab 100644
17b94a
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
17b94a
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
17b94a
@@ -2502,32 +2502,25 @@ glusterd_update_volumes_dict(glusterd_volinfo_t *volinfo)
17b94a
 
17b94a
     /* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
17b94a
      * from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
17b94a
-     * set to 'on' for all volumes even if it is explicitly set to 'off' in
17b94a
+     * set to 'off' for all volumes even if it is explicitly set to 'on' in
17b94a
      * previous version. This change is only applicable to downstream code.
17b94a
-     * Setting nfs.disable to 'on' at op-version bump up flow is the ideal
17b94a
+     * Setting nfs.disable to 'off' at op-version bump up flow is the ideal
17b94a
      * way here. The same is also applicable for transport.address-family
17b94a
      * where if the transport type is set to tcp then transport.address-family
17b94a
      * is defaulted to 'inet'.
17b94a
      */
17b94a
     if (conf->op_version >= GD_OP_VERSION_3_9_0) {
17b94a
         if (!(dict_get_str_boolean(volinfo->dict, NFS_DISABLE_MAP_KEY, 0))) {
17b94a
-            gf_msg(this->name, GF_LOG_INFO, 0, 0,
17b94a
-                   "Gluster NFS is"
17b94a
-                   " being deprecated in favor of NFS-Ganesha, "
17b94a
-                   "hence setting nfs.disable to 'on' for volume "
17b94a
-                   "%s. Please re-enable it if requires",
17b94a
-                   volinfo->volname);
17b94a
-        }
17b94a
-
17b94a
-        ret = dict_set_dynstr_with_alloc(volinfo->dict, NFS_DISABLE_MAP_KEY,
17b94a
-                                         "on");
17b94a
-        if (ret) {
17b94a
-            gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
17b94a
-                   "Failed to set "
17b94a
-                   "option ' NFS_DISABLE_MAP_KEY ' on "
17b94a
-                   "volume %s",
17b94a
-                   volinfo->volname);
17b94a
-            goto out;
17b94a
+            ret = dict_set_dynstr_with_alloc(volinfo->dict, NFS_DISABLE_MAP_KEY,
17b94a
+                                             "off");
17b94a
+            if (ret) {
17b94a
+                gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
17b94a
+                       "Failed to set "
17b94a
+                       "option ' NFS_DISABLE_MAP_KEY ' off "
17b94a
+                       "volume %s",
17b94a
+                       volinfo->volname);
17b94a
+                goto out;
17b94a
+            }
17b94a
         }
17b94a
 
17b94a
         ret = dict_get_strn(volinfo->dict, "transport.address-family",
17b94a
-- 
17b94a
1.8.3.1
17b94a