File pacemaker-pengine-dont-reload-and-restart-in-same-transition.patch of Package pacemaker.14737
commit 4acd528347c94fa73ca74548081d97b45543e893
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Mon Oct 16 17:55:05 2017 -0500
Fix: pengine: don't schedule reload and restart in same transition
2558d76f introduced a regression into 1.1.15 where a restart that becomes
required would not cancel a previously scheduled reload, so that both
actions would be scheduled.
This introduces a new ordering flag to indicate that if 'then' becomes
required, 'first' should become optional.
Index: pacemaker-1.1.16+20170320.77ea74d/include/crm/pengine/status.h
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/include/crm/pengine/status.h
+++ pacemaker-1.1.16+20170320.77ea74d/include/crm/pengine/status.h
@@ -417,6 +417,7 @@ enum pe_ordering {
pe_order_anti_colocation = 0x800000,
pe_order_preserve = 0x1000000, /* Hack for breaking user ordering constraints with container resources */
+ pe_order_then_cancels_first = 0x2000000, // if 'then' becomes required, 'first' becomes optional
pe_order_trace = 0x4000000, /* test marker */
};
/* *INDENT-ON* */
Index: pacemaker-1.1.16+20170320.77ea74d/pengine/graph.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/pengine/graph.c
+++ pacemaker-1.1.16+20170320.77ea74d/pengine/graph.c
@@ -524,6 +524,17 @@ update_action(action_t * then)
clear_bit(changed, pe_graph_updated_first);
+ if (first->rsc && is_set(other->type, pe_order_then_cancels_first)
+ && is_not_set(then->flags, pe_action_optional)) {
+
+ /* 'then' is required, so we must abandon 'first'
+ * (e.g. a required stop cancels any reload).
+ * Only used with reload actions as 'first'.
+ */
+ set_bit(other->action->flags, pe_action_optional);
+ clear_bit(first->rsc->flags, pe_rsc_reload);
+ }
+
if (first->rsc && then->rsc && (first->rsc != then->rsc)
&& (is_parent(then->rsc, first->rsc) == FALSE)) {
Index: pacemaker-1.1.16+20170320.77ea74d/pengine/native.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/pengine/native.c
+++ pacemaker-1.1.16+20170320.77ea74d/pengine/native.c
@@ -79,8 +79,6 @@ gboolean (*rsc_action_matrix[RSC_ROLE_MA
};
/* *INDENT-ON* */
-static action_t * get_first_named_action(resource_t * rsc, const char *action, gboolean only_valid, node_t * current);
-
static gboolean
native_choose_node(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
{
@@ -3096,42 +3094,10 @@ enum stack_activity {
stack_middle = 4,
};
-static action_t *
-get_first_named_action(resource_t * rsc, const char *action, gboolean only_valid, node_t * current)
-{
- action_t *a = NULL;
- GListPtr action_list = NULL;
- char *key = generate_op_key(rsc->id, action, 0);
-
- action_list = find_actions(rsc->actions, key, current);
-
- if (action_list == NULL || action_list->data == NULL) {
- crm_trace("%s: no %s action", rsc->id, action);
- free(key);
- return NULL;
- }
-
- a = action_list->data;
- g_list_free(action_list);
-
- if (only_valid && is_set(a->flags, pe_action_pseudo)) {
- crm_trace("%s: pseudo", key);
- a = NULL;
-
- } else if (only_valid && is_not_set(a->flags, pe_action_runnable)) {
- crm_trace("%s: runnable", key);
- a = NULL;
- }
-
- free(key);
- return a;
-}
-
void
ReloadRsc(resource_t * rsc, node_t *node, pe_working_set_t * data_set)
{
GListPtr gIter = NULL;
- action_t *other = NULL;
action_t *reload = NULL;
if (rsc->children) {
@@ -3162,20 +3128,16 @@ ReloadRsc(resource_t * rsc, node_t *node
pe_rsc_trace(rsc, "Processing %s", rsc->id);
set_bit(rsc->flags, pe_rsc_reload);
-
+
reload = custom_action(
rsc, reload_key(rsc), CRMD_ACTION_RELOAD, node, FALSE, TRUE, data_set);
- /* stop = stop_action(rsc, node, optional); */
- other = get_first_named_action(rsc, RSC_STOP, TRUE, node);
- if (other != NULL) {
- order_actions(reload, other, pe_order_optional);
- }
-
- other = get_first_named_action(rsc, RSC_DEMOTE, TRUE, node);
- if (other != NULL) {
- order_actions(reload, other, pe_order_optional);
- }
+ custom_action_order(NULL, NULL, reload, rsc, stop_key(rsc), NULL,
+ pe_order_optional|pe_order_then_cancels_first,
+ data_set);
+ custom_action_order(NULL, NULL, reload, rsc, demote_key(rsc), NULL,
+ pe_order_optional|pe_order_then_cancels_first,
+ data_set);
}
void