Skip to content

Commit 48c05a5

Browse files
Merge pull request #3166 from bogdando/fix_ocf_ra
OCF RA: fix start/stop handling (cherry picked from commit b6f5c2d)
1 parent d596582 commit 48c05a5

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

scripts/rabbitmq-server-ha.ocf

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -628,13 +628,13 @@ master_score() {
628628
get_hostname() {
629629
local os=$(uname -s)
630630
if [ "${OCF_RESKEY_use_fqdn}" = 'false' ] ; then
631-
if [ "$os" == "SunOS" ]; then
631+
if [ "$os" = "SunOS" ]; then
632632
echo "$(hostname | sed 's@\..*@@')"
633633
else
634634
echo "$(hostname -s)"
635635
fi
636636
else
637-
if [ "$os" == "SunOS" ]; then
637+
if [ "$os" = "SunOS" ]; then
638638
echo "$(hostname)"
639639
else
640640
echo "$(hostname -f)"
@@ -707,6 +707,7 @@ rmq_setup_env() {
707707
fi
708708
export RABBITMQ_PID_FILE=$OCF_RESKEY_pid_file
709709
MNESIA_FILES="${OCF_RESKEY_mnesia_base}/$(rabbit_node_name $H)"
710+
export RABBITMQ_SERVER_START_ARGS="${RABBITMQ_SERVER_START_ARGS} -mnesia dir \"${MNESIA_FILES}\" -sname $(rabbit_node_name $H)"
710711
RMQ_START_TIME="${MNESIA_FILES}/ocf_server_start_time.txt"
711712
MASTER_FLAG_FILE="${MNESIA_FILES}/ocf_master_for_${OCF_RESOURCE_INSTANCE}"
712713
THIS_PCMK_NODE=$(ocf_attribute_target)
@@ -801,7 +802,7 @@ reset_mnesia() {
801802
block_client_access()
802803
{
803804
# When OCF_RESKEY_avoid_using_iptables is true iptables calls are noops
804-
if [ "${OCF_RESKEY_avoid_using_iptables}" == 'true' ] ; then
805+
if [ "${OCF_RESKEY_avoid_using_iptables}" = 'true' ] ; then
805806
return $OCF_SUCCESS
806807
fi
807808
# do not add temporary RMQ blocking rule, if it is already exist
@@ -827,7 +828,7 @@ unblock_client_access()
827828
lhtext=$1
828829
fi
829830
# When OCF_RESKEY_avoid_using_iptables is true iptables calls are noops
830-
if [ "${OCF_RESKEY_avoid_using_iptables}" == 'true' ] ; then
831+
if [ "${OCF_RESKEY_avoid_using_iptables}" = 'true' ] ; then
831832
return
832833
fi
833834
# remove all temporary RMQ blocking rules, if there are more than one exist
@@ -1262,33 +1263,10 @@ start_beam_process() {
12621263
command="${OCF_RESKEY_binary} >> \"${OCF_RESKEY_log_dir}/startup_log\" 2>/dev/null"
12631264
RABBITMQ_NODE_ONLY=1 su rabbitmq -s /bin/sh -c "${command}"&
12641265
ts_end=$(( $(now) + ${OCF_RESKEY_start_time} ))
1265-
rc=$OCF_ERR_GENERIC
1266-
while [ $(now) -lt ${ts_end} ]; do
1267-
# waiting for normal start of beam
1268-
pid=0
1269-
pf_end=$(( $(now) + 3 ))
1270-
while [ $(now) -lt ${pf_end} ]; do
1271-
# waiting for OCF_RESKEY_pid_file of beam process
1272-
if [ -f "${OCF_RESKEY_pid_file}" ] ; then
1273-
pid=$(cat ${OCF_RESKEY_pid_file})
1274-
break
1275-
fi
1276-
sleep 1
1277-
done
1278-
if [ "${pid}" != "0" -a -d "/proc/${pid}" ] ; then
1279-
rc=$OCF_SUCCESS
1280-
break
1281-
fi
1282-
sleep 2
1283-
done
1284-
if [ $rc -ne $OCF_SUCCESS ]; then
1285-
if [ "${pid}" = "0" ] ; then
1286-
ocf_log warn "${LH} PID-file '${OCF_RESKEY_pid_file}' not found"
1287-
fi
1288-
ocf_log err "${LH} RMQ-runtime (beam) didn't start succesfully (rc=${rc})."
1289-
fi
1290-
1291-
return $rc
1266+
sleep 3 # give it some time, before attempting to start_app
1267+
# PID-file is now created later, if the application started successfully
1268+
# So assume beam.smp is started, and defer errors handling for start_app
1269+
return $OCF_SUCCESS
12921270
}
12931271

12941272
check_plugins() {

0 commit comments

Comments
 (0)