File bsc#1188653-0001-Fix-scheduler-don-t-schedule-probes-of-unmanaged-res.patch of Package pacemaker.26122

From b0347f7b8e609420a7055d5fe537cc40ac0d1bb2 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Fri, 16 Jul 2021 11:08:05 -0500
Subject: [PATCH 1/3] Fix: scheduler: don't schedule probes of unmanaged
 resources on pending nodes

Previously, custom_action() would set an action's optional or runnable flag in
the same, exclusive if-else sequence. This means that if an action should be
optional *and* runnable, only one would be set. In particular, this meant that
if a resource is unmanaged *and* its allocated node is pending, any probe would
be set to optional, but not unrunnable, and the controller could wrongly
attempt the probe before the join completed.

Now, optional is checked separately.
---
 lib/pengine/utils.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
index 5ef742e7c..965824bd8 100644
--- a/lib/pengine/utils.c
+++ b/lib/pengine/utils.c
@@ -541,6 +541,20 @@ custom_action(pe_resource_t * rsc, char *key, const char *task,
                                        FALSE, data_set);
         }
 
+        // Make the action optional if its resource is unmanaged
+        if (!pcmk_is_set(action->flags, pe_action_pseudo)
+            && (action->node != NULL)
+            && !pcmk_is_set(action->rsc->flags, pe_rsc_managed)
+            && (g_hash_table_lookup(action->meta,
+                                    XML_LRM_ATTR_INTERVAL_MS) == NULL)) {
+                pe_rsc_debug(rsc, "%s on %s is optional (%s is unmanaged)",
+                             action->uuid, action->node->details->uname,
+                             action->rsc->id);
+                pe__set_action_flags(action, pe_action_optional);
+                // We shouldn't clear runnable here because ... something
+        }
+
+        // Make the action runnable or unrunnable as appropriate
         if (pcmk_is_set(action->flags, pe_action_pseudo)) {
             /* leave untouched */
 
@@ -549,14 +563,6 @@ custom_action(pe_resource_t * rsc, char *key, const char *task,
                          action->uuid);
             pe__clear_action_flags(action, pe_action_runnable);
 
-        } else if (!pcmk_is_set(rsc->flags, pe_rsc_managed)
-                   && g_hash_table_lookup(action->meta,
-                                          XML_LRM_ATTR_INTERVAL_MS) == NULL) {
-            pe_rsc_debug(rsc, "%s on %s is optional (%s is unmanaged)",
-                         action->uuid, action->node->details->uname, rsc->id);
-            pe__set_action_flags(action, pe_action_optional);
-            //pe__clear_action_flags(action, pe_action_runnable);
-
         } else if (!pcmk_is_set(action->flags, pe_action_dc)
                    && !(action->node->details->online)
                    && (!pe__is_guest_node(action->node)
-- 
2.31.1

openSUSE Build Service is sponsored by