Blame SOURCES/007-stonith_admin.patch

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