Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
pacemaker.13252
jsc#ECO-1611-0004-Feature-libstonithd-introduce...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File jsc#ECO-1611-0004-Feature-libstonithd-introduce-fence_with_delay-opera-1.1.patch of Package pacemaker.13252
From 47cfa3890dcdf56dac14e5505da55124bafa8757 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Wed, 18 Mar 2020 15:33:23 +0100 Subject: [PATCH 04/15] Feature: libstonithd: introduce fence_with_delay() operation A parameter value -1 disables enforced fencing delay. Operation fence() is now a wrapper for fence_with_delay(). --- include/crm/fencing/internal.h | 1 + include/crm/stonith-ng.h | 19 +++++++++++++++++++ lib/fencing/st_client.c | 25 +++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h index 24df23013..264e0d187 100644 --- a/include/crm/fencing/internal.h +++ b/include/crm/fencing/internal.h @@ -57,6 +57,7 @@ xmlNode *create_device_registration_xml(const char *id, /*! Timeout period per a device execution */ # define F_STONITH_TIMEOUT "st_timeout" # define F_STONITH_TOLERANCE "st_tolerance" +# define F_STONITH_DELAY "st_delay" /*! Action specific timeout period returned in query of fencing devices. */ # define F_STONITH_ACTION_TIMEOUT "st_action_timeout" /*! Host in query result is not allowed to run this action */ diff --git a/include/crm/stonith-ng.h b/include/crm/stonith-ng.h index 23f879b80..02b751d66 100644 --- a/include/crm/stonith-ng.h +++ b/include/crm/stonith-ng.h @@ -404,6 +404,25 @@ typedef struct stonith_api_operations_s stonith_key_value_t *params, int timeout, char **output, char **error_output); + /*! + * \brief Issue a fencing action against a node with enforced fencing delay. + * + * \note Possible actions are, 'on', 'off', and 'reboot'. + * + * \param st, stonith connection + * \param options, call options + * \param node, The target node to fence + * \param action, The fencing action to take + * \param timeout, The default per device timeout to use with each device + * capable of fencing the target. + * \param delay, Any enforced fencing delay. -1 to disable + * + * \retval 0 success + * \retval negative error code on failure. + */ + int (*fence_with_delay)(stonith_t *st, int options, const char *node, const char *action, + int timeout, int tolerance, int delay); + } stonith_api_operations_t; struct stonith_s diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c index 4a1310f83..e45158204 100644 --- a/lib/fencing/st_client.c +++ b/lib/fencing/st_client.c @@ -1178,8 +1178,8 @@ stonith_api_status(stonith_t * stonith, int call_options, const char *id, const } static int -stonith_api_fence(stonith_t * stonith, int call_options, const char *node, const char *action, - int timeout, int tolerance) +stonith_api_fence_with_delay(stonith_t * stonith, int call_options, const char *node, + const char *action, int timeout, int tolerance, int delay) { int rc = 0; xmlNode *data = NULL; @@ -1190,12 +1190,24 @@ stonith_api_fence(stonith_t * stonith, int call_options, const char *node, const crm_xml_add_int(data, F_STONITH_TIMEOUT, timeout); crm_xml_add_int(data, F_STONITH_TOLERANCE, tolerance); + if (delay >= 0) { + crm_xml_add_int(data, F_STONITH_DELAY, delay); + } + rc = stonith_send_command(stonith, STONITH_OP_FENCE, data, NULL, call_options, timeout); free_xml(data); return rc; } +static int +stonith_api_fence(stonith_t * stonith, int call_options, const char *node, const char *action, + int timeout, int tolerance) +{ + return stonith_api_fence_with_delay(stonith, call_options, node, action, + timeout, tolerance, -1); +} + static int stonith_api_confirm(stonith_t * stonith, int call_options, const char *target) { @@ -1924,6 +1936,14 @@ stonith_send_command(stonith_t * stonith, const char *op, xmlNode * data, xmlNod crm_xml_add_int(op_msg, F_STONITH_TIMEOUT, timeout); crm_trace("Sending %s message to STONITH service, Timeout: %ds", op, timeout); + if (data) { + const char *delay_s = crm_element_value(data, F_STONITH_DELAY); + + if (delay_s) { + crm_xml_add(op_msg, F_STONITH_DELAY, delay_s); + } + } + rc = crm_ipc_send(native->ipc, op_msg, ipc_flags, 1000 * (timeout + 60), &op_reply); free_xml(op_msg); @@ -2203,6 +2223,7 @@ stonith_api_new(void) new_stonith->cmds->monitor = stonith_api_monitor; new_stonith->cmds->status = stonith_api_status; new_stonith->cmds->fence = stonith_api_fence; + new_stonith->cmds->fence_with_delay = stonith_api_fence_with_delay; new_stonith->cmds->confirm = stonith_api_confirm; new_stonith->cmds->history = stonith_api_history; -- 2.26.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor