mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
Evenscripts: improvements to ctdb_service_check_reconfigure().
* Make this function applicable to "ipreallocated" event too. * Monitor event should not always succeed just because we reconfigure. If the service was unhealthy before the reconfigure and we end the reconfigure with "exit 0" then we can cause the node's health status to flip-flop. To avoid this we return the status of the service from the previous monitor event. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 21dfcbbdccd906fcd6ab7bba81418ce565bf63aa)
This commit is contained in:
parent
e66a1af9b3
commit
3a760b09ed
@ -689,11 +689,26 @@ service_reconfigure ()
|
||||
|
||||
ctdb_service_check_reconfigure ()
|
||||
{
|
||||
[ "$event_name" = "monitor" ] || return 0
|
||||
# Only do this for certain events.
|
||||
case "$event_name" in
|
||||
monitor|ipreallocated) : ;;
|
||||
*) return 0
|
||||
esac
|
||||
|
||||
if ctdb_service_needs_reconfigure "$@" ; then
|
||||
ctdb_service_reconfigure "$@"
|
||||
exit 0
|
||||
|
||||
# Fall through to non-monitor events.
|
||||
[ "$event_name" = "monitor" ] || return 0
|
||||
|
||||
# We don't want to proceed with the rest of the monitor event
|
||||
# here, so we exit. However, if we exit 0 then, if the
|
||||
# service was previously broken, we might return a false
|
||||
# positive. So we simply retrieve the status of this script
|
||||
# from the previous monitor loop and exit with that status.
|
||||
ctdb scriptstatus | \
|
||||
grep -q -E "^${script_name}[[:space:]]+Status:OK[[:space:]]"
|
||||
exit $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user