File bsc#1210074-0002-Fix-fencer-total-fencing-timeout-takes-any-requested.patch of Package pacemaker.29727

From cdbfab0858f980fc782c892d4390efb30c2bc93c Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Wed, 12 Apr 2023 10:12:35 +0200
Subject: [PATCH 02/11] Fix: fencer: total fencing timeout takes any requested
 fencing delay into account

... to prevent it from eating up the total timeout.

Fixes T93
Fixes CLBZ#5493
---
 cts/cts-fencing.in             | 2 +-
 daemons/fenced/fenced_remote.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Index: pacemaker-2.1.5+20221208.a3f44794f/cts/cts-fencing.in
===================================================================
--- pacemaker-2.1.5+20221208.a3f44794f.orig/cts/cts-fencing.in
+++ pacemaker-2.1.5+20221208.a3f44794f/cts/cts-fencing.in
@@ -1225,7 +1225,7 @@ class Tests(object):
             test.add_cmd("stonith_admin", "--output-as=xml -F node3 --delay 1")
 
             # Total fencing timeout takes all fencing delays into account.
-            test.add_stonith_log_pattern("Total timeout set to 576")
+            test.add_stonith_log_pattern("Total timeout set to 577")
 
             # Fencing timeout for the first device takes the requested fencing delay into account.
             # Fencing timeout also takes pcmk_delay_base into account.
Index: pacemaker-2.1.5+20221208.a3f44794f/daemons/fenced/fenced_remote.c
===================================================================
--- pacemaker-2.1.5+20221208.a3f44794f.orig/daemons/fenced/fenced_remote.c
+++ pacemaker-2.1.5+20221208.a3f44794f/daemons/fenced/fenced_remote.c
@@ -1600,7 +1600,11 @@ get_op_total_timeout(const remote_fencin
         total_timeout = op->base_timeout;
     }
 
-    return total_timeout ? total_timeout : op->base_timeout;
+    /* Take any requested fencing delay into account to prevent it from eating
+     * up the total timeout.
+     */
+    return ((total_timeout ? total_timeout : op->base_timeout)
+            + (op->delay > 0 ? op->delay : 0));
 }
 
 static void
openSUSE Build Service is sponsored by