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

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(+)

diff --git a/daemons/attrd/attrd_elections.c b/daemons/attrd/attrd_elections.c
index ae4392fd3..3bf18e086 100644
--- a/daemons/attrd/attrd_elections.c
+++ b/daemons/attrd/attrd_elections.c
@@ -151,6 +151,14 @@ attrd_remove_voter(const crm_node_t *peer)
          * attributes.
          */
         attrd_start_election_if_needed();
+
+    /* 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);
     }
 }
 
-- 
2.31.1

openSUSE Build Service is sponsored by