Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
pacemaker
bsc#1148236-0001-Low-fencer-improve-error-check...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1148236-0001-Low-fencer-improve-error-checking-and-log-messages-f.patch of Package pacemaker
From 652f582112b62489af9e865c14f11e9183e8cd12 Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Thu, 21 Feb 2019 15:08:05 -0600 Subject: [PATCH 1/2] Low: fencer: improve error checking and log messages for API action requests --- daemons/fenced/fenced_commands.c | 54 +++++++++++++++++++------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c index 54575f932..3fb55bf19 100644 --- a/daemons/fenced/fenced_commands.c +++ b/daemons/fenced/fenced_commands.c @@ -1445,38 +1445,50 @@ stonith_level_remove(xmlNode *msg, char **desc) return pcmk_ok; } +/*! + * \internal + * \brief Schedule an (asynchronous) action directly on a stonith device + * + * Handle a STONITH_OP_EXEC API message by scheduling a requested agent action + * directly on a specified device. Only list, monitor, and status actions are + * expected to use this call, though it should work with any agent command. + * + * \param[in] msg API message XML with desired action + * \param[out] output Unused + * + * \return -EINPROGRESS on success, -errno otherwise + */ static int stonith_device_action(xmlNode * msg, char **output) { - int rc = pcmk_ok; xmlNode *dev = get_xpath_object("//" F_STONITH_DEVICE, msg, LOG_ERR); + xmlNode *op = get_xpath_object("//@" F_STONITH_ACTION, msg, LOG_ERR); const char *id = crm_element_value(dev, F_STONITH_DEVICE); - + const char *action = crm_element_value(op, F_STONITH_ACTION); async_command_t *cmd = NULL; stonith_device_t *device = NULL; - if (id) { - crm_trace("Looking for '%s'", id); - device = g_hash_table_lookup(device_list, id); + if ((id == NULL) || (action == NULL)) { + crm_info("Malformed API action request: device %s, action %s", + (id? id : "not specified"), + (action? action : "not specified")); + return -EPROTO; } - if (device && device->api_registered == FALSE) { - rc = -ENODEV; - - } else if (device) { - cmd = create_async_command(msg); - if (cmd == NULL) { - return -EPROTO; - } - - schedule_stonith_command(cmd, device); - rc = -EINPROGRESS; + device = g_hash_table_lookup(device_list, id); + if ((device == NULL) || !device->api_registered) { + crm_info("Ignoring API %s action request because device %s not found", + action, id); + return -ENODEV; + } - } else { - crm_info("Device %s not found", id ? id : "<none>"); - rc = -ENODEV; + cmd = create_async_command(msg); + if (cmd == NULL) { + return -EPROTO; } - return rc; + + schedule_stonith_command(cmd, device); + return -EINPROGRESS; } static void @@ -2071,7 +2083,7 @@ st_child_done(GPid pid, int rc, const char *output, gpointer user_data) /* The device is ready to do something else now */ device = g_hash_table_lookup(device_list, cmd->device); if (device) { - if (rc == pcmk_ok && + if (!device->verified && (rc == pcmk_ok) && (safe_str_eq(cmd->action, "list") || safe_str_eq(cmd->action, "monitor") || safe_str_eq(cmd->action, "status"))) { -- 2.26.2
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