Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
pacemaker.15718
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.15718
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. --- daemons/fenced/fenced_commands.c | 12 +++++++++++- include/crm/fencing/internal.h | 4 +++- lib/fencing/st_client.c | 20 +++++++++++++++----- lib/fencing/st_rhcs.c | 4 ++-- 4 files changed, 31 insertions(+), 9 deletions(-) Index: pacemaker-2.0.1+20190417.13d370ca9/daemons/fenced/fenced_commands.c =================================================================== --- pacemaker-2.0.1+20190417.13d370ca9.orig/daemons/fenced/fenced_commands.c +++ pacemaker-2.0.1+20190417.13d370ca9/daemons/fenced/fenced_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); @@ -958,6 +967,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-2.0.1+20190417.13d370ca9/include/crm/fencing/internal.h =================================================================== --- pacemaker-2.0.1+20190417.13d370ca9.orig/include/crm/fencing/internal.h +++ pacemaker-2.0.1+20190417.13d370ca9/include/crm/fencing/internal.h @@ -30,7 +30,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); void stonith__destroy_action(stonith_action_t *action); void stonith__action_result(stonith_action_t *action, int *rc, char **output, char **error_output); Index: pacemaker-2.0.1+20190417.13d370ca9/lib/fencing/st_client.c =================================================================== --- pacemaker-2.0.1+20190417.13d370ca9.orig/lib/fencing/st_client.c +++ pacemaker-2.0.1+20190417.13d370ca9/lib/fencing/st_client.c @@ -477,8 +477,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; @@ -522,7 +523,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")) { @@ -673,12 +681,14 @@ 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)); - 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); crm_debug("Preparing '%s' action for %s using agent %s", _action, (victim? victim : "no target"), agent); action->agent = strdup(agent); Index: pacemaker-2.0.1+20190417.13d370ca9/lib/fencing/st_rhcs.c =================================================================== --- pacemaker-2.0.1+20190417.13d370ca9.orig/lib/fencing/st_rhcs.c +++ pacemaker-2.0.1+20190417.13d370ca9/lib/fencing/st_rhcs.c @@ -122,7 +122,7 @@ stonith__rhcs_metadata(const char *agent xmlNode *actions = NULL; xmlXPathObject *xpathObj = NULL; stonith_action_t *action = stonith_action_create(agent, "metadata", NULL, 0, - 5, NULL, NULL); + 5, NULL, NULL, NULL); int rc = stonith__execute(action); if (rc < 0) { @@ -212,7 +212,7 @@ stonith__rhcs_validate(stonith_t *st, in int rc = pcmk_ok; stonith_action_t *action = stonith_action_create(agent, "validate-all", target, 0, timeout, params, - NULL); + NULL, NULL); rc = stonith__execute(action); if (rc == pcmk_ok) {
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