File pacemaker-crmd-allow-clearing-all-stonith-fail-counts.patch of Package pacemaker.14737
commit 714a8d07a500675d84e6ef779ba21e6c23e27853
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Mon Apr 10 17:20:08 2017 -0500
Low: crmd: allow clearing all stonith fail counts
for future improvements
diff --git a/crmd/te_callbacks.c b/crmd/te_callbacks.c
index aa4a1417d..4f896eeaf 100644
--- a/crmd/te_callbacks.c
+++ b/crmd/te_callbacks.c
@@ -668,17 +668,36 @@ too_many:
return TRUE;
}
+/*!
+ * \internal
+ * \brief Reset a stonith fail count
+ *
+ * \param[in] target Name of node to reset, or NULL for all
+ */
void
st_fail_count_reset(const char *target)
{
- struct st_fail_rec *rec = NULL;
+ if (stonith_failures == NULL) {
+ return;
+ }
+
+ if (target) {
+ struct st_fail_rec *rec = NULL;
- if (stonith_failures) {
rec = g_hash_table_lookup(stonith_failures, target);
- }
+ if (rec) {
+ rec->count = 0;
+ }
+ } else {
+ GHashTableIter iter;
+ const char *key = NULL;
+ struct st_fail_rec *rec = NULL;
- if (rec) {
- rec->count = 0;
+ g_hash_table_iter_init(&iter, stonith_failures);
+ while (g_hash_table_iter_next(&iter, (gpointer *) &key,
+ (gpointer *) &rec)) {
+ rec->count = 0;
+ }
}
}