File bsc#1210074-0007-Fix-controller-initial-timeout-for-fencing-callback-.patch of Package pacemaker.29826

From db32a9c43462c36dfe07eb4c3393aa2e9d711dad Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Mon, 17 Apr 2023 11:36:32 +0200
Subject: [PATCH 07/11] Fix: controller: initial timeout for fencing callback
 takes any priority fencing delay into account

It's usually not necessary under normal circumstances since the timeout
for the async callback gets updated very soon with
st_client.c:update_callback_timeout() once fencer has decided the total
fencing timeout and reported it back to controller with
fenced_remote.c:report_timeout_period(). But anyway it makes sense to
be added for the initial.
---
 daemons/controld/controld_fencing.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: pacemaker-2.0.4+20200616.2deceaa3a/daemons/controld/controld_fencing.c
===================================================================
--- pacemaker-2.0.4+20200616.2deceaa3a.orig/daemons/controld/controld_fencing.c
+++ pacemaker-2.0.4+20200616.2deceaa3a/daemons/controld/controld_fencing.c
@@ -815,7 +815,9 @@ te_fence_node(crm_graph_t *graph, crm_ac
     const char *type = NULL;
     char *transition_key = NULL;
     const char *priority_delay = NULL;
+    int delay_i = 0;
     gboolean invalid_action = FALSE;
+    guint stonith_timeout = transition_graph->stonith_timeout;
     enum stonith_call_options options = st_opt_none;
 
     id = ID(action->xml);
@@ -837,7 +839,7 @@ te_fence_node(crm_graph_t *graph, crm_ac
 
     crm_notice("Requesting fencing (%s) of node %s "
                CRM_XS " action=%s timeout=%u%s%s",
-               type, target, id, transition_graph->stonith_timeout,
+               type, target, id, stonith_timeout,
                priority_delay ? " priority_delay=" : "",
                priority_delay ? priority_delay : "");
 
@@ -848,16 +850,20 @@ te_fence_node(crm_graph_t *graph, crm_ac
         options |= st_opt_allow_suicide;
     }
 
+    delay_i = crm_atoi(priority_delay, "0");
     rc = stonith_api->cmds->fence_with_delay(stonith_api, options, target, type,
-                                             (int) (transition_graph->stonith_timeout / 1000),
-                                             0, crm_atoi(priority_delay, "0"));
+                                             (int) (stonith_timeout / 1000),
+                                             0, delay_i);
 
-    transition_key = pcmk__transition_key(transition_graph->id, action->id, 0,
+    transition_key = pcmk__transition_key(transition_graph->id,
+                                          action->id, 0,
                                           te_uuid),
     stonith_api->cmds->register_callback(stonith_api, rc,
-                                         (int) (transition_graph->stonith_timeout / 1000),
+                                         ((int) (stonith_timeout / 1000)
+                                          + (delay_i > 0 ? delay_i : 0)),
                                          st_opt_timeout_updates, transition_key,
-                                         "tengine_stonith_callback", tengine_stonith_callback);
+                                         "tengine_stonith_callback",
+                                         tengine_stonith_callback);
 
     return TRUE;
 }
openSUSE Build Service is sponsored by