File pacemaker#3772-0001-Refactor-libpacemaker-add-PCMK__XA_FAILED_START_OFFS.patch of Package pacemaker.38492

From 96381eabe9b2b01cdcf49dc2d3b3e6de79131747 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 13 Dec 2024 10:47:11 +0100
Subject: [PATCH 1/2] Refactor: libpacemaker: add PCMK__XA_FAILED_START_OFFSET
 and PCMK__XA_FAILED_STOP_OFFSET

Besides, use CRM_INFINITY_S constant instead of "INFINITY".
---
 include/crm_internal.h | 2 ++
 lib/pacemaker/pcmk_graph_consumer.c     | 4 ++--
 lib/pacemaker/pcmk_graph_producer.c     | 8 +++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

Index: pacemaker-2.1.7+20231219.0f7f88312/include/crm_internal.h
===================================================================
--- pacemaker-2.1.7+20231219.0f7f88312.orig/include/crm_internal.h
+++ pacemaker-2.1.7+20231219.0f7f88312/include/crm_internal.h
@@ -83,6 +83,8 @@
 #define PCMK__XA_CONFIRM                "confirm"
 #define PCMK__XA_CRMD                   "crmd"
 #define PCMK__XA_EXPECTED               "expected"
+#define PCMK__XA_FAILED_START_OFFSET    "failed-start-offset"
+#define PCMK__XA_FAILED_STOP_OFFSET     "failed-stop-offset"
 #define PCMK__XA_GRAPH_ERRORS           "graph-errors"
 #define PCMK__XA_GRAPH_WARNINGS         "graph-warnings"
 #define PCMK__XA_IN_CCM                 "in_ccm"
Index: pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_graph_consumer.c
===================================================================
--- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/pacemaker/pcmk_graph_consumer.c
+++ pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_graph_consumer.c
@@ -788,9 +788,9 @@ pcmk__unpack_graph(const xmlNode *xml_gr
         pcmk__scan_min_int(buf, &(new_graph->migration_limit), -1);
 
         pcmk__str_update(&(new_graph->failed_stop_offset),
-                         crm_element_value(xml_graph, "failed-stop-offset"));
+                         crm_element_value(xml_graph, PCMK__XA_FAILED_STOP_OFFSET));
         pcmk__str_update(&(new_graph->failed_start_offset),
-                         crm_element_value(xml_graph, "failed-start-offset"));
+                         crm_element_value(xml_graph, PCMK__XA_FAILED_START_OFFSET));
 
         if (crm_element_value_epoch(xml_graph, "recheck-by",
                                     &(new_graph->recheck_by)) != pcmk_ok) {
Index: pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_graph_producer.c
===================================================================
--- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/pacemaker/pcmk_graph_producer.c
+++ pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_graph_producer.c
@@ -1016,12 +1016,14 @@ pcmk__create_graph(pcmk_scheduler_t *sch
     value = pe_pref(scheduler->config_hash, "stonith-timeout");
     crm_xml_add(scheduler->graph, "stonith-timeout", value);
 
-    crm_xml_add(scheduler->graph, "failed-stop-offset", "INFINITY");
+    crm_xml_add(scheduler->graph, PCMK__XA_FAILED_STOP_OFFSET,
+                CRM_INFINITY_S);
 
     if (pcmk_is_set(scheduler->flags, pcmk_sched_start_failure_fatal)) {
-        crm_xml_add(scheduler->graph, "failed-start-offset", "INFINITY");
+        crm_xml_add(scheduler->graph, PCMK__XA_FAILED_START_OFFSET,
+                    CRM_INFINITY_S);
     } else {
-        crm_xml_add(scheduler->graph, "failed-start-offset", "1");
+        crm_xml_add(scheduler->graph, PCMK__XA_FAILED_START_OFFSET, "1");
     }
 
     value = pe_pref(scheduler->config_hash, "batch-limit");
openSUSE Build Service is sponsored by