File bsc#1188653-0001-Fix-scheduler-don-t-schedule-probes-of-unmanaged-res-1.1.patch of Package pacemaker.22685
From 3186b347cf2991fa0e19fdcec82ed32db5bcc1c5 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 | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
index 1fe4b1938..ad84e25ff 100644
--- a/lib/pengine/utils.c
+++ b/lib/pengine/utils.c
@@ -600,6 +600,20 @@ custom_action(resource_t * rsc, char *key, const char *task,
action->extra, NULL, FALSE, data_set->now);
}
+ // 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) == 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 */
@@ -607,13 +621,6 @@ custom_action(resource_t * rsc, char *key, const char *task,
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) == 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 (action->node->details->online == FALSE
&& (!is_container_remote_node(action->node) || action->node->details->remote_requires_reset)) {
pe_clear_action_bit(action, pe_action_runnable);
--
2.31.1