File bsc#1181744-0001-Fix-fencer-broadcast-returned-fencing-operations-to-.patch of Package pacemaker.19271

From 93e5a545e11f9f34e7a654c012d051bfab829211 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 12 Feb 2021 17:37:06 +0100
Subject: [PATCH 1/4] Fix: fencer: broadcast returned fencing operations to
 update outdated pending ones in remote peer history

---
 daemons/fenced/fenced_history.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Index: pacemaker-2.0.4+20200616.2deceaa3a/daemons/fenced/fenced_history.c
===================================================================
--- pacemaker-2.0.4+20200616.2deceaa3a.orig/daemons/fenced/fenced_history.c
+++ pacemaker-2.0.4+20200616.2deceaa3a/daemons/fenced/fenced_history.c
@@ -287,9 +287,26 @@ stonith_local_history_diff(GHashTable *r
             while (g_hash_table_iter_next(&iter, NULL, (void **)&op)) {
                 xmlNode *entry = NULL;
 
-                if (remote_history &&
-                    g_hash_table_lookup(remote_history, op->id)) {
-                    continue; /* skip entries broadcasted already */
+                if (remote_history) {
+                    remote_fencing_op_t *remote_op =
+                        g_hash_table_lookup(remote_history, op->id);
+
+                    if (remote_op) {
+                        if (remote_op->state != st_failed
+                            && remote_op->state != st_done
+                            && (op->state == st_failed
+                                || op->state == st_done)) {
+
+                            crm_debug("Broadcasting operation %.8s (state=%d) to "
+                                      "update the outdated pending one "
+                                      "(state=%d) in remote peer history",
+                                      op->id, op->state,
+                                      remote_op->state);
+
+                        } else {
+                            continue; /* skip entries broadcasted already */
+                        }
+                    }
                 }
 
                 if (target && strcmp(op->target, target) != 0) {
openSUSE Build Service is sponsored by