File bsc#1196340-0006-Refactor-scheduler-find_lrm_op-to-be-able-to-check-a.patch of Package pacemaker.26926
From 2fa93ee58127f2bbd63a056617d7179fe9470923 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Mon, 9 May 2022 14:23:07 +0200
Subject: [PATCH 6/9] Refactor: scheduler: find_lrm_op() to be able to check
against a specified target_rc
---
lib/pengine/unpack.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Index: pacemaker-2.0.5+20201202.ba59be712/lib/pengine/unpack.c
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/lib/pengine/unpack.c
+++ pacemaker-2.0.5+20201202.ba59be712/lib/pengine/unpack.c
@@ -2460,7 +2460,7 @@ set_node_score(gpointer key, gpointer va
#define STATUS_PATH_MAX 1024
static xmlNode *
find_lrm_op(const char *resource, const char *op, const char *node, const char *source,
- bool success_only, pe_working_set_t *data_set)
+ int target_rc, pe_working_set_t *data_set)
{
int offset = 0;
char xpath[STATUS_PATH_MAX];
@@ -2491,13 +2491,13 @@ find_lrm_op(const char *resource, const
CRM_LOG_ASSERT(offset > 0);
xml = get_xpath_object(xpath, data_set->input, LOG_DEBUG);
- if (xml && success_only) {
+ if (xml && target_rc >= 0) {
int rc = PCMK_OCF_UNKNOWN_ERROR;
int status = PCMK_LRM_OP_ERROR;
crm_element_value_int(xml, XML_LRM_ATTR_RC, &rc);
crm_element_value_int(xml, XML_LRM_ATTR_OPSTATUS, &status);
- if ((rc != PCMK_OCF_OK) || (status != PCMK_LRM_OP_DONE)) {
+ if ((rc != target_rc) || (status != PCMK_LRM_OP_DONE)) {
return NULL;
}
}
@@ -2571,7 +2571,7 @@ stop_happened_after(pe_resource_t *rsc,
pe_working_set_t *data_set)
{
xmlNode *stop_op = find_lrm_op(rsc->id, CRMD_ACTION_STOP,
- node->details->uname, NULL, TRUE, data_set);
+ node->details->uname, NULL, PCMK_OCF_OK, data_set);
return (stop_op && (pe__call_id(stop_op) > pe__call_id(xml_op)));
}
@@ -2620,7 +2620,7 @@ unpack_migrate_to_success(pe_resource_t
// Check whether there was a migrate_from action on the target
migrate_from = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATED, target,
- source, FALSE, data_set);
+ source, -1, data_set);
if (migrate_from) {
crm_element_value_int(migrate_from, XML_LRM_ATTR_RC, &from_rc);
crm_element_value_int(migrate_from, XML_LRM_ATTR_OPSTATUS, &from_status);
@@ -2675,7 +2675,7 @@ static bool
newer_op(pe_resource_t *rsc, const char *action_name, const char *node_name,
int call_id, pe_working_set_t *data_set)
{
- xmlNode *action = find_lrm_op(rsc->id, action_name, node_name, NULL, TRUE,
+ xmlNode *action = find_lrm_op(rsc->id, action_name, node_name, NULL, PCMK_OCF_OK,
data_set);
return pe__call_id(action) > call_id;
@@ -2702,12 +2702,12 @@ unpack_migrate_to_failure(pe_resource_t
// Check for stop on the target
target_stop = find_lrm_op(rsc->id, CRMD_ACTION_STOP, target, NULL,
- TRUE, data_set);
+ PCMK_OCF_OK, data_set);
target_stop_id = pe__call_id(target_stop);
// Check for migrate_from on the target
target_migrate_from = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATED, target,
- source, TRUE, data_set);
+ source, PCMK_OCF_OK, data_set);
target_migrate_from_id = pe__call_id(target_migrate_from);
if (/* If the resource state is unknown on the target, it will likely be
@@ -2775,11 +2775,11 @@ unpack_migrate_from_failure(pe_resource_
// Check for a stop on the source
source_stop = find_lrm_op(rsc->id, CRMD_ACTION_STOP, source, NULL,
- TRUE, data_set);
+ PCMK_OCF_OK, data_set);
// Check for a migrate_to on the source
source_migrate_to = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATE,
- source, target, TRUE, data_set);
+ source, target, PCMK_OCF_OK, data_set);
if ((source_stop == NULL)
|| (pe__call_id(source_stop) < pe__call_id(source_migrate_to))) {