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