|
|
3604df |
From a6fdfa2fbc92931f13e108215dc9536bc1bb3c30 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
Date: Fri, 9 Dec 2016 12:18:28 +0530
|
|
|
3604df |
Subject: [PATCH 240/246] common-ha: Create portblock RA as part of
|
|
|
3604df |
add/delete-node
|
|
|
3604df |
|
|
|
3604df |
When a node is added to or deleted from existing nfs-ganesha cluster,
|
|
|
3604df |
we need to create or cleanup portblock RA as well. This patch is
|
|
|
3604df |
to address the same. Also we need to adjust the quorum-policy with
|
|
|
3604df |
increase/decrease in the number of nodes in the cluster.
|
|
|
3604df |
|
|
|
3604df |
Upstream patch references:
|
|
|
3604df |
mainline:
|
|
|
3604df |
http://review.gluster.org/#/c/16089/
|
|
|
3604df |
|
|
|
3604df |
release-3.9:
|
|
|
3604df |
http://review.gluster.org/16115
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I31a896715b9b7fc931009723d1570bf7aa4da9b6
|
|
|
3604df |
BUG: 1400068
|
|
|
3604df |
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
Reviewed-on: http://review.gluster.org/16089
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/92793
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
extras/ganesha/scripts/ganesha-ha.sh | 69 +++++++++++++++++++++++++++++++-----
|
|
|
3604df |
1 file changed, 61 insertions(+), 8 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
3604df |
index ca3e9d3..876c2ad 100644
|
|
|
3604df |
--- a/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
3604df |
+++ b/extras/ganesha/scripts/ganesha-ha.sh
|
|
|
3604df |
@@ -579,9 +579,16 @@ recreate_resources()
|
|
|
3604df |
eval tmp_ipaddr=\$${clean_name}
|
|
|
3604df |
ipaddr=${tmp_ipaddr//_/.}
|
|
|
3604df |
|
|
|
3604df |
- pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} cidr_netmask=32 op monitor interval=15s
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${1}-nfs_block ocf:heartbeat:portblock protocol=tcp \
|
|
|
3604df |
+ portno=2049 action=block ip=${ipaddr} --group ${1}-group
|
|
|
3604df |
if [ $? -ne 0 ]; then
|
|
|
3604df |
- logger "warning pcs resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} cidr_netmask=32 op monitor interval=10s failed"
|
|
|
3604df |
+ logger "warning pcs resource create ${1}-nfs_block failed"
|
|
|
3604df |
+ fi
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
|
|
|
3604df |
+ cidr_netmask=32 op monitor interval=15s --group ${1}-group --after ${1}-nfs_block
|
|
|
3604df |
+ if [ $? -ne 0 ]; then
|
|
|
3604df |
+ logger "warning pcs resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
|
|
|
3604df |
+ cidr_netmask=32 op monitor interval=15s failed"
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
pcs -f ${cibfile} constraint order nfs-grace-clone then ${1}-cluster_ip-1
|
|
|
3604df |
@@ -589,6 +596,15 @@ recreate_resources()
|
|
|
3604df |
logger "warning: pcs constraint order nfs-grace-clone then ${1}-cluster_ip-1 failed"
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${1}-nfs_unblock ocf:heartbeat:portblock protocol=tcp \
|
|
|
3604df |
+ portno=2049 action=unblock ip=${ipaddr} reset_local_on_unblock_stop=true \
|
|
|
3604df |
+ tickle_dir=${HA_VOL_MNT}/nfs-ganesha/tickle_dir/ --group ${1}-group --after ${1}-cluster_ip-1 \
|
|
|
3604df |
+ op stop timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op start timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} \
|
|
|
3604df |
+ op monitor interval=10s timeout=${PORTBLOCK_UNBLOCK_TIMEOUT}
|
|
|
3604df |
+ if [ $? -ne 0 ]; then
|
|
|
3604df |
+ logger "warning pcs resource create ${1}-nfs_unblock failed"
|
|
|
3604df |
+ fi
|
|
|
3604df |
+
|
|
|
3604df |
shift
|
|
|
3604df |
done
|
|
|
3604df |
}
|
|
|
3604df |
@@ -602,15 +618,32 @@ addnode_recreate_resources()
|
|
|
3604df |
|
|
|
3604df |
recreate_resources ${cibfile} ${HA_SERVERS}
|
|
|
3604df |
|
|
|
3604df |
- pcs -f ${cibfile} resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${add_vip} cidr_netmask=32 op monitor interval=15s
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${add_node}-nfs_block ocf:heartbeat:portblock \
|
|
|
3604df |
+ protocol=tcp portno=2049 action=block ip=${ipaddr} --group ${add_node}-group
|
|
|
3604df |
if [ $? -ne 0 ]; then
|
|
|
3604df |
- logger "warning pcs resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${add_vip} cidr_netmask=32 op monitor interval=10s failed"
|
|
|
3604df |
+ logger "warning pcs resource create ${add_node}-nfs_block failed"
|
|
|
3604df |
+ fi
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr \
|
|
|
3604df |
+ ip=${ipaddr} cidr_netmask=32 op monitor interval=15s --group ${add_node}-group \
|
|
|
3604df |
+ --after ${add_node}-nfs_block
|
|
|
3604df |
+ if [ $? -ne 0 ]; then
|
|
|
3604df |
+ logger "warning pcs resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr \
|
|
|
3604df |
+ ip=${ipaddr} cidr_netmask=32 op monitor interval=15s failed"
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
pcs -f ${cibfile} constraint order nfs-grace-clone then ${add_node}-cluster_ip-1
|
|
|
3604df |
if [ $? -ne 0 ]; then
|
|
|
3604df |
logger "warning: pcs constraint order nfs-grace-clone then ${add_node}-cluster_ip-1 failed"
|
|
|
3604df |
fi
|
|
|
3604df |
+ pcs -f ${cibfile} resource create ${add_node}-nfs_unblock ocf:heartbeat:portblock \
|
|
|
3604df |
+ protocol=tcp portno=2049 action=unblock ip=${ipaddr} reset_local_on_unblock_stop=true \
|
|
|
3604df |
+ tickle_dir=${HA_VOL_MNT}/nfs-ganesha/tickle_dir/ --group ${add_node}-group --after \
|
|
|
3604df |
+ ${add_node}-cluster_ip-1 op stop timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op start \
|
|
|
3604df |
+ timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op monitor interval=10s \
|
|
|
3604df |
+ timeout=${PORTBLOCK_UNBLOCK_TIMEOUT}
|
|
|
3604df |
+ if [ $? -ne 0 ]; then
|
|
|
3604df |
+ logger "warning pcs resource create ${add_node}-nfs_unblock failed"
|
|
|
3604df |
+ fi
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
|
|
|
3604df |
@@ -619,9 +652,9 @@ clear_resources()
|
|
|
3604df |
local cibfile=${1}; shift
|
|
|
3604df |
|
|
|
3604df |
while [[ ${1} ]]; do
|
|
|
3604df |
- pcs -f ${cibfile} resource delete ${1}-cluster_ip-1
|
|
|
3604df |
+ pcs -f ${cibfile} resource delete ${1}-group
|
|
|
3604df |
if [ $? -ne 0 ]; then
|
|
|
3604df |
- logger "warning: pcs -f ${cibfile} resource delete ${1}-cluster_ip-1"
|
|
|
3604df |
+ logger "warning: pcs -f ${cibfile} resource delete ${1}-group"
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
shift
|
|
|
3604df |
@@ -698,7 +731,7 @@ deletenode_update_haconfig()
|
|
|
3604df |
local clean_name=${name//[-.]/_}
|
|
|
3604df |
|
|
|
3604df |
ha_servers=$(echo ${HA_SERVERS} | sed -e "s/ /,/")
|
|
|
3604df |
- sed -i -e "s/^HA_CLUSTER_NODES=.*$/HA_CLUSTER_NODES=\"${ha_servers// /,}\"/" -e "s/^${clean_name}=.*$//" -e "/^$/d" ${HA_CONFDIR}/ganesha-ha.conf
|
|
|
3604df |
+ sed -i -e "s/^HA_CLUSTER_NODES=.*$/HA_CLUSTER_NODES=\"${ha_servers// /,}\"/" -e "s/^${name}=.*$//" -e "/^$/d" ${HA_CONFDIR}/ganesha-ha.conf
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
|
|
|
3604df |
@@ -852,6 +885,20 @@ create_ganesha_conf_file()
|
|
|
3604df |
fi
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+set_quorum_policy()
|
|
|
3604df |
+{
|
|
|
3604df |
+ local quorum_policy="stop"
|
|
|
3604df |
+ local num_servers=${1}
|
|
|
3604df |
+
|
|
|
3604df |
+ if [ ${num_servers} -lt 3 ]; then
|
|
|
3604df |
+ quorum_policy="ignore"
|
|
|
3604df |
+ fi
|
|
|
3604df |
+ pcs property set no-quorum-policy=${quorum_policy}
|
|
|
3604df |
+ if [ $? -ne 0 ]; then
|
|
|
3604df |
+ logger "warning: pcs property set no-quorum-policy=${quorum_policy} failed"
|
|
|
3604df |
+ fi
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
main()
|
|
|
3604df |
{
|
|
|
3604df |
|
|
|
3604df |
@@ -936,13 +983,16 @@ main()
|
|
|
3604df |
# newly added node to the file so that the resources specfic
|
|
|
3604df |
# to this node is correctly recreated in the future.
|
|
|
3604df |
clean_node=${node//[-.]/_}
|
|
|
3604df |
- echo "VIP_$clean_node=\"${vip}\"" >> ${HA_CONFDIR}/ganesha-ha.conf
|
|
|
3604df |
+ echo "VIP_${node}=\"${vip}\"" >> ${HA_CONFDIR}/ganesha-ha.conf
|
|
|
3604df |
|
|
|
3604df |
NEW_NODES="$HA_CLUSTER_NODES,${node}"
|
|
|
3604df |
|
|
|
3604df |
sed -i s/HA_CLUSTER_NODES.*/"HA_CLUSTER_NODES=\"$NEW_NODES\""/ \
|
|
|
3604df |
$HA_CONFDIR/ganesha-ha.conf
|
|
|
3604df |
HA_SERVERS="${HA_SERVERS} ${node}"
|
|
|
3604df |
+
|
|
|
3604df |
+ HA_NUM_SERVERS=$(expr ${HA_NUM_SERVERS} + 1)
|
|
|
3604df |
+ set_quorum_policy ${HA_NUM_SERVERS}
|
|
|
3604df |
;;
|
|
|
3604df |
|
|
|
3604df |
delete | --delete)
|
|
|
3604df |
@@ -966,6 +1016,9 @@ $HA_CONFDIR/ganesha-ha.conf
|
|
|
3604df |
determine_service_manager
|
|
|
3604df |
|
|
|
3604df |
manage_service "stop" ${node}
|
|
|
3604df |
+
|
|
|
3604df |
+ HA_NUM_SERVERS=$(expr ${HA_NUM_SERVERS} - 1)
|
|
|
3604df |
+ set_quorum_policy ${HA_NUM_SERVERS}
|
|
|
3604df |
;;
|
|
|
3604df |
|
|
|
3604df |
status | --status)
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|