File bsc#1196340-0002-Refactor-scheduler-functionize-comparing-which-lrm_r.patch of Package pacemaker.29826
From 66ed57b2191ec6d7231e20602e805a0d685acd2b Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Mon, 9 May 2022 13:04:53 +0200
Subject: [PATCH 2/9] Refactor: scheduler: functionize comparing which
lrm_rsc_op is newer
---
include/crm/pengine/internal.h | 1 +
lib/pengine/utils.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
Index: pacemaker-2.0.5+20201202.ba59be712/include/crm/pengine/internal.h
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/include/crm/pengine/internal.h
+++ pacemaker-2.0.5+20201202.ba59be712/include/crm/pengine/internal.h
@@ -469,6 +469,7 @@ extern void pe_free_action(pe_action_t *
extern void resource_location(pe_resource_t * rsc, pe_node_t * node, int score, const char *tag,
pe_working_set_t * data_set);
+extern int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b);
extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
extern gboolean get_target_role(pe_resource_t * rsc, enum rsc_role_e *role);
Index: pacemaker-2.0.5+20201202.ba59be712/lib/pengine/utils.c
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/lib/pengine/utils.c
+++ pacemaker-2.0.5+20201202.ba59be712/lib/pengine/utils.c
@@ -1715,8 +1715,8 @@ resource_location(pe_resource_t * rsc, p
return an_int; \
} while(0)
-gint
-sort_op_by_callid(gconstpointer a, gconstpointer b)
+int
+pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b)
{
int a_call_id = -1;
int b_call_id = -1;
@@ -1724,9 +1724,6 @@ sort_op_by_callid(gconstpointer a, gcons
char *a_uuid = NULL;
char *b_uuid = NULL;
- const xmlNode *xml_a = a;
- const xmlNode *xml_b = b;
-
const char *a_xml_id = crm_element_value(xml_a, XML_ATTR_ID);
const char *b_xml_id = crm_element_value(xml_b, XML_ATTR_ID);
@@ -1829,7 +1826,15 @@ sort_op_by_callid(gconstpointer a, gcons
/* we should never end up here */
CRM_CHECK(FALSE, sort_return(0, "default"));
+}
+
+gint
+sort_op_by_callid(gconstpointer a, gconstpointer b)
+{
+ const xmlNode *xml_a = a;
+ const xmlNode *xml_b = b;
+ return pe__is_newer_op(xml_a, xml_b);
}
time_t