File jsc#ECO-1611-0006-Feature-stonith_admin-add-delay-option-to-support-en-1.1.patch of Package pacemaker.19778
From 6c3039aa71d2789b67719395e3223d56c09dd5bf Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Wed, 18 Mar 2020 15:44:24 +0100
Subject: [PATCH 06/15] Feature: stonith_admin: add --delay option to support
enforced fencing delay
It can be specified with --fence, --reboot or --unfence commands.
The default value -1 disables enforced fencing delay.
---
fencing/admin.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
Index: pacemaker-1.1.19+20181105.ccd6b5b10/fencing/admin.c
===================================================================
--- pacemaker-1.1.19+20181105.ccd6b5b10.orig/fencing/admin.c
+++ pacemaker-1.1.19+20181105.ccd6b5b10/fencing/admin.c
@@ -176,6 +176,10 @@ static struct crm_option long_options[]
"Operation timeout in seconds (default 120;\n"
"\t\t\tused with most commands)."
},
+ { "delay", required_argument, NULL, 'y',
+ "Enforced fencing delay in seconds (default -1 (disabled);\n"
+ "\t\t\twith --fence, --reboot, --unfence)."
+ },
{ "as-node-id", no_argument, NULL, 'n',
"(Advanced) The supplied node is the corosync node ID\n"
"\t\t\t(with --last)."
@@ -201,6 +205,7 @@ struct {
char *name;
int timeout;
int tolerance;
+ int delay;
int rc;
} async_fence_data;
@@ -265,11 +270,13 @@ async_fence_helper(gpointer user_data)
st->cmds->register_notification(st, T_STONITH_NOTIFY_FENCE, notify_callback);
- call_id = st->cmds->fence(st,
- st_opt_allow_suicide,
- async_fence_data.target,
- async_fence_data.action,
- async_fence_data.timeout, async_fence_data.tolerance);
+ call_id = st->cmds->fence_with_delay(st,
+ st_opt_allow_suicide,
+ async_fence_data.target,
+ async_fence_data.action,
+ async_fence_data.timeout,
+ async_fence_data.tolerance,
+ async_fence_data.delay);
if (call_id < 0) {
g_main_loop_quit(mainloop);
@@ -285,7 +292,8 @@ async_fence_helper(gpointer user_data)
}
static int
-mainloop_fencing(stonith_t * st, const char *target, const char *action, int timeout, int tolerance)
+mainloop_fencing(stonith_t * st, const char *target, const char *action,
+ int timeout, int tolerance, int delay)
{
crm_trigger_t *trig;
@@ -294,6 +302,7 @@ mainloop_fencing(stonith_t * st, const c
async_fence_data.action = action;
async_fence_data.timeout = timeout;
async_fence_data.tolerance = tolerance;
+ async_fence_data.delay = delay;
async_fence_data.rc = -1;
trig = mainloop_add_trigger(G_PRIORITY_HIGH, async_fence_helper, NULL);
@@ -464,6 +473,7 @@ main(int argc, char **argv)
int verbose = 0;
int argerr = 0;
int timeout = 120;
+ int delay = -1;
int option_index = 0;
int fence_level = 0;
int no_connect = 0;
@@ -546,6 +556,9 @@ main(int argc, char **argv)
case 't':
timeout = crm_atoi(optarg, NULL);
break;
+ case 'y':
+ delay = crm_atoi(optarg, NULL);
+ break;
case 'B':
case 'F':
case 'U':
@@ -732,13 +745,13 @@ main(int argc, char **argv)
rc = st->cmds->confirm(st, st_opts, target);
break;
case 'B':
- rc = mainloop_fencing(st, target, "reboot", timeout, tolerance);
+ rc = mainloop_fencing(st, target, "reboot", timeout, tolerance, delay);
break;
case 'F':
- rc = mainloop_fencing(st, target, "off", timeout, tolerance);
+ rc = mainloop_fencing(st, target, "off", timeout, tolerance, delay);
break;
case 'U':
- rc = mainloop_fencing(st, target, "on", timeout, tolerance);
+ rc = mainloop_fencing(st, target, "on", timeout, tolerance, delay);
break;
case 'h':
{