File pacemaker-libpe_status-ability-log-warning-once.patch of Package pacemaker.openSUSE_Leap_42.3_Update
commit f6795045ff8e23ac995c75acb83adce65f07c3ee
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Mon Sep 25 11:32:30 2017 -0500
    Refactor: libpe_status: generalize ability to log warning only once
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
index e9101e280..21bac674e 100644
--- a/lib/pengine/unpack.c
+++ b/lib/pengine/unpack.c
@@ -46,6 +46,9 @@ gboolean unpack_rsc_op(resource_t * rsc, node_t * node, xmlNode * xml_op, xmlNod
                        enum action_fail_response *failed, pe_working_set_t * data_set);
 static gboolean determine_remote_online_status(pe_working_set_t * data_set, node_t * this_node);
 
+// Bitmask for warnings we only want to print once
+uint32_t pe_wo = 0;
+
 static gboolean
 is_dangling_container_remote_node(node_t *node)
 {
@@ -477,7 +480,6 @@ handle_startup_fencing(pe_working_set_t *data_set, node_t *new_node)
 {
     static const char *blind_faith = NULL;
     static gboolean unseen_are_unclean = TRUE;
-    static gboolean need_warning = TRUE;
 
     if ((new_node->details->type == node_remote) && (new_node->details->remote_rsc == NULL)) {
         /* Ignore fencing for remote nodes that don't have a connection resource
@@ -491,12 +493,7 @@ handle_startup_fencing(pe_working_set_t *data_set, node_t *new_node)
 
     if (crm_is_true(blind_faith) == FALSE) {
         unseen_are_unclean = FALSE;
-        if (need_warning) {
-            crm_warn("Blind faith: not fencing unseen nodes");
-
-            /* Warn once per run, not per node and transition */
-            need_warning = FALSE;
-        }
+        pe_warn_once(pe_wo_blind, "Blind faith: not fencing unseen nodes");
     }
 
     if (is_set(data_set->flags, pe_flag_stonith_enabled) == FALSE
diff --git a/lib/pengine/unpack.h b/lib/pengine/unpack.h
index 4e3f77f28..387aedad7 100644
--- a/lib/pengine/unpack.h
+++ b/lib/pengine/unpack.h
@@ -93,4 +93,23 @@ extern gboolean determine_online_status(xmlNode * node_state, node_t * this_node
 		do_crm_log(log_level, fmt, ##args);	\
 	}
 
+// Some warnings we don't want to print every transition
+
+enum pe_warn_once_e {
+    pe_wo_blind         = 0x0001,
+};
+
+extern uint32_t pe_wo;
+
+#define pe_warn_once(pe_wo_bit, fmt...) do {    \
+        if (is_not_set(pe_wo, pe_wo_bit)) {     \
+            if (pe_wo_bit == pe_wo_blind) {     \
+                crm_warn(fmt);                  \
+            } else {                            \
+                pe_warn(fmt);                   \
+            }                                   \
+            set_bit(pe_wo, pe_wo_bit);          \
+        }                                       \
+    } while (0);
+
 #endif