233933
From a766878e11a984680ed29f13aae713d464ec985e Mon Sep 17 00:00:00 2001
233933
From: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Date: Wed, 19 Apr 2017 16:12:10 +0530
233933
Subject: [PATCH 061/124] ganesha : allow refresh-config and volume
233933
 export/unexport in failover state
233933
233933
If ganesha is not running on one of nodes in HA cluster, then alli dbus
233933
commands send to that ganesha server will fail. This results in both
233933
refresh-config and volume export/unepxort failure. This change will
233933
gracefully handle those scenarios.
233933
233933
Label: DOWNSTREAM ONLY
233933
233933
Change-Id: I3f1b7b7ca98e54c273c266e56357d8e24dd1b14b
233933
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Reviewed-on: https://review.gluster.org/17081
233933
Smoke: Gluster Build System <jenkins@build.gluster.org>
233933
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
233933
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
233933
Reviewed-by: soumya k <skoduri@redhat.com>
233933
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
233933
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/167146
233933
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 extras/ganesha/scripts/ganesha-ha.sh          |  6 ++----
233933
 xlators/mgmt/glusterd/src/glusterd-ganesha.c  | 24 +++++++++++++++---------
233933
 xlators/mgmt/glusterd/src/glusterd-messages.h |  2 +-
233933
 3 files changed, 18 insertions(+), 14 deletions(-)
233933
233933
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
233933
index db3f921..f040ef6 100644
233933
--- a/extras/ganesha/scripts/ganesha-ha.sh
233933
+++ b/extras/ganesha/scripts/ganesha-ha.sh
233933
@@ -275,8 +275,7 @@ string:\"EXPORT(Export_Id=$export_id)\" 2>&1")
233933
                 ret=$?
233933
                 logger <<< "${output}"
233933
                 if [ ${ret} -ne 0 ]; then
233933
-                        echo "Error: refresh-config failed on ${current_host}."
233933
-                        exit 1
233933
+                        echo "Refresh-config failed on ${current_host}"
233933
                 else
233933
                         echo "Refresh-config completed on ${current_host}."
233933
                 fi
233933
@@ -297,8 +296,7 @@ string:"EXPORT(Export_Id=$export_id)" 2>&1)
233933
         ret=$?
233933
         logger <<< "${output}"
233933
         if [ ${ret} -ne 0 ] ; then
233933
-                echo "Error: refresh-config failed on localhost."
233933
-                exit 1
233933
+                echo "Refresh-config failed on localhost."
233933
         else
233933
                 echo "Success: refresh-config completed."
233933
         fi
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
233933
index 1d17a33..ee8b588 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
233933
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
233933
@@ -540,15 +540,21 @@ ganesha_manage_export(dict_t *dict, char *value, char **op_errstr)
233933
     }
233933
 
233933
     if (check_host_list()) {
233933
-        runner_add_args(&runner, GANESHA_PREFIX "/dbus-send.sh", CONFDIR, value,
233933
-                        volname, NULL);
233933
-        ret = runner_run(&runner);
233933
-        if (ret) {
233933
-            gf_asprintf(op_errstr,
233933
-                        "Dynamic export"
233933
-                        " addition/deletion failed."
233933
-                        " Please see log file for details");
233933
-            goto out;
233933
+        /* Check whether ganesha is running on this node */
233933
+        if (manage_service("status")) {
233933
+            gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_GANESHA_NOT_RUNNING,
233933
+                   "Export failed, NFS-Ganesha is not running");
233933
+        } else {
233933
+            runner_add_args(&runner, GANESHA_PREFIX "/dbus-send.sh", CONFDIR,
233933
+                            value, volname, NULL);
233933
+            ret = runner_run(&runner);
233933
+            if (ret) {
233933
+                gf_asprintf(op_errstr,
233933
+                            "Dynamic export"
233933
+                            " addition/deletion failed."
233933
+                            " Please see log file for details");
233933
+                goto out;
233933
+            }
233933
         }
233933
     }
233933
 
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
233933
index 9558480..c7b3ca8 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
233933
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
233933
@@ -298,6 +298,6 @@ GLFS_MSGID(
233933
     GD_MSG_LOCALTIME_LOGGING_ENABLE, GD_MSG_LOCALTIME_LOGGING_DISABLE,
233933
     GD_MSG_PORTS_EXHAUSTED, GD_MSG_CHANGELOG_GET_FAIL,
233933
     GD_MSG_MANAGER_FUNCTION_FAILED, GD_MSG_NFS_GANESHA_DISABLED,
233933
-    GD_MSG_DAEMON_LOG_LEVEL_VOL_OPT_VALIDATE_FAIL);
233933
+    GD_MSG_GANESHA_NOT_RUNNING, GD_MSG_DAEMON_LOG_LEVEL_VOL_OPT_VALIDATE_FAIL);
233933
 
233933
 #endif /* !_GLUSTERD_MESSAGES_H_ */
233933
-- 
233933
1.8.3.1
233933