Blame SOURCES/0013-Fix-sbd-pacemaker-assume-graceful-exit-if-leftovers-.patch

04a57c
From 824fe834c67fb7bae7feb87607381f9fa8fa2945 Mon Sep 17 00:00:00 2001
04a57c
From: Klaus Wenninger <klaus.wenninger@aon.at>
04a57c
Date: Fri, 7 Jun 2019 19:09:06 +0200
04a57c
Subject: [PATCH] Fix: sbd-pacemaker: assume graceful exit if leftovers are
04a57c
 unmanged
04a57c
04a57c
---
04a57c
 src/sbd-pacemaker.c | 32 +++++++++++++++++++++++++++++++-
04a57c
 1 file changed, 31 insertions(+), 1 deletion(-)
04a57c
04a57c
diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c
04a57c
index 9a8b95f..2b35ff6 100644
04a57c
--- a/src/sbd-pacemaker.c
04a57c
+++ b/src/sbd-pacemaker.c
04a57c
@@ -333,11 +333,41 @@ compute_status(pe_working_set_t * data_set)
04a57c
         }
04a57c
     }
04a57c
 
04a57c
+    /* If we are in shutdown-state once this will go on till the end.
04a57c
+     * If we've on top reached a state of 0 locally running resources
04a57c
+     * we can assume a clean shutdown.
04a57c
+     * Tricky are the situations where the node is in maintenance-mode
04a57c
+     * or resources are unmanaged. So if the node is in maintenance or
04a57c
+     * all left-over running resources are unmanaged we assume intention.
04a57c
+     */
04a57c
     if (node->details->shutdown) {
04a57c
         pcmk_shutdown = 1;
04a57c
     }
04a57c
-    if (pcmk_shutdown && !(node->details->running_rsc)) {
04a57c
+    if (pcmk_shutdown)
04a57c
+    {
04a57c
         pcmk_clean_shutdown = 1;
04a57c
+        if (!(node->details->maintenance)) {
04a57c
+            GListPtr iter;
04a57c
+
04a57c
+            for (iter = node->details->running_rsc;
04a57c
+                 iter != NULL; iter = iter->next) {
04a57c
+                resource_t *rsc = (resource_t *) iter->data;
04a57c
+
04a57c
+
04a57c
+                if (is_set(rsc->flags, pe_rsc_managed)) {
04a57c
+                    pcmk_clean_shutdown = 0;
04a57c
+                    crm_debug("not clean as %s managed and still running",
04a57c
+                              rsc->id);
04a57c
+                    break;
04a57c
+                }
04a57c
+            }
04a57c
+            if (pcmk_clean_shutdown) {
04a57c
+                crm_debug("pcmk_clean_shutdown because "
04a57c
+                          "all managed resources down");
04a57c
+            }
04a57c
+        } else {
04a57c
+            crm_debug("pcmk_clean_shutdown because node is in maintenance");
04a57c
+        }
04a57c
     }
04a57c
     notify_parent();
04a57c
     return;
04a57c
-- 
04a57c
1.8.3.1
04a57c