File bsc#1181744-0004-Fix-crmd-remove-stonith-notifications-upon-connectio-1.1.patch of Package pacemaker.19778

From 732f069557e490a9ce1d1a5adfc74081c3e309c1 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 8 Jul 2019 19:32:28 +0200
Subject: [PATCH 4/8] Fix: crmd: remove-stonith-notifications upon
 connection-destroy

---
 crmd/te_utils.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/crmd/te_utils.c b/crmd/te_utils.c
index 280fc95e9..f5bcb84fd 100644
--- a/crmd/te_utils.c
+++ b/crmd/te_utils.c
@@ -183,8 +183,15 @@ tengine_stonith_connection_destroy(stonith_t * st, stonith_event_t * e)
     }
 
     /* cbchan will be garbage at this point, arrange for it to be reset */
-    if(stonith_api) {
-        stonith_api->state = stonith_disconnected;
+    if (stonith_api) {
+        /* the client API won't properly reconnect notifications
+         * if they are still in the table - so remove them
+         */
+        stonith_api->cmds->remove_notification(st, T_STONITH_NOTIFY_DISCONNECT);
+        stonith_api->cmds->remove_notification(st, T_STONITH_NOTIFY_FENCE);
+        if (stonith_api->state != stonith_disconnected) {
+            stonith_api->cmds->disconnect(st);
+        }
     }
 
     if (AM_I_DC) {
-- 
2.26.2

openSUSE Build Service is sponsored by