diff options
author | Martin Schwenke <martin@meltin.net> | 2011-01-14 09:31:56 +1100 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-08-11 10:46:57 +1000 |
commit | 3a760b09edaa5d471019595515d88607816c4d11 (patch) | |
tree | 4b775ed368b00e492c32ad93da3b330acf9ac527 | |
parent | e66a1af9b33d6dfe925dacbe58b99cf068dd7ec4 (diff) | |
download | samba-3a760b09edaa5d471019595515d88607816c4d11.tar.gz samba-3a760b09edaa5d471019595515d88607816c4d11.tar.xz samba-3a760b09edaa5d471019595515d88607816c4d11.zip |
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)
-rwxr-xr-x | ctdb/config/functions | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions index e685c07ace..2668531ca8 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -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 } |