pacemaker/007-stonith_admin.patch

109 lines
4.0 KiB
Diff
Raw Normal View History

From d6294dd28b6d95ad3844824996717f9959d97ac6 Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Thu, 30 Jun 2022 11:07:32 -0700
Subject: [PATCH 1/2] Fix: Use correct boolean in stonith__validate_agent_xml
This fixes a regression introduced by 91a2b2e that flips the boolean
values for "valid" in the XML output.
Resolves: RHBZ#2102292 (partial)
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
lib/fencing/st_output.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
index e0ff848c2..eb10ad0c5 100644
--- a/lib/fencing/st_output.c
+++ b/lib/fencing/st_output.c
@@ -528,10 +528,9 @@ validate_agent_xml(pcmk__output_t *out, va_list args) {
char *error_output = va_arg(args, char *);
int rc = va_arg(args, int);
- xmlNodePtr node = pcmk__output_create_xml_node(out, "validate",
- "agent", agent,
- "valid", pcmk__btoa(rc),
- NULL);
+ xmlNodePtr node = pcmk__output_create_xml_node(
+ out, "validate", "agent", agent, "valid", pcmk__btoa(rc == pcmk_ok),
+ NULL);
if (device != NULL) {
crm_xml_add(node, "device", device);
--
2.31.1
From 81e83683e69b4f147f40f5353f8e68032758a104 Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Wed, 29 Jun 2022 18:15:33 -0700
Subject: [PATCH 2/2] Fix: Use failed action result in rhcs_validate and
_get_metadata
If an action failed but has a non-NULL result, get the rc and other
attributes from that result.
This fixes a regression introduced by b441925, in which failure XML
output now contains a CRM_EX_CONNECTED rc instead of the correct one and
does not contain stdout/stderr. That commit caused
services__execute_file() to return a proper rc instead of TRUE. A
non-pcmk_ok bubbled up the call chain causing
internal_stonith_action_execute() to return -ECONNABORTED. Then
rhcs_validate() and _get_metadata() would use this rc instead of the one
attached to the result.
Resolves: RHBZ#2102292
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
lib/fencing/st_rhcs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/fencing/st_rhcs.c b/lib/fencing/st_rhcs.c
index 39485013e..029c97eea 100644
--- a/lib/fencing/st_rhcs.c
+++ b/lib/fencing/st_rhcs.c
@@ -130,16 +130,15 @@ stonith__rhcs_get_metadata(const char *agent, int timeout, xmlNode **metadata)
stonith_action_t *action = stonith_action_create(agent, "metadata", NULL, 0,
5, NULL, NULL, NULL);
int rc = stonith__execute(action);
+ result = stonith__action_result(action);
- if (rc < 0) {
+ if (rc < 0 && result == NULL) {
crm_warn("Could not execute metadata action for %s: %s "
CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
stonith__destroy_action(action);
return rc;
}
- result = stonith__action_result(action);
-
if (result->execution_status != PCMK_EXEC_DONE) {
crm_warn("Could not execute metadata action for %s: %s",
agent, pcmk_exec_status_str(result->execution_status));
@@ -262,6 +261,7 @@ stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
int remaining_timeout = timeout;
xmlNode *metadata = NULL;
stonith_action_t *action = NULL;
+ pcmk__action_result_t *result = NULL;
if (host_arg == NULL) {
time_t start_time = time(NULL);
@@ -298,9 +298,9 @@ stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
NULL, host_arg);
rc = stonith__execute(action);
- if (rc == pcmk_ok) {
- pcmk__action_result_t *result = stonith__action_result(action);
+ result = stonith__action_result(action);
+ if (result != NULL) {
rc = pcmk_rc2legacy(stonith__result2rc(result));
// Take ownership of output so stonith__destroy_action() doesn't free it
--
2.31.1