File bsc#1188653-0001-Fix-scheduler-don-t-schedule-probes-of-unmanaged-res.patch of Package pacemaker.29826
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(-)
Index: pacemaker-2.0.4+20200616.2deceaa3a/lib/pengine/utils.c
===================================================================
--- pacemaker-2.0.4+20200616.2deceaa3a.orig/lib/pengine/utils.c
+++ pacemaker-2.0.4+20200616.2deceaa3a/lib/pengine/utils.c
@@ -603,6 +603,20 @@ custom_action(pe_resource_t * rsc, char
action->extra, NULL, FALSE, data_set);
}
+ // Make the action optional if its resource is unmanaged
+ if (!is_set(action->flags, pe_action_pseudo)
+ && (action->node != NULL)
+ && !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_bit(action, pe_action_optional);
+ // We shouldn't clear runnable here because ... something
+ }
+
+ // Make the action runnable or unrunnable as appropriate
if (is_set(action->flags, pe_action_pseudo)) {
/* leave untouched */
@@ -610,14 +624,6 @@ custom_action(pe_resource_t * rsc, char
pe_rsc_trace(rsc, "Unset runnable on %s", action->uuid);
pe_clear_action_bit(action, pe_action_runnable);
- } else if (is_not_set(rsc->flags, pe_rsc_managed)
- && g_hash_table_lookup(action->meta,
- XML_LRM_ATTR_INTERVAL_MS) == NULL) {
- crm_debug("Action %s (unmanaged)", action->uuid);
- pe_rsc_trace(rsc, "Set optional on %s", action->uuid);
- pe_set_action_bit(action, pe_action_optional);
-/* action->runnable = FALSE; */
-
} else if (is_not_set(action->flags, pe_action_dc)
&& !(action->node->details->online)
&& (!pe__is_guest_node(action->node)