Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Step:15
pacemaker.19404
bsc#1171372-0006-Fix-fencer-add-port-or-plug-pa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1171372-0006-Fix-fencer-add-port-or-plug-parameter-according-to-m.patch of Package pacemaker.19404
From 187683a8c831dc2836d5064660f244528e2c5169 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Thu, 30 Apr 2020 22:25:01 +0200 Subject: [PATCH 6/6] Fix: fencer: add `port` or `plug` parameter according to metadata for RHCS-style fence-agents According to: https://github.com/ClusterLabs/fence-agents/commit/de490e059 , `port` parameter is massively deprecated in favor of `plug`: ``` <parameter name="plug" ... obsoletes="port">... <parameter name="port" ... deprecated="1">... ``` With this commit, according to the metadata, if `port` parameter is not supported, `plug` parameter is added if supported. By default, `port` is added. --- fencing/commands.c | 12 +++++++++++- include/crm/fencing/internal.h | 4 +++- lib/fencing/st_client.c | 20 +++++++++++++++----- lib/fencing/st_client.c | 4 ++-- 4 files changed, 31 insertions(+), 9 deletions(-) Index: pacemaker-1.1.18+20180430.b12c320f5/fencing/commands.c =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/fencing/commands.c +++ pacemaker-1.1.18+20180430.b12c320f5/fencing/commands.c @@ -308,6 +308,7 @@ stonith_device_execute(stonith_device_t { int exec_rc = 0; const char *action_str = NULL; + const char *host_arg = NULL; async_command_t *cmd = NULL; stonith_action_t *action = NULL; int active_cmds = 0; @@ -390,11 +391,19 @@ stonith_device_execute(stonith_device_t action_str = "off"; } + if (is_set(device->flags, st_device_supports_parameter_port)) { + host_arg = "port"; + + } else if (is_set(device->flags, st_device_supports_parameter_plug)) { + host_arg = "plug"; + } + action = stonith_action_create(device->agent, action_str, cmd->victim, cmd->victim_nodeid, - cmd->timeout, device->params, device->aliases); + cmd->timeout, device->params, + device->aliases, host_arg); /* for async exec, exec_rc is pid if positive and error code if negative/zero */ exec_rc = stonith_action_execute_async(action, (void *)cmd, cmd->done_cb); @@ -952,6 +961,7 @@ build_device_from_xml(xmlNode * msg) device->agent_metadata = get_agent_metadata(device->agent); read_action_metadata(device); + set_bit(device->flags, stonith__device_parameter_flags(device->agent_metadata)); value = g_hash_table_lookup(device->params, "nodeid"); if (!value) { Index: pacemaker-1.1.18+20180430.b12c320f5/include/crm/fencing/internal.h =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/include/crm/fencing/internal.h +++ pacemaker-1.1.18+20180430.b12c320f5/include/crm/fencing/internal.h @@ -38,7 +38,9 @@ stonith_action_t *stonith_action_create( const char *victim, uint32_t victim_nodeid, int timeout, - GHashTable * device_args, GHashTable * port_map); + GHashTable * device_args, + GHashTable * port_map, + const char * host_arg); GPid stonith_action_execute_async(stonith_action_t * action, Index: pacemaker-1.1.18+20180430.b12c320f5/lib/fencing/st_client.c =================================================================== --- pacemaker-1.1.18+20180430.b12c320f5.orig/lib/fencing/st_client.c +++ pacemaker-1.1.18+20180430.b12c320f5/lib/fencing/st_client.c @@ -423,8 +423,9 @@ append_config_arg(gpointer key, gpointer } static char * -make_args(const char *agent, const char *action, const char *victim, uint32_t victim_nodeid, GHashTable * device_args, - GHashTable * port_map) +make_args(const char *agent, const char *action, const char *victim, + uint32_t victim_nodeid, GHashTable * device_args, + GHashTable * port_map, const char *host_arg) { char buffer[512]; char *arg_list = NULL; @@ -468,7 +469,14 @@ make_args(const char *agent, const char value = agent; } else if (param == NULL) { - param = "port"; + // By default, `port` is added + if (host_arg == NULL) { + param = "port"; + + } else { + param = host_arg; + } + value = g_hash_table_lookup(device_args, param); } else if (safe_str_eq(param, "none")) { @@ -571,13 +579,15 @@ stonith_action_create(const char *agent, const char *_action, const char *victim, uint32_t victim_nodeid, - int timeout, GHashTable * device_args, GHashTable * port_map) + int timeout, GHashTable * device_args, + GHashTable * port_map, const char *host_arg) { stonith_action_t *action; action = calloc(1, sizeof(stonith_action_t)); crm_debug("Initiating action %s for agent %s (target=%s)", _action, agent, victim); - action->args = make_args(agent, _action, victim, victim_nodeid, device_args, port_map); + action->args = make_args(agent, _action, victim, victim_nodeid, + device_args, port_map, host_arg); action->agent = strdup(agent); action->action = strdup(_action); if (victim) { @@ -1176,7 +1186,8 @@ stonith_api_device_metadata(stonith_t * */ if (safe_str_eq(provider, "redhat")) { - stonith_action_t *action = stonith_action_create(agent, "metadata", NULL, 0, 5, NULL, NULL); + stonith_action_t *action = stonith_action_create(agent, "metadata", NULL, 0, + 5, NULL, NULL, NULL); int exec_rc = stonith_action_execute(action, &rc, &buffer); xmlNode *xml = NULL; xmlNode *actions = NULL;
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