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