summaryrefslogtreecommitdiffstats
path: root/extras/ganesha
diff options
context:
space:
mode:
authorMeghana Madhusudhan <mmadhusu@redhat.com>2015-05-06 12:13:31 +0530
committerNiels de Vos <ndevos@redhat.com>2015-05-07 02:55:22 -0700
commit9096a79447d4ac72612c86407f35bdb68a4fef88 (patch)
tree01aad29906b79a7da22dae0c380ee4151e27bf56 /extras/ganesha
parent82684f1efeb1685a1c794c1c875e3ac21f810481 (diff)
NFS-Ganesha: Add-node and delete-node changes in HA implementation
NFS-Ganesha related config files have to be copied over to the new node and NFS-Ganesha service has to be started. Similary NFS-Ganesha service has to be stopped when a node is deleted from the HA cluster. Change-Id: Ia38e72cac86713fe23b7d1b829a256637a9ca796 BUG: 1212816 Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com> Reviewed-on: http://review.gluster.org/10596 Reviewed-by: soumya k <skoduri@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'extras/ganesha')
-rwxr-xr-xextras/ganesha/scripts/ganesha-ha.sh64
1 files changed, 60 insertions, 4 deletions
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 2535f8b1a44..5a633a6594c 100755
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -25,10 +25,40 @@ HA_SERVERS=""
HA_CONFDIR=""
HA_VOL_NAME="gluster_shared_storage"
HA_VOL_MNT="/var/run/gluster/shared_storage"
+SERVICE_MAN="DISTRO_NOT_FOUND"
CONF=$(cat /etc/sysconfig/ganesha | grep "CONFFILE" | cut -f 2 -d "=")
RHEL6_PCS_CNAME_OPTION="--name"
+determine_service_manager () {
+
+ if [ -e "/usr/bin/systemctl" ];
+ then
+ SERVICE_MAN="/usr/bin/systemctl"
+ elif [ -e "/sbin/invoke-rc.d" ];
+ then
+ SERVICE_MAN="/sbin/invoke-rc.d"
+ elif [ -e "/sbin/service" ];
+ then
+ SERVICE_MAN="/sbin/service"
+ fi
+ if [ "$SERVICE_MAN" == "DISTRO_NOT_FOUND" ]
+ then
+ echo "Service manager not recognized, exiting"
+ exit 1
+ fi
+}
+
+manage_service ()
+{
+ if [ "$SERVICE_MAN" == "/usr/sbin/systemctl" ]
+ then
+ $SERVICE_MAN $1 nfs-ganesha
+ else
+ $SERVICE_MAN nfs-ganesha $1
+ fi
+}
+
check_cluster_exists()
{
local name=${1}
@@ -151,6 +181,13 @@ setup_copy_config()
fi
}
+copy_export_config ()
+{
+ . /etc/ganesha/ganesha.conf
+ scp $HA_VOL_SERVER:/etc/ganesha.conf ${1}:/etc/ganesha/
+ scp -r $HA_VOL_SERVER:$2/exports/ ${1}:${2}/
+}
+
teardown_cluster()
{
@@ -746,9 +783,9 @@ main()
node=${1}; shift
vip=${1}; shift
- logger "adding ${node} with ${vip} to ${HA_NAME}"
+ logger "adding ${node} with ${vip} to ${HA_NAME}"
- determine_servers "add"
+ determine_servers "add"
pcs cluster node add ${node}
if [ $? -ne 0 ]; then
@@ -760,6 +797,12 @@ main()
setup_state_volume ${node}
setup_copy_config ${node}
+
+ copy_export_config ${node} ${HA_CONFDIR}
+
+ determine_service_manager
+
+ manage_service "start"
;;
delete | --delete)
@@ -779,6 +822,12 @@ main()
# TODO: delete node's directory in shared state
teardown_clean_etccluster ${node}
+
+ determine_service_manager
+
+ manage-service "stop"
+
+ cleanup_ganesha_config ${HA_CONFDIR}
;;
status | --status)
@@ -788,10 +837,17 @@ main()
refresh-config | --refresh-config)
;;
- *)
+ help | --help)
+ echo "Usage : add|delete|status"
+ echo "Add-node : ganesha-ha.sh --add <HA_CONF_DIR> \
+<NODE-IP/HOSTNAME> <NODE-VIP>"
+ echo "Delete-node: ganesha-ha.sh --delete <HA_CONF_DIR> \
+<NODE-IP/HOSTNAME>"
+ ;;
+ *)
# setup and teardown are not intended to be used by a
# casual user
- logger "Usage: ganesha-ha.sh setup|teardown|add|delete|status"
+ logger "Usage: ganesha-ha.sh add|delete|status"
;;
esac