File pacemaker-crmd-DC-update-stonith-fail-count-before-aborting-transition.patch of Package pacemaker.8397
commit 2af655f20dc21550f48da36c9ac11cbe180696b8
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Thu Jun 8 17:07:59 2017 -0500
Low: crmd: DC should update stonith fail count before aborting transition
Fail count threshold check was off by one previously
diff --git a/crmd/te_callbacks.c b/crmd/te_callbacks.c
index c2b0c0d51..0a8de958c 100644
--- a/crmd/te_callbacks.c
+++ b/crmd/te_callbacks.c
@@ -822,6 +822,10 @@ tengine_stonith_callback(stonith_t * stonith, stonith_callback_data_t * data)
abort_action = tg_stop;
}
+ /* Increment the fail count now, so abort_for_stonith_failure() can
+ * check it. Non-DC nodes will increment it in tengine_stonith_notify().
+ */
+ st_fail_count_increment(target);
abort_for_stonith_failure(abort_action, target, NULL);
}
diff --git a/crmd/te_utils.c b/crmd/te_utils.c
index 9fd4c9f0b..5b13adc1d 100644
--- a/crmd/te_utils.c
+++ b/crmd/te_utils.c
@@ -259,7 +259,11 @@ tengine_stonith_notify(stonith_t * st, stonith_event_t * st_event)
return;
}
- if (safe_str_eq(st_event->operation, T_STONITH_NOTIFY_FENCE)) {
+ /* Update the count of stonith failures for this target, in case we become
+ * DC later. The current DC has already updated its fail count in
+ * tengine_stonith_callback().
+ */
+ if (!AM_I_DC && safe_str_eq(st_event->operation, T_STONITH_NOTIFY_FENCE)) {
if (st_event->result == pcmk_ok) {
st_fail_count_reset(st_event->target);
} else {