File bsc#1191676-0001-Fix-attrd-check-election-status-upon-loss-of-a-voter.patch of Package pacemaker.26413

From cdbb28165f087b704c7642c097d860ee11df0895 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Wed, 27 Oct 2021 11:53:38 +0200
Subject: [PATCH] Fix: attrd: check election status upon loss of a voter to
 prevent unexpected pending

When a peer is lost, if an election of attrd writer is in progress, we
need to call election_check(), in case this lost peer is the only one
that hasn't voted, otherwise the election would be pending until it's
timed out.
---
 daemons/attrd/attrd_elections.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Index: pacemaker-1.1.18+20180430.b12c320f5/attrd/commands.c
===================================================================
--- pacemaker-1.1.18+20180430.b12c320f5.orig/attrd/commands.c
+++ pacemaker-1.1.18+20180430.b12c320f5/attrd/commands.c
@@ -997,6 +997,14 @@ attrd_peer_change_cb(enum crm_status_typ
                 free(peer_writer);
                 peer_writer = NULL;
                 crm_notice("Lost attribute writer %s", peer->uname);
+
+            /* If an election is in progress, we need to call election_check(), in case
+             * this lost peer is the only one that hasn't voted, otherwise the election
+             * would be pending until it's timed out.
+             */
+            } else if (election_state(writer) == election_in_progress) {
+               crm_debug("Checking election status upon loss of voter %s", peer->uname);
+               election_check(writer);
             }
         }
     }
openSUSE Build Service is sponsored by