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

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