File bsc#1210074-0003-Fix-fencer-per-operation-fencing-timeout-takes-any-r.patch of Package pacemaker.36842

From 86de9621e22be1ce1a01eca1ce0b4e437766c18c Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Wed, 12 Apr 2023 11:12:34 +0200
Subject: [PATCH 03/11] Fix: fencer: per-operation fencing timeout takes any
 requested fencing delay into account

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

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

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
@@ -1824,7 +1824,11 @@ request_peer_fencing(remote_fencing_op_t
     }
 
     if (peer) {
-        int timeout_one = 0;
+       /* Take any requested fencing delay into account to prevent it from eating
+        * up the timeout.
+        */
+        int timeout_one = (op->delay > 0 ?
+                           TIMEOUT_MULTIPLY_FACTOR * op->delay : 0);
         xmlNode *remote_op = stonith_create_op(op->client_callid, op->id, STONITH_OP_FENCE, NULL, 0);
 
         crm_xml_add(remote_op, F_STONITH_REMOTE_OP_ID, op->id);
@@ -1838,8 +1842,8 @@ request_peer_fencing(remote_fencing_op_t
         crm_xml_add_int(remote_op, F_STONITH_DELAY, op->delay);
 
         if (device) {
-            timeout_one = TIMEOUT_MULTIPLY_FACTOR *
-                          get_device_timeout(op, peer, device);
+            timeout_one += TIMEOUT_MULTIPLY_FACTOR *
+                           get_device_timeout(op, peer, device);
             crm_notice("Requesting that %s perform '%s' action targeting %s "
                        "using %s " CRM_XS " for client %s (%ds)",
                        peer->host, op->action, op->target, device,
@@ -1847,7 +1851,7 @@ request_peer_fencing(remote_fencing_op_t
             crm_xml_add(remote_op, F_STONITH_DEVICE, device);
 
         } else {
-            timeout_one = TIMEOUT_MULTIPLY_FACTOR * get_peer_timeout(op, peer);
+            timeout_one += TIMEOUT_MULTIPLY_FACTOR * get_peer_timeout(op, peer);
             crm_notice("Requesting that %s perform '%s' action targeting %s "
                        CRM_XS " for client %s (%ds, %lds)",
                        peer->host, op->action, op->target, op->client_name,
openSUSE Build Service is sponsored by