|
|
533c21 |
From 9ee3d6c9b0aba6aae022cc152a3b3472fe388fa3 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 16:44:32 -0600
|
|
|
533c21 |
Subject: [PATCH 01/15] Refactor: fencer: add exit reason to fencing operation
|
|
|
533c21 |
object
|
|
|
533c21 |
|
|
|
533c21 |
In order to pass a fencing action's exit reason with the action history,
|
|
|
533c21 |
we need the exit reason in remote_fencing_op_t. Nothing sets or uses it as of
|
|
|
533c21 |
this commit.
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 2 ++
|
|
|
533c21 |
daemons/fenced/pacemaker-fenced.h | 4 +++-
|
|
|
533c21 |
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 6eebb7381e..0fa9706140 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -260,6 +260,8 @@ free_remote_op(gpointer data)
|
|
|
533c21 |
}
|
|
|
533c21 |
g_list_free_full(op->automatic_list, free);
|
|
|
533c21 |
g_list_free(op->duplicates);
|
|
|
533c21 |
+
|
|
|
533c21 |
+ pcmk__reset_result(&op->result);
|
|
|
533c21 |
free(op);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/pacemaker-fenced.h b/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
index 502fcc9a29..1a5c933ea7 100644
|
|
|
533c21 |
--- a/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
+++ b/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2009-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2009-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* This source code is licensed under the GNU General Public License version 2
|
|
|
533c21 |
* or later (GPLv2+) WITHOUT ANY WARRANTY.
|
|
|
533c21 |
@@ -151,6 +151,8 @@ typedef struct remote_fencing_op_s {
|
|
|
533c21 |
/*! The point at which the remote operation completed(nsec) */
|
|
|
533c21 |
long long completed_nsec;
|
|
|
533c21 |
|
|
|
533c21 |
+ /*! The (potentially intermediate) result of the operation */
|
|
|
533c21 |
+ pcmk__action_result_t result;
|
|
|
533c21 |
} remote_fencing_op_t;
|
|
|
533c21 |
|
|
|
533c21 |
void fenced_broadcast_op_result(remote_fencing_op_t *op,
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 97a2c318866adc5ef5e426c5c3b753df1fa3ab66 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:08:42 -0600
|
|
|
533c21 |
Subject: [PATCH 02/15] Refactor: fencer: track full result in
|
|
|
533c21 |
remote_fencing_op_t
|
|
|
533c21 |
|
|
|
533c21 |
Now that remote_fencing_op_t has a place for the full result,
|
|
|
533c21 |
set it before calling finalize_op(), instead of passing a separate result
|
|
|
533c21 |
object to finalize_op().
|
|
|
533c21 |
|
|
|
533c21 |
As a bonus, this simplifies the memory management, reducing the chance of
|
|
|
533c21 |
mistakes.
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 161 ++++++++++++++++-----------------
|
|
|
533c21 |
1 file changed, 77 insertions(+), 84 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 0fa9706140..30edbff890 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -82,8 +82,7 @@ extern xmlNode *stonith_create_op(int call_id, const char *token, const char *op
|
|
|
533c21 |
static void request_peer_fencing(remote_fencing_op_t *op,
|
|
|
533c21 |
peer_device_info_t *peer,
|
|
|
533c21 |
pcmk__action_result_t *result);
|
|
|
533c21 |
-static void finalize_op(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
- pcmk__action_result_t *result, bool dup);
|
|
|
533c21 |
+static void finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup);
|
|
|
533c21 |
static void report_timeout_period(remote_fencing_op_t * op, int op_timeout);
|
|
|
533c21 |
static int get_op_total_timeout(const remote_fencing_op_t *op,
|
|
|
533c21 |
const peer_device_info_t *chosen_peer);
|
|
|
533c21 |
@@ -485,7 +484,9 @@ finalize_op_duplicates(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
other->client_name, other->originator,
|
|
|
533c21 |
pcmk_exec_status_str(result->execution_status),
|
|
|
533c21 |
other->id);
|
|
|
533c21 |
- finalize_op(other, data, result, true);
|
|
|
533c21 |
+ pcmk__set_result(&other->result, result->exit_status,
|
|
|
533c21 |
+ result->execution_status, result->exit_reason);
|
|
|
533c21 |
+ finalize_op(other, data, true);
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
// Possible if (for example) it timed out already
|
|
|
533c21 |
@@ -520,20 +521,20 @@ delegate_from_xml(xmlNode *xml)
|
|
|
533c21 |
*
|
|
|
533c21 |
* \param[in] op Fencer operation that completed
|
|
|
533c21 |
* \param[in] data If not NULL, XML reply of last delegated fencing operation
|
|
|
533c21 |
- * \param[in] result Full operation result
|
|
|
533c21 |
* \param[in] dup Whether this operation is a duplicate of another
|
|
|
533c21 |
* (in which case, do not broadcast the result)
|
|
|
533c21 |
+ *
|
|
|
533c21 |
+ * \note The operation result should be set before calling this function.
|
|
|
533c21 |
*/
|
|
|
533c21 |
static void
|
|
|
533c21 |
-finalize_op(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
- pcmk__action_result_t *result, bool dup)
|
|
|
533c21 |
+finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup)
|
|
|
533c21 |
{
|
|
|
533c21 |
int level = LOG_ERR;
|
|
|
533c21 |
const char *subt = NULL;
|
|
|
533c21 |
xmlNode *local_data = NULL;
|
|
|
533c21 |
gboolean op_merged = FALSE;
|
|
|
533c21 |
|
|
|
533c21 |
- CRM_CHECK((op != NULL) && (result != NULL), return);
|
|
|
533c21 |
+ CRM_CHECK((op != NULL), return);
|
|
|
533c21 |
|
|
|
533c21 |
if (op->notify_sent) {
|
|
|
533c21 |
// Most likely, this is a timed-out action that eventually completed
|
|
|
533c21 |
@@ -557,11 +558,11 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
local_data = data;
|
|
|
533c21 |
|
|
|
533c21 |
} else if (op->delegate == NULL) {
|
|
|
533c21 |
- switch (result->execution_status) {
|
|
|
533c21 |
+ switch (op->result.execution_status) {
|
|
|
533c21 |
case PCMK_EXEC_NO_FENCE_DEVICE:
|
|
|
533c21 |
break;
|
|
|
533c21 |
case PCMK_EXEC_INVALID:
|
|
|
533c21 |
- if (result->exit_status == CRM_EX_EXPIRED) {
|
|
|
533c21 |
+ if (op->result.exit_status == CRM_EX_EXPIRED) {
|
|
|
533c21 |
break;
|
|
|
533c21 |
}
|
|
|
533c21 |
// else fall through
|
|
|
533c21 |
@@ -581,12 +582,12 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
subt = crm_element_value(data, F_SUBTYPE);
|
|
|
533c21 |
if (!dup && !pcmk__str_eq(subt, "broadcast", pcmk__str_casei)) {
|
|
|
533c21 |
/* Defer notification until the bcast message arrives */
|
|
|
533c21 |
- fenced_broadcast_op_result(op, result, op_merged);
|
|
|
533c21 |
+ fenced_broadcast_op_result(op, &op->result, op_merged);
|
|
|
533c21 |
free_xml(local_data);
|
|
|
533c21 |
return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- if (pcmk__result_ok(result) || dup
|
|
|
533c21 |
+ if (pcmk__result_ok(&op->result) || dup
|
|
|
533c21 |
|| !pcmk__str_eq(op->originator, stonith_our_uname, pcmk__str_casei)) {
|
|
|
533c21 |
level = LOG_NOTICE;
|
|
|
533c21 |
}
|
|
|
533c21 |
@@ -595,16 +596,17 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
(op->target? op->target : ""),
|
|
|
533c21 |
(op->delegate? op->delegate : "unknown node"),
|
|
|
533c21 |
op->client_name, op->originator,
|
|
|
533c21 |
- (op_merged? " (merged)" : ""), crm_exit_str(result->exit_status),
|
|
|
533c21 |
- pcmk_exec_status_str(result->execution_status),
|
|
|
533c21 |
- ((result->exit_reason == NULL)? "" : ": "),
|
|
|
533c21 |
- ((result->exit_reason == NULL)? "" : result->exit_reason),
|
|
|
533c21 |
+ (op_merged? " (merged)" : ""),
|
|
|
533c21 |
+ crm_exit_str(op->result.exit_status),
|
|
|
533c21 |
+ pcmk_exec_status_str(op->result.execution_status),
|
|
|
533c21 |
+ ((op->result.exit_reason == NULL)? "" : ": "),
|
|
|
533c21 |
+ ((op->result.exit_reason == NULL)? "" : op->result.exit_reason),
|
|
|
533c21 |
op->id);
|
|
|
533c21 |
|
|
|
533c21 |
- handle_local_reply_and_notify(op, data, result);
|
|
|
533c21 |
+ handle_local_reply_and_notify(op, data, &op->result);
|
|
|
533c21 |
|
|
|
533c21 |
if (!dup) {
|
|
|
533c21 |
- finalize_op_duplicates(op, data, result);
|
|
|
533c21 |
+ finalize_op_duplicates(op, data, &op->result);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
/* Free non-essential parts of the record
|
|
|
533c21 |
@@ -634,7 +636,6 @@ static gboolean
|
|
|
533c21 |
remote_op_watchdog_done(gpointer userdata)
|
|
|
533c21 |
{
|
|
|
533c21 |
remote_fencing_op_t *op = userdata;
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
|
|
|
533c21 |
op->op_timer_one = 0;
|
|
|
533c21 |
|
|
|
533c21 |
@@ -642,8 +643,8 @@ remote_op_watchdog_done(gpointer userdata)
|
|
|
533c21 |
CRM_XS " id=%.8s",
|
|
|
533c21 |
op->action, op->target, op->client_name, op->id);
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
- finalize_op(op, NULL, &result, false);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ finalize_op(op, NULL, false);
|
|
|
533c21 |
return G_SOURCE_REMOVE;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
@@ -676,8 +677,6 @@ remote_op_timeout_one(gpointer userdata)
|
|
|
533c21 |
static void
|
|
|
533c21 |
finalize_timed_out_op(remote_fencing_op_t *op, const char *reason)
|
|
|
533c21 |
{
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
op->op_timer_total = 0;
|
|
|
533c21 |
|
|
|
533c21 |
crm_debug("Action '%s' targeting %s for client %s timed out "
|
|
|
533c21 |
@@ -690,13 +689,12 @@ finalize_timed_out_op(remote_fencing_op_t *op, const char *reason)
|
|
|
533c21 |
* devices, and return success.
|
|
|
533c21 |
*/
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
} else {
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_ERROR, PCMK_EXEC_TIMEOUT, reason);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_ERROR, PCMK_EXEC_TIMEOUT, reason);
|
|
|
533c21 |
}
|
|
|
533c21 |
- finalize_op(op, NULL, &result, false);
|
|
|
533c21 |
- pcmk__reset_result(&result);
|
|
|
533c21 |
+ finalize_op(op, NULL, false);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
/*!
|
|
|
533c21 |
@@ -1094,13 +1092,9 @@ fenced_handle_manual_confirmation(pcmk__client_t *client, xmlNode *msg)
|
|
|
533c21 |
set_fencing_completed(op);
|
|
|
533c21 |
op->delegate = strdup("a human");
|
|
|
533c21 |
|
|
|
533c21 |
- {
|
|
|
533c21 |
- // For the fencer's purposes, the fencing operation is done
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- }
|
|
|
533c21 |
+ // For the fencer's purposes, the fencing operation is done
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
|
|
|
533c21 |
/* For the requester's purposes, the operation is still pending. The
|
|
|
533c21 |
* actual result will be sent asynchronously via the operation's done_cb().
|
|
|
533c21 |
@@ -1279,16 +1273,11 @@ initiate_remote_stonith_op(pcmk__client_t *client, xmlNode *request,
|
|
|
533c21 |
switch (op->state) {
|
|
|
533c21 |
case st_failed:
|
|
|
533c21 |
// advance_topology_level() exhausted levels
|
|
|
533c21 |
- {
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_ERROR, PCMK_EXEC_ERROR,
|
|
|
533c21 |
- "All topology levels failed");
|
|
|
533c21 |
- crm_warn("Could not request peer fencing (%s) targeting %s "
|
|
|
533c21 |
- CRM_XS " id=%.8s", op->action, op->target, op->id);
|
|
|
533c21 |
- finalize_op(op, NULL, &result, false);
|
|
|
533c21 |
- pcmk__reset_result(&result);
|
|
|
533c21 |
- }
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_ERROR, PCMK_EXEC_ERROR,
|
|
|
533c21 |
+ "All topology levels failed");
|
|
|
533c21 |
+ crm_warn("Could not request peer fencing (%s) targeting %s "
|
|
|
533c21 |
+ CRM_XS " id=%.8s", op->action, op->target, op->id);
|
|
|
533c21 |
+ finalize_op(op, NULL, false);
|
|
|
533c21 |
return op;
|
|
|
533c21 |
|
|
|
533c21 |
case st_duplicate:
|
|
|
533c21 |
@@ -1613,10 +1602,6 @@ static void
|
|
|
533c21 |
advance_topology_device_in_level(remote_fencing_op_t *op, const char *device,
|
|
|
533c21 |
xmlNode *msg)
|
|
|
533c21 |
{
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
-
|
|
|
533c21 |
/* Advance to the next device at this topology level, if any */
|
|
|
533c21 |
if (op->devices) {
|
|
|
533c21 |
op->devices = op->devices->next;
|
|
|
533c21 |
@@ -1644,6 +1629,10 @@ advance_topology_device_in_level(remote_fencing_op_t *op, const char *device,
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
if (op->devices) {
|
|
|
533c21 |
+ pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
+
|
|
|
533c21 |
+ pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+
|
|
|
533c21 |
/* Necessary devices remain, so execute the next one */
|
|
|
533c21 |
crm_trace("Next targeting %s on behalf of %s@%s",
|
|
|
533c21 |
op->target, op->client_name, op->originator);
|
|
|
533c21 |
@@ -1659,7 +1648,8 @@ advance_topology_device_in_level(remote_fencing_op_t *op, const char *device,
|
|
|
533c21 |
crm_trace("Marking complex fencing op targeting %s as complete",
|
|
|
533c21 |
op->target);
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
@@ -1868,7 +1858,9 @@ request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer,
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
- finalize_op(op, NULL, result, false);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, result->exit_status,
|
|
|
533c21 |
+ result->execution_status, result->exit_reason);
|
|
|
533c21 |
+ finalize_op(op, NULL, false);
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
crm_info("Waiting for additional peers capable of fencing (%s) %s%s%s "
|
|
|
533c21 |
@@ -2245,31 +2237,34 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
/* Could be for an event that began before we started */
|
|
|
533c21 |
/* TODO: Record the op for later querying */
|
|
|
533c21 |
crm_info("Received peer result of unknown or expired operation %s", id);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ pcmk__reset_result(&result);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
+ op->result = result; // The operation takes ownership of the result
|
|
|
533c21 |
+
|
|
|
533c21 |
if (op->devices && device && !pcmk__str_eq(op->devices->data, device, pcmk__str_casei)) {
|
|
|
533c21 |
crm_err("Received outdated reply for device %s (instead of %s) to "
|
|
|
533c21 |
"fence (%s) %s. Operation already timed out at peer level.",
|
|
|
533c21 |
device, (const char *) op->devices->data, op->action, op->target);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
if (pcmk__str_eq(crm_element_value(msg, F_SUBTYPE), "broadcast", pcmk__str_casei)) {
|
|
|
533c21 |
crm_debug("Finalizing action '%s' targeting %s on behalf of %s@%s: %s%s%s%s "
|
|
|
533c21 |
CRM_XS " id=%.8s",
|
|
|
533c21 |
op->action, op->target, op->client_name, op->originator,
|
|
|
533c21 |
- pcmk_exec_status_str(result.execution_status),
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : result.exit_reason,
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : ")", op->id);
|
|
|
533c21 |
- if (pcmk__result_ok(&result)) {
|
|
|
533c21 |
+ pcmk_exec_status_str(op->result.execution_status),
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : op->result.exit_reason,
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : ")", op->id);
|
|
|
533c21 |
+ if (pcmk__result_ok(&op->result)) {
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
} else {
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
}
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
|
|
|
533c21 |
} else if (!pcmk__str_eq(op->originator, stonith_our_uname, pcmk__str_casei)) {
|
|
|
533c21 |
/* If this isn't a remote level broadcast, and we are not the
|
|
|
533c21 |
@@ -2277,7 +2272,7 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
crm_err("Received non-broadcast fencing result for operation %.8s "
|
|
|
533c21 |
"we do not own (device %s targeting %s)",
|
|
|
533c21 |
op->id, device, op->target);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
if (pcmk_is_set(op->call_options, st_opt_topology)) {
|
|
|
533c21 |
@@ -2286,58 +2281,58 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
crm_notice("Action '%s' targeting %s using %s on behalf of %s@%s: %s%s%s%s",
|
|
|
533c21 |
op->action, op->target, device, op->client_name,
|
|
|
533c21 |
op->originator,
|
|
|
533c21 |
- pcmk_exec_status_str(result.execution_status),
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : result.exit_reason,
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : ")");
|
|
|
533c21 |
+ pcmk_exec_status_str(op->result.execution_status),
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : op->result.exit_reason,
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : ")");
|
|
|
533c21 |
|
|
|
533c21 |
/* We own the op, and it is complete. broadcast the result to all nodes
|
|
|
533c21 |
* and notify our local clients. */
|
|
|
533c21 |
if (op->state == st_done) {
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- if ((op->phase == 2) && !pcmk__result_ok(&result)) {
|
|
|
533c21 |
+ if ((op->phase == 2) && !pcmk__result_ok(&op->result)) {
|
|
|
533c21 |
/* A remapped "on" failed, but the node was already turned off
|
|
|
533c21 |
* successfully, so ignore the error and continue.
|
|
|
533c21 |
*/
|
|
|
533c21 |
crm_warn("Ignoring %s 'on' failure (%s%s%s) targeting %s "
|
|
|
533c21 |
"after successful 'off'",
|
|
|
533c21 |
- device, pcmk_exec_status_str(result.execution_status),
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : ": ",
|
|
|
533c21 |
- (result.exit_reason == NULL)? "" : result.exit_reason,
|
|
|
533c21 |
+ device, pcmk_exec_status_str(op->result.execution_status),
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : ": ",
|
|
|
533c21 |
+ (op->result.exit_reason == NULL)? "" : op->result.exit_reason,
|
|
|
533c21 |
op->target);
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- if (pcmk__result_ok(&result)) {
|
|
|
533c21 |
+ if (pcmk__result_ok(&op->result)) {
|
|
|
533c21 |
/* An operation completed successfully. Try another device if
|
|
|
533c21 |
* necessary, otherwise mark the operation as done. */
|
|
|
533c21 |
advance_topology_device_in_level(op, device, msg);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
} else {
|
|
|
533c21 |
/* This device failed, time to try another topology level. If no other
|
|
|
533c21 |
* levels are available, mark this operation as failed and report results. */
|
|
|
533c21 |
if (advance_topology_level(op, false) != pcmk_rc_ok) {
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- } else if (pcmk__result_ok(&result) && (op->devices == NULL)) {
|
|
|
533c21 |
+ } else if (pcmk__result_ok(&op->result) && (op->devices == NULL)) {
|
|
|
533c21 |
crm_trace("All done for %s", op->target);
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
|
|
|
533c21 |
- } else if ((result.execution_status == PCMK_EXEC_TIMEOUT)
|
|
|
533c21 |
+ } else if ((op->result.execution_status == PCMK_EXEC_TIMEOUT)
|
|
|
533c21 |
&& (op->devices == NULL)) {
|
|
|
533c21 |
/* If the operation timed out don't bother retrying other peers. */
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
- finalize_op(op, msg, &result, false);
|
|
|
533c21 |
- goto done;
|
|
|
533c21 |
+ finalize_op(op, msg, false);
|
|
|
533c21 |
+ return;
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
/* fall-through and attempt other fencing action using another peer */
|
|
|
533c21 |
@@ -2346,10 +2341,8 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
/* Retry on failure */
|
|
|
533c21 |
crm_trace("Next for %s on behalf of %s@%s (result was: %s)",
|
|
|
533c21 |
op->target, op->originator, op->client_name,
|
|
|
533c21 |
- pcmk_exec_status_str(result.execution_status));
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
-done:
|
|
|
533c21 |
- pcmk__reset_result(&result);
|
|
|
533c21 |
+ pcmk_exec_status_str(op->result.execution_status));
|
|
|
533c21 |
+ request_peer_fencing(op, NULL, &op->result);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
gboolean
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From c59d062154f7c9e15e90929a20ea244d7efd7247 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:11:12 -0600
|
|
|
533c21 |
Subject: [PATCH 03/15] Refactor: fencer: drop redundant argument from
|
|
|
533c21 |
finalize_op_duplicates()
|
|
|
533c21 |
|
|
|
533c21 |
... now that the result is in the op
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 13 ++++++-------
|
|
|
533c21 |
1 file changed, 6 insertions(+), 7 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 30edbff890..8b496e1042 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -468,11 +468,9 @@ handle_local_reply_and_notify(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
*
|
|
|
533c21 |
* \param[in] op Fencer operation that completed
|
|
|
533c21 |
* \param[in] data Top-level XML to add notification to
|
|
|
533c21 |
- * \param[in] result Full operation result
|
|
|
533c21 |
*/
|
|
|
533c21 |
static void
|
|
|
533c21 |
-finalize_op_duplicates(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
- pcmk__action_result_t *result)
|
|
|
533c21 |
+finalize_op_duplicates(remote_fencing_op_t *op, xmlNode *data)
|
|
|
533c21 |
{
|
|
|
533c21 |
for (GList *iter = op->duplicates; iter != NULL; iter = iter->next) {
|
|
|
533c21 |
remote_fencing_op_t *other = iter->data;
|
|
|
533c21 |
@@ -482,10 +480,11 @@ finalize_op_duplicates(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
crm_debug("Performing duplicate notification for %s@%s: %s "
|
|
|
533c21 |
CRM_XS " id=%.8s",
|
|
|
533c21 |
other->client_name, other->originator,
|
|
|
533c21 |
- pcmk_exec_status_str(result->execution_status),
|
|
|
533c21 |
+ pcmk_exec_status_str(op->result.execution_status),
|
|
|
533c21 |
other->id);
|
|
|
533c21 |
- pcmk__set_result(&other->result, result->exit_status,
|
|
|
533c21 |
- result->execution_status, result->exit_reason);
|
|
|
533c21 |
+ pcmk__set_result(&other->result, op->result.exit_status,
|
|
|
533c21 |
+ op->result.execution_status,
|
|
|
533c21 |
+ op->result.exit_reason);
|
|
|
533c21 |
finalize_op(other, data, true);
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
@@ -606,7 +605,7 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup)
|
|
|
533c21 |
handle_local_reply_and_notify(op, data, &op->result);
|
|
|
533c21 |
|
|
|
533c21 |
if (!dup) {
|
|
|
533c21 |
- finalize_op_duplicates(op, data, &op->result);
|
|
|
533c21 |
+ finalize_op_duplicates(op, data);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
/* Free non-essential parts of the record
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 6c49675855323a52a534afa112a0861ba2e3b1ad Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:15:17 -0600
|
|
|
533c21 |
Subject: [PATCH 04/15] Refactor: fencer: drop redundant argument from
|
|
|
533c21 |
fenced_broadcast_op_result()
|
|
|
533c21 |
|
|
|
533c21 |
... now that the op includes the result
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_history.c | 9 +++------
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 8 +++-----
|
|
|
533c21 |
daemons/fenced/pacemaker-fenced.h | 3 +--
|
|
|
533c21 |
3 files changed, 7 insertions(+), 13 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c
|
|
|
533c21 |
index 0157deadb3..5cacf36ca8 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_history.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_history.c
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2009-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2009-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* The version control history for this file may have further details.
|
|
|
533c21 |
*
|
|
|
533c21 |
@@ -359,8 +359,6 @@ stonith_local_history_diff_and_merge(GHashTable *remote_history,
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
if (remote_history) {
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
init_stonith_remote_op_hash_table(&stonith_remote_op_list);
|
|
|
533c21 |
|
|
|
533c21 |
updated |= g_hash_table_size(remote_history);
|
|
|
533c21 |
@@ -378,10 +376,10 @@ stonith_local_history_diff_and_merge(GHashTable *remote_history,
|
|
|
533c21 |
/* CRM_EX_EXPIRED + PCMK_EXEC_INVALID prevents finalize_op()
|
|
|
533c21 |
* from setting a delegate
|
|
|
533c21 |
*/
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_EXPIRED, PCMK_EXEC_INVALID,
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_EXPIRED, PCMK_EXEC_INVALID,
|
|
|
533c21 |
"Initiated by earlier fencer "
|
|
|
533c21 |
"process and presumed failed");
|
|
|
533c21 |
- fenced_broadcast_op_result(op, &result, false);
|
|
|
533c21 |
+ fenced_broadcast_op_result(op, false);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
g_hash_table_iter_steal(&iter);
|
|
|
533c21 |
@@ -396,7 +394,6 @@ stonith_local_history_diff_and_merge(GHashTable *remote_history,
|
|
|
533c21 |
*/
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- pcmk__reset_result(&result);
|
|
|
533c21 |
g_hash_table_destroy(remote_history); /* remove what is left */
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 8b496e1042..fb5a5e980e 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -390,16 +390,14 @@ fencing_result2xml(remote_fencing_op_t *op, pcmk__action_result_t *result)
|
|
|
533c21 |
* \brief Broadcast a fence result notification to all CPG peers
|
|
|
533c21 |
*
|
|
|
533c21 |
* \param[in] op Fencer operation that completed
|
|
|
533c21 |
- * \param[in] result Full operation result
|
|
|
533c21 |
* \param[in] op_merged Whether this operation is a duplicate of another
|
|
|
533c21 |
*/
|
|
|
533c21 |
void
|
|
|
533c21 |
-fenced_broadcast_op_result(remote_fencing_op_t *op,
|
|
|
533c21 |
- pcmk__action_result_t *result, bool op_merged)
|
|
|
533c21 |
+fenced_broadcast_op_result(remote_fencing_op_t *op, bool op_merged)
|
|
|
533c21 |
{
|
|
|
533c21 |
static int count = 0;
|
|
|
533c21 |
xmlNode *bcast = create_xml_node(NULL, T_STONITH_REPLY);
|
|
|
533c21 |
- xmlNode *notify_data = fencing_result2xml(op, result);
|
|
|
533c21 |
+ xmlNode *notify_data = fencing_result2xml(op, &op->result);
|
|
|
533c21 |
|
|
|
533c21 |
count++;
|
|
|
533c21 |
crm_trace("Broadcasting result to peers");
|
|
|
533c21 |
@@ -581,7 +579,7 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup)
|
|
|
533c21 |
subt = crm_element_value(data, F_SUBTYPE);
|
|
|
533c21 |
if (!dup && !pcmk__str_eq(subt, "broadcast", pcmk__str_casei)) {
|
|
|
533c21 |
/* Defer notification until the bcast message arrives */
|
|
|
533c21 |
- fenced_broadcast_op_result(op, &op->result, op_merged);
|
|
|
533c21 |
+ fenced_broadcast_op_result(op, op_merged);
|
|
|
533c21 |
free_xml(local_data);
|
|
|
533c21 |
return;
|
|
|
533c21 |
}
|
|
|
533c21 |
diff --git a/daemons/fenced/pacemaker-fenced.h b/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
index 1a5c933ea7..6213407da3 100644
|
|
|
533c21 |
--- a/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
+++ b/daemons/fenced/pacemaker-fenced.h
|
|
|
533c21 |
@@ -155,8 +155,7 @@ typedef struct remote_fencing_op_s {
|
|
|
533c21 |
pcmk__action_result_t result;
|
|
|
533c21 |
} remote_fencing_op_t;
|
|
|
533c21 |
|
|
|
533c21 |
-void fenced_broadcast_op_result(remote_fencing_op_t *op,
|
|
|
533c21 |
- pcmk__action_result_t *result, bool op_merged);
|
|
|
533c21 |
+void fenced_broadcast_op_result(remote_fencing_op_t *op, bool op_merged);
|
|
|
533c21 |
|
|
|
533c21 |
// Fencer-specific client flags
|
|
|
533c21 |
enum st_client_flags {
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 73994fc740b8833457b130368db479502d49f285 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:17:33 -0600
|
|
|
533c21 |
Subject: [PATCH 05/15] Refactor: fencer: drop redundant argument from
|
|
|
533c21 |
handle_local_reply_and_notify()
|
|
|
533c21 |
|
|
|
533c21 |
... now that the op includes the result
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 12 +++++-------
|
|
|
533c21 |
1 file changed, 5 insertions(+), 7 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index fb5a5e980e..2621cb2f19 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -424,11 +424,9 @@ fenced_broadcast_op_result(remote_fencing_op_t *op, bool op_merged)
|
|
|
533c21 |
*
|
|
|
533c21 |
* \param[in] op Fencer operation that completed
|
|
|
533c21 |
* \param[in] data Top-level XML to add notification to
|
|
|
533c21 |
- * \param[in] result Full operation result
|
|
|
533c21 |
*/
|
|
|
533c21 |
static void
|
|
|
533c21 |
-handle_local_reply_and_notify(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
- pcmk__action_result_t *result)
|
|
|
533c21 |
+handle_local_reply_and_notify(remote_fencing_op_t *op, xmlNode *data)
|
|
|
533c21 |
{
|
|
|
533c21 |
xmlNode *notify_data = NULL;
|
|
|
533c21 |
xmlNode *reply = NULL;
|
|
|
533c21 |
@@ -443,15 +441,15 @@ handle_local_reply_and_notify(remote_fencing_op_t *op, xmlNode *data,
|
|
|
533c21 |
crm_xml_add(data, F_STONITH_TARGET, op->target);
|
|
|
533c21 |
crm_xml_add(data, F_STONITH_OPERATION, op->action);
|
|
|
533c21 |
|
|
|
533c21 |
- reply = fenced_construct_reply(op->request, data, result);
|
|
|
533c21 |
+ reply = fenced_construct_reply(op->request, data, &op->result);
|
|
|
533c21 |
crm_xml_add(reply, F_STONITH_DELEGATE, op->delegate);
|
|
|
533c21 |
|
|
|
533c21 |
/* Send fencing OP reply to local client that initiated fencing */
|
|
|
533c21 |
do_local_reply(reply, op->client_id, op->call_options & st_opt_sync_call, FALSE);
|
|
|
533c21 |
|
|
|
533c21 |
/* bcast to all local clients that the fencing operation happend */
|
|
|
533c21 |
- notify_data = fencing_result2xml(op, result);
|
|
|
533c21 |
- fenced_send_notification(T_STONITH_NOTIFY_FENCE, result, notify_data);
|
|
|
533c21 |
+ notify_data = fencing_result2xml(op, &op->result);
|
|
|
533c21 |
+ fenced_send_notification(T_STONITH_NOTIFY_FENCE, &op->result, notify_data);
|
|
|
533c21 |
free_xml(notify_data);
|
|
|
533c21 |
fenced_send_notification(T_STONITH_NOTIFY_HISTORY, NULL, NULL);
|
|
|
533c21 |
|
|
|
533c21 |
@@ -600,7 +598,7 @@ finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup)
|
|
|
533c21 |
((op->result.exit_reason == NULL)? "" : op->result.exit_reason),
|
|
|
533c21 |
op->id);
|
|
|
533c21 |
|
|
|
533c21 |
- handle_local_reply_and_notify(op, data, &op->result);
|
|
|
533c21 |
+ handle_local_reply_and_notify(op, data);
|
|
|
533c21 |
|
|
|
533c21 |
if (!dup) {
|
|
|
533c21 |
finalize_op_duplicates(op, data);
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 194056d18d3b550d3a53b94d558ceed03b5e5442 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:18:27 -0600
|
|
|
533c21 |
Subject: [PATCH 06/15] Refactor: fencer: drop redundant argument from
|
|
|
533c21 |
fencing_result2xml()
|
|
|
533c21 |
|
|
|
533c21 |
... now that the op includes the result
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 9 ++++-----
|
|
|
533c21 |
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 2621cb2f19..8d4f53eef6 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -362,13 +362,12 @@ undo_op_remap(remote_fencing_op_t *op)
|
|
|
533c21 |
* \brief Create notification data XML for a fencing operation result
|
|
|
533c21 |
*
|
|
|
533c21 |
* \param[in] op Fencer operation that completed
|
|
|
533c21 |
- * \param[in] result Full operation result
|
|
|
533c21 |
*
|
|
|
533c21 |
* \return Newly created XML to add as notification data
|
|
|
533c21 |
* \note The caller is responsible for freeing the result.
|
|
|
533c21 |
*/
|
|
|
533c21 |
static xmlNode *
|
|
|
533c21 |
-fencing_result2xml(remote_fencing_op_t *op, pcmk__action_result_t *result)
|
|
|
533c21 |
+fencing_result2xml(remote_fencing_op_t *op)
|
|
|
533c21 |
{
|
|
|
533c21 |
xmlNode *notify_data = create_xml_node(NULL, T_STONITH_NOTIFY_FENCE);
|
|
|
533c21 |
|
|
|
533c21 |
@@ -381,7 +380,7 @@ fencing_result2xml(remote_fencing_op_t *op, pcmk__action_result_t *result)
|
|
|
533c21 |
crm_xml_add(notify_data, F_STONITH_CLIENTID, op->client_id);
|
|
|
533c21 |
crm_xml_add(notify_data, F_STONITH_CLIENTNAME, op->client_name);
|
|
|
533c21 |
|
|
|
533c21 |
- stonith__xe_set_result(notify_data, result);
|
|
|
533c21 |
+ stonith__xe_set_result(notify_data, &op->result);
|
|
|
533c21 |
return notify_data;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
@@ -397,7 +396,7 @@ fenced_broadcast_op_result(remote_fencing_op_t *op, bool op_merged)
|
|
|
533c21 |
{
|
|
|
533c21 |
static int count = 0;
|
|
|
533c21 |
xmlNode *bcast = create_xml_node(NULL, T_STONITH_REPLY);
|
|
|
533c21 |
- xmlNode *notify_data = fencing_result2xml(op, &op->result);
|
|
|
533c21 |
+ xmlNode *notify_data = fencing_result2xml(op);
|
|
|
533c21 |
|
|
|
533c21 |
count++;
|
|
|
533c21 |
crm_trace("Broadcasting result to peers");
|
|
|
533c21 |
@@ -448,7 +447,7 @@ handle_local_reply_and_notify(remote_fencing_op_t *op, xmlNode *data)
|
|
|
533c21 |
do_local_reply(reply, op->client_id, op->call_options & st_opt_sync_call, FALSE);
|
|
|
533c21 |
|
|
|
533c21 |
/* bcast to all local clients that the fencing operation happend */
|
|
|
533c21 |
- notify_data = fencing_result2xml(op, &op->result);
|
|
|
533c21 |
+ notify_data = fencing_result2xml(op);
|
|
|
533c21 |
fenced_send_notification(T_STONITH_NOTIFY_FENCE, &op->result, notify_data);
|
|
|
533c21 |
free_xml(notify_data);
|
|
|
533c21 |
fenced_send_notification(T_STONITH_NOTIFY_HISTORY, NULL, NULL);
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From c5d38cb201a1219ca95127cba9c3a778e31966a2 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:35:43 -0600
|
|
|
533c21 |
Subject: [PATCH 07/15] Refactor: fencer: drop redundant argument from
|
|
|
533c21 |
request_peer_fencing()
|
|
|
533c21 |
|
|
|
533c21 |
... now that the op includes the result
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 66 +++++++++++++---------------------
|
|
|
533c21 |
1 file changed, 25 insertions(+), 41 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 8d4f53eef6..7fb7695fba 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -80,8 +80,7 @@ extern xmlNode *stonith_create_op(int call_id, const char *token, const char *op
|
|
|
533c21 |
int call_options);
|
|
|
533c21 |
|
|
|
533c21 |
static void request_peer_fencing(remote_fencing_op_t *op,
|
|
|
533c21 |
- peer_device_info_t *peer,
|
|
|
533c21 |
- pcmk__action_result_t *result);
|
|
|
533c21 |
+ peer_device_info_t *peer);
|
|
|
533c21 |
static void finalize_op(remote_fencing_op_t *op, xmlNode *data, bool dup);
|
|
|
533c21 |
static void report_timeout_period(remote_fencing_op_t * op, int op_timeout);
|
|
|
533c21 |
static int get_op_total_timeout(const remote_fencing_op_t *op,
|
|
|
533c21 |
@@ -646,18 +645,16 @@ static gboolean
|
|
|
533c21 |
remote_op_timeout_one(gpointer userdata)
|
|
|
533c21 |
{
|
|
|
533c21 |
remote_fencing_op_t *op = userdata;
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
|
|
|
533c21 |
op->op_timer_one = 0;
|
|
|
533c21 |
|
|
|
533c21 |
crm_notice("Peer's '%s' action targeting %s for client %s timed out " CRM_XS
|
|
|
533c21 |
" id=%.8s", op->action, op->target, op->client_name, op->id);
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_ERROR, PCMK_EXEC_TIMEOUT,
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_ERROR, PCMK_EXEC_TIMEOUT,
|
|
|
533c21 |
"Peer did not return fence result within timeout");
|
|
|
533c21 |
|
|
|
533c21 |
-
|
|
|
533c21 |
// Try another device, if appropriate
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
return FALSE;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
@@ -730,13 +727,10 @@ remote_op_query_timeout(gpointer data)
|
|
|
533c21 |
crm_debug("Operation %.8s targeting %s already in progress",
|
|
|
533c21 |
op->id, op->target);
|
|
|
533c21 |
} else if (op->query_results) {
|
|
|
533c21 |
- // Result won't be used in this case, but we need to pass something
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
// Query succeeded, so attempt the actual fencing
|
|
|
533c21 |
crm_debug("Query %.8s targeting %s complete (state=%s)",
|
|
|
533c21 |
op->id, op->target, stonith_op_state_str(op->state));
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
} else {
|
|
|
533c21 |
crm_debug("Query %.8s targeting %s timed out (state=%s)",
|
|
|
533c21 |
op->id, op->target, stonith_op_state_str(op->state));
|
|
|
533c21 |
@@ -1622,11 +1616,10 @@ advance_topology_device_in_level(remote_fencing_op_t *op, const char *device,
|
|
|
533c21 |
op_phase_on(op);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- if (op->devices) {
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
-
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ // This function is only called if the previous device succeeded
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
|
|
|
533c21 |
+ if (op->devices) {
|
|
|
533c21 |
/* Necessary devices remain, so execute the next one */
|
|
|
533c21 |
crm_trace("Next targeting %s on behalf of %s@%s",
|
|
|
533c21 |
op->target, op->client_name, op->originator);
|
|
|
533c21 |
@@ -1636,13 +1629,12 @@ advance_topology_device_in_level(remote_fencing_op_t *op, const char *device,
|
|
|
533c21 |
op->delay = 0;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
} else {
|
|
|
533c21 |
/* We're done with all devices and phases, so finalize operation */
|
|
|
533c21 |
crm_trace("Marking complex fencing op targeting %s as complete",
|
|
|
533c21 |
op->target);
|
|
|
533c21 |
op->state = st_done;
|
|
|
533c21 |
- pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
finalize_op(op, msg, false);
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
@@ -1673,13 +1665,9 @@ check_watchdog_fencing_and_wait(remote_fencing_op_t * op)
|
|
|
533c21 |
* \param[in] op Fencing operation to be executed
|
|
|
533c21 |
* \param[in] peer If NULL or topology is in use, choose best peer to execute
|
|
|
533c21 |
* the fencing, otherwise use this peer
|
|
|
533c21 |
- * \param[in] result Full result of previous failed attempt, if any (used as
|
|
|
533c21 |
- * final result only if a previous attempt failed, topology
|
|
|
533c21 |
- * is not in use, and no devices remain to be attempted)
|
|
|
533c21 |
*/
|
|
|
533c21 |
static void
|
|
|
533c21 |
-request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer,
|
|
|
533c21 |
- pcmk__action_result_t *result)
|
|
|
533c21 |
+request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer)
|
|
|
533c21 |
{
|
|
|
533c21 |
const char *device = NULL;
|
|
|
533c21 |
int timeout;
|
|
|
533c21 |
@@ -1822,27 +1810,26 @@ request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer,
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- // This is the only case in which result will be used
|
|
|
533c21 |
- CRM_CHECK(result != NULL, return);
|
|
|
533c21 |
-
|
|
|
533c21 |
if (op->state == st_query) {
|
|
|
533c21 |
crm_info("No peers (out of %d) have devices capable of fencing "
|
|
|
533c21 |
"(%s) %s for client %s " CRM_XS " state=%s",
|
|
|
533c21 |
op->replies, op->action, op->target, op->client_name,
|
|
|
533c21 |
stonith_op_state_str(op->state));
|
|
|
533c21 |
|
|
|
533c21 |
- pcmk__reset_result(result);
|
|
|
533c21 |
- pcmk__set_result(result, CRM_EX_ERROR, PCMK_EXEC_NO_FENCE_DEVICE,
|
|
|
533c21 |
- NULL);
|
|
|
533c21 |
+ pcmk__reset_result(&op->result);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_ERROR,
|
|
|
533c21 |
+ PCMK_EXEC_NO_FENCE_DEVICE, NULL);
|
|
|
533c21 |
} else {
|
|
|
533c21 |
if (pcmk_is_set(op->call_options, st_opt_topology)) {
|
|
|
533c21 |
- pcmk__reset_result(result);
|
|
|
533c21 |
- pcmk__set_result(result, CRM_EX_ERROR,
|
|
|
533c21 |
+ pcmk__reset_result(&op->result);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_ERROR,
|
|
|
533c21 |
PCMK_EXEC_NO_FENCE_DEVICE, NULL);
|
|
|
533c21 |
}
|
|
|
533c21 |
- /* ... else use result provided by caller -- overwriting it with
|
|
|
533c21 |
- PCMK_EXEC_NO_FENCE_DEVICE would prevent finalize_op() from
|
|
|
533c21 |
- setting the correct delegate if needed.
|
|
|
533c21 |
+ /* ... else use existing result from previous failed attempt
|
|
|
533c21 |
+ * (topology is not in use, and no devices remain to be attempted).
|
|
|
533c21 |
+ * Overwriting the result with PCMK_EXEC_NO_FENCE_DEVICE would
|
|
|
533c21 |
+ * prevent finalize_op() from setting the correct delegate if
|
|
|
533c21 |
+ * needed.
|
|
|
533c21 |
*/
|
|
|
533c21 |
|
|
|
533c21 |
crm_info("No peers (out of %d) are capable of fencing (%s) %s "
|
|
|
533c21 |
@@ -1852,8 +1839,6 @@ request_peer_fencing(remote_fencing_op_t *op, peer_device_info_t *peer,
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
op->state = st_failed;
|
|
|
533c21 |
- pcmk__set_result(&op->result, result->exit_status,
|
|
|
533c21 |
- result->execution_status, result->exit_reason);
|
|
|
533c21 |
finalize_op(op, NULL, false);
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
@@ -2104,7 +2089,6 @@ process_remote_stonith_query(xmlNode * msg)
|
|
|
533c21 |
peer_device_info_t *peer = NULL;
|
|
|
533c21 |
uint32_t replies_expected;
|
|
|
533c21 |
xmlNode *dev = get_xpath_object("//@" F_STONITH_REMOTE_OP_ID, msg, LOG_ERR);
|
|
|
533c21 |
- pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
|
|
|
533c21 |
CRM_CHECK(dev != NULL, return -EPROTO);
|
|
|
533c21 |
|
|
|
533c21 |
@@ -2139,7 +2123,7 @@ process_remote_stonith_query(xmlNode * msg)
|
|
|
533c21 |
peer = add_result(op, host, ndevices, dev);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
- pcmk__set_result(&result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
+ pcmk__set_result(&op->result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
|
|
|
533c21 |
|
|
|
533c21 |
if (pcmk_is_set(op->call_options, st_opt_topology)) {
|
|
|
533c21 |
/* If we start the fencing before all the topology results are in,
|
|
|
533c21 |
@@ -2148,12 +2132,12 @@ process_remote_stonith_query(xmlNode * msg)
|
|
|
533c21 |
if (op->state == st_query && all_topology_devices_found(op)) {
|
|
|
533c21 |
/* All the query results are in for the topology, start the fencing ops. */
|
|
|
533c21 |
crm_trace("All topology devices found");
|
|
|
533c21 |
- request_peer_fencing(op, peer, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, peer);
|
|
|
533c21 |
|
|
|
533c21 |
} else if (have_all_replies) {
|
|
|
533c21 |
crm_info("All topology query replies have arrived, continuing (%d expected/%d received) ",
|
|
|
533c21 |
replies_expected, op->replies);
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
} else if (op->state == st_query) {
|
|
|
533c21 |
@@ -2165,12 +2149,12 @@ process_remote_stonith_query(xmlNode * msg)
|
|
|
533c21 |
/* we have a verified device living on a peer that is not the target */
|
|
|
533c21 |
crm_trace("Found %d verified device%s",
|
|
|
533c21 |
nverified, pcmk__plural_s(nverified));
|
|
|
533c21 |
- request_peer_fencing(op, peer, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, peer);
|
|
|
533c21 |
|
|
|
533c21 |
} else if (have_all_replies) {
|
|
|
533c21 |
crm_info("All query replies have arrived, continuing (%d expected/%d received) ",
|
|
|
533c21 |
replies_expected, op->replies);
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
|
|
|
533c21 |
} else {
|
|
|
533c21 |
crm_trace("Waiting for more peer results before launching fencing operation");
|
|
|
533c21 |
@@ -2336,7 +2320,7 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
crm_trace("Next for %s on behalf of %s@%s (result was: %s)",
|
|
|
533c21 |
op->target, op->originator, op->client_name,
|
|
|
533c21 |
pcmk_exec_status_str(op->result.execution_status));
|
|
|
533c21 |
- request_peer_fencing(op, NULL, &op->result);
|
|
|
533c21 |
+ request_peer_fencing(op, NULL);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
gboolean
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From be0a0b652c13161a82b05d3104449b7bfc06e8ac Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 17:56:24 -0600
|
|
|
533c21 |
Subject: [PATCH 08/15] Feature: fencer: track full result in fencing history
|
|
|
533c21 |
|
|
|
533c21 |
Add fencing operation results when creating XML in
|
|
|
533c21 |
stonith_local_history_diff_and_merge(), and parse the results from the received
|
|
|
533c21 |
XML in stonith_xml_history_to_list().
|
|
|
533c21 |
|
|
|
533c21 |
With this, the fencer now always has full results in its op list, and returns
|
|
|
533c21 |
them in the reply for STONITH_OP_FENCE_HISTORY requests (though nothing uses
|
|
|
533c21 |
that as of this commit).
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_history.c | 2 ++
|
|
|
533c21 |
1 file changed, 2 insertions(+)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c
|
|
|
533c21 |
index 5cacf36ca8..3ebf016e67 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_history.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_history.c
|
|
|
533c21 |
@@ -257,6 +257,7 @@ stonith_xml_history_to_list(xmlNode *history)
|
|
|
533c21 |
op->completed_nsec = completed_nsec;
|
|
|
533c21 |
crm_element_value_int(xml_op, F_STONITH_STATE, &state);
|
|
|
533c21 |
op->state = (enum op_state) state;
|
|
|
533c21 |
+ stonith__xe_get_result(xml_op, &op->result);
|
|
|
533c21 |
|
|
|
533c21 |
g_hash_table_replace(rv, id, op);
|
|
|
533c21 |
CRM_LOG_ASSERT(g_hash_table_lookup(rv, id) != NULL);
|
|
|
533c21 |
@@ -355,6 +356,7 @@ stonith_local_history_diff_and_merge(GHashTable *remote_history,
|
|
|
533c21 |
crm_xml_add_ll(entry, F_STONITH_DATE, op->completed);
|
|
|
533c21 |
crm_xml_add_ll(entry, F_STONITH_DATE_NSEC, op->completed_nsec);
|
|
|
533c21 |
crm_xml_add_int(entry, F_STONITH_STATE, op->state);
|
|
|
533c21 |
+ stonith__xe_set_result(entry, &op->result);
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From afc5292036e212bcfc7475893e0b326b2a69ac58 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Wed, 22 Dec 2021 17:17:21 -0600
|
|
|
533c21 |
Subject: [PATCH 09/15] API: libstonithd: add exit_reason member to
|
|
|
533c21 |
stonith_history_t
|
|
|
533c21 |
|
|
|
533c21 |
not yet used, but will be
|
|
|
533c21 |
---
|
|
|
533c21 |
include/crm/stonith-ng.h | 3 ++-
|
|
|
533c21 |
lib/fencing/st_client.c | 3 ++-
|
|
|
533c21 |
2 files changed, 4 insertions(+), 2 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/include/crm/stonith-ng.h b/include/crm/stonith-ng.h
|
|
|
533c21 |
index 3fe9cf54f8..2c79bfa579 100644
|
|
|
533c21 |
--- a/include/crm/stonith-ng.h
|
|
|
533c21 |
+++ b/include/crm/stonith-ng.h
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2004-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2004-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* The version control history for this file may have further details.
|
|
|
533c21 |
*
|
|
|
533c21 |
@@ -111,6 +111,7 @@ typedef struct stonith_history_s {
|
|
|
533c21 |
time_t completed;
|
|
|
533c21 |
struct stonith_history_s *next;
|
|
|
533c21 |
long completed_nsec;
|
|
|
533c21 |
+ char *exit_reason;
|
|
|
533c21 |
} stonith_history_t;
|
|
|
533c21 |
|
|
|
533c21 |
typedef struct stonith_s stonith_t;
|
|
|
533c21 |
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
|
|
533c21 |
index 718739b321..57a2e03361 100644
|
|
|
533c21 |
--- a/lib/fencing/st_client.c
|
|
|
533c21 |
+++ b/lib/fencing/st_client.c
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2004-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2004-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* The version control history for this file may have further details.
|
|
|
533c21 |
*
|
|
|
533c21 |
@@ -735,6 +735,7 @@ void stonith_history_free(stonith_history_t *history)
|
|
|
533c21 |
free(hp->origin);
|
|
|
533c21 |
free(hp->delegate);
|
|
|
533c21 |
free(hp->client);
|
|
|
533c21 |
+ free(hp->exit_reason);
|
|
|
533c21 |
}
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 1b9e2896322849002a5c0a3a34c9375ea32571d6 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Thu, 6 Jan 2022 18:04:15 -0600
|
|
|
533c21 |
Subject: [PATCH 10/15] Feature: fencing: return exit reason with fencing
|
|
|
533c21 |
history
|
|
|
533c21 |
|
|
|
533c21 |
libstonithd's stonith_t:cmds->history() method now parses exit reasons from the
|
|
|
533c21 |
fencer reply, and returns them in the stonith_history_t results.
|
|
|
533c21 |
---
|
|
|
533c21 |
lib/fencing/st_client.c | 6 ++++++
|
|
|
533c21 |
1 file changed, 6 insertions(+)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
|
|
533c21 |
index 57a2e03361..d229b34805 100644
|
|
|
533c21 |
--- a/lib/fencing/st_client.c
|
|
|
533c21 |
+++ b/lib/fencing/st_client.c
|
|
|
533c21 |
@@ -698,6 +698,7 @@ stonith_api_history(stonith_t * stonith, int call_options, const char *node,
|
|
|
533c21 |
stonith_history_t *kvp;
|
|
|
533c21 |
long long completed;
|
|
|
533c21 |
long long completed_nsec = 0L;
|
|
|
533c21 |
+ pcmk__action_result_t result = PCMK__UNKNOWN_RESULT;
|
|
|
533c21 |
|
|
|
533c21 |
kvp = calloc(1, sizeof(stonith_history_t));
|
|
|
533c21 |
kvp->target = crm_element_value_copy(op, F_STONITH_TARGET);
|
|
|
533c21 |
@@ -711,6 +712,11 @@ stonith_api_history(stonith_t * stonith, int call_options, const char *node,
|
|
|
533c21 |
kvp->completed_nsec = completed_nsec;
|
|
|
533c21 |
crm_element_value_int(op, F_STONITH_STATE, &kvp->state);
|
|
|
533c21 |
|
|
|
533c21 |
+ stonith__xe_get_result(op, &result);
|
|
|
533c21 |
+ kvp->exit_reason = result.exit_reason;
|
|
|
533c21 |
+ result.exit_reason = NULL;
|
|
|
533c21 |
+ pcmk__reset_result(&result);
|
|
|
533c21 |
+
|
|
|
533c21 |
if (last) {
|
|
|
533c21 |
last->next = kvp;
|
|
|
533c21 |
} else {
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From ba4e77242e9be4ebeb2843b444ee4afad43c29f3 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Fri, 7 Jan 2022 09:44:39 -0600
|
|
|
533c21 |
Subject: [PATCH 11/15] Feature: fencing: display exit reasons with failed
|
|
|
533c21 |
fencing events
|
|
|
533c21 |
|
|
|
533c21 |
... when available
|
|
|
533c21 |
---
|
|
|
533c21 |
lib/fencing/st_output.c | 20 ++++++++++++++++----
|
|
|
533c21 |
tools/crm_mon_curses.c | 9 +++++++--
|
|
|
533c21 |
2 files changed, 23 insertions(+), 6 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
|
|
|
533c21 |
index e484278867..18924d795d 100644
|
|
|
533c21 |
--- a/lib/fencing/st_output.c
|
|
|
533c21 |
+++ b/lib/fencing/st_output.c
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2019-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2019-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* The version control history for this file may have further details.
|
|
|
533c21 |
*
|
|
|
533c21 |
@@ -11,6 +11,7 @@
|
|
|
533c21 |
#include <stdarg.h>
|
|
|
533c21 |
|
|
|
533c21 |
#include <crm/stonith-ng.h>
|
|
|
533c21 |
+#include <crm/msg_xml.h>
|
|
|
533c21 |
#include <crm/common/iso8601.h>
|
|
|
533c21 |
#include <crm/common/util.h>
|
|
|
533c21 |
#include <crm/common/xml.h>
|
|
|
533c21 |
@@ -263,8 +264,12 @@ stonith_event_html(pcmk__output_t *out, va_list args) {
|
|
|
533c21 |
char *failed_s = time_t_string(event->completed);
|
|
|
533c21 |
|
|
|
533c21 |
out->list_item(out, "failed-stonith-event",
|
|
|
533c21 |
- "%s of %s failed : delegate=%s, client=%s, origin=%s, %s='%s' %s",
|
|
|
533c21 |
+ "%s of %s failed%s%s%s: "
|
|
|
533c21 |
+ "delegate=%s, client=%s, origin=%s, %s='%s' %s",
|
|
|
533c21 |
stonith_action_str(event->action), event->target,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : event->exit_reason,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : ")",
|
|
|
533c21 |
event->delegate ? event->delegate : "",
|
|
|
533c21 |
event->client, event->origin,
|
|
|
533c21 |
full_history ? "completed" : "last-failed",
|
|
|
533c21 |
@@ -296,8 +301,13 @@ stonith_event_text(pcmk__output_t *out, va_list args) {
|
|
|
533c21 |
|
|
|
533c21 |
switch (event->state) {
|
|
|
533c21 |
case st_failed:
|
|
|
533c21 |
- pcmk__indented_printf(out, "%s of %s failed: delegate=%s, client=%s, origin=%s, %s='%s' %s\n",
|
|
|
533c21 |
+ pcmk__indented_printf(out,
|
|
|
533c21 |
+ "%s of %s failed%s%s%s: "
|
|
|
533c21 |
+ "delegate=%s, client=%s, origin=%s, %s='%s' %s\n",
|
|
|
533c21 |
stonith_action_str(event->action), event->target,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : event->exit_reason,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : ")",
|
|
|
533c21 |
event->delegate ? event->delegate : "",
|
|
|
533c21 |
event->client, event->origin,
|
|
|
533c21 |
full_history ? "completed" : "last-failed", buf,
|
|
|
533c21 |
@@ -341,7 +351,9 @@ stonith_event_xml(pcmk__output_t *out, va_list args) {
|
|
|
533c21 |
|
|
|
533c21 |
switch (event->state) {
|
|
|
533c21 |
case st_failed:
|
|
|
533c21 |
- crm_xml_add(node, "status", "failed");
|
|
|
533c21 |
+ pcmk__xe_set_props(node, "status", "failed",
|
|
|
533c21 |
+ XML_LRM_ATTR_EXIT_REASON, event->exit_reason,
|
|
|
533c21 |
+ NULL);
|
|
|
533c21 |
break;
|
|
|
533c21 |
|
|
|
533c21 |
case st_done:
|
|
|
533c21 |
diff --git a/tools/crm_mon_curses.c b/tools/crm_mon_curses.c
|
|
|
533c21 |
index bae3710c44..73c8516a8c 100644
|
|
|
533c21 |
--- a/tools/crm_mon_curses.c
|
|
|
533c21 |
+++ b/tools/crm_mon_curses.c
|
|
|
533c21 |
@@ -1,5 +1,5 @@
|
|
|
533c21 |
/*
|
|
|
533c21 |
- * Copyright 2019-2021 the Pacemaker project contributors
|
|
|
533c21 |
+ * Copyright 2019-2022 the Pacemaker project contributors
|
|
|
533c21 |
*
|
|
|
533c21 |
* The version control history for this file may have further details.
|
|
|
533c21 |
*
|
|
|
533c21 |
@@ -463,8 +463,13 @@ stonith_event_console(pcmk__output_t *out, va_list args) {
|
|
|
533c21 |
|
|
|
533c21 |
switch (event->state) {
|
|
|
533c21 |
case st_failed:
|
|
|
533c21 |
- curses_indented_printf(out, "%s of %s failed: delegate=%s, client=%s, origin=%s, %s='%s'%s\n",
|
|
|
533c21 |
+ curses_indented_printf(out,
|
|
|
533c21 |
+ "%s of %s failed%s%s%s: "
|
|
|
533c21 |
+ "delegate=%s, client=%s, origin=%s, %s='%s' %s\n",
|
|
|
533c21 |
stonith_action_str(event->action), event->target,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : " (",
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : event->exit_reason,
|
|
|
533c21 |
+ (event->exit_reason == NULL)? "" : ")",
|
|
|
533c21 |
event->delegate ? event->delegate : "",
|
|
|
533c21 |
event->client, event->origin,
|
|
|
533c21 |
full_history ? "completed" : "last-failed", buf,
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 8105fb4a3a786780fdf85b3d0308eaf6df1ea434 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Fri, 7 Jan 2022 09:45:22 -0600
|
|
|
533c21 |
Subject: [PATCH 12/15] Low: schemas: copy fence-event API schema in
|
|
|
533c21 |
preparation for changes
|
|
|
533c21 |
|
|
|
533c21 |
---
|
|
|
533c21 |
include/crm/common/output_internal.h | 2 +-
|
|
|
533c21 |
xml/api/fence-event-2.15.rng | 33 ++++++++++++++++++++++++++++
|
|
|
533c21 |
2 files changed, 34 insertions(+), 1 deletion(-)
|
|
|
533c21 |
create mode 100644 xml/api/fence-event-2.15.rng
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h
|
|
|
533c21 |
index 479f0e4b43..8c5dcee17c 100644
|
|
|
533c21 |
--- a/include/crm/common/output_internal.h
|
|
|
533c21 |
+++ b/include/crm/common/output_internal.h
|
|
|
533c21 |
@@ -27,7 +27,7 @@ extern "C" {
|
|
|
533c21 |
# include <glib.h>
|
|
|
533c21 |
# include <crm/common/results.h>
|
|
|
533c21 |
|
|
|
533c21 |
-# define PCMK__API_VERSION "2.14"
|
|
|
533c21 |
+# define PCMK__API_VERSION "2.15"
|
|
|
533c21 |
|
|
|
533c21 |
#if defined(PCMK__WITH_ATTRIBUTE_OUTPUT_ARGS)
|
|
|
533c21 |
# define PCMK__OUTPUT_ARGS(ARGS...) __attribute__((output_args(ARGS)))
|
|
|
533c21 |
diff --git a/xml/api/fence-event-2.15.rng b/xml/api/fence-event-2.15.rng
|
|
|
533c21 |
new file mode 100644
|
|
|
533c21 |
index 0000000000..e54687cd25
|
|
|
533c21 |
--- /dev/null
|
|
|
533c21 |
+++ b/xml/api/fence-event-2.15.rng
|
|
|
533c21 |
@@ -0,0 +1,33 @@
|
|
|
533c21 |
+
|
|
|
533c21 |
+
|
|
|
533c21 |
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
|
533c21 |
+
|
|
|
533c21 |
+ <start>
|
|
|
533c21 |
+ <ref name="fencing-history-event"/>
|
|
|
533c21 |
+ </start>
|
|
|
533c21 |
+
|
|
|
533c21 |
+ <define name="fencing-history-event">
|
|
|
533c21 |
+ <element name="fence_event">
|
|
|
533c21 |
+ <attribute name="status">
|
|
|
533c21 |
+ <choice>
|
|
|
533c21 |
+ <value>failed</value>
|
|
|
533c21 |
+ <value>success</value>
|
|
|
533c21 |
+ <value>pending</value>
|
|
|
533c21 |
+ </choice>
|
|
|
533c21 |
+ </attribute>
|
|
|
533c21 |
+ <optional>
|
|
|
533c21 |
+ <attribute name="extended-status"> <text /> </attribute>
|
|
|
533c21 |
+ </optional>
|
|
|
533c21 |
+ <optional>
|
|
|
533c21 |
+ <attribute name="delegate"> <text /> </attribute>
|
|
|
533c21 |
+ </optional>
|
|
|
533c21 |
+ <attribute name="action"> <text /> </attribute>
|
|
|
533c21 |
+ <attribute name="target"> <text /> </attribute>
|
|
|
533c21 |
+ <attribute name="client"> <text /> </attribute>
|
|
|
533c21 |
+ <attribute name="origin"> <text /> </attribute>
|
|
|
533c21 |
+ <optional>
|
|
|
533c21 |
+ <attribute name="completed"> <text /> </attribute>
|
|
|
533c21 |
+ </optional>
|
|
|
533c21 |
+ </element>
|
|
|
533c21 |
+ </define>
|
|
|
533c21 |
+</grammar>
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 46dd9b74d2ee8f7ab70a0c7fe3a998954d4029e8 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Fri, 7 Jan 2022 09:47:16 -0600
|
|
|
533c21 |
Subject: [PATCH 13/15] Low: schemas: update fence-event API schema for recent
|
|
|
533c21 |
change
|
|
|
533c21 |
|
|
|
533c21 |
---
|
|
|
533c21 |
xml/api/fence-event-2.15.rng | 3 +++
|
|
|
533c21 |
1 file changed, 3 insertions(+)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/xml/api/fence-event-2.15.rng b/xml/api/fence-event-2.15.rng
|
|
|
533c21 |
index e54687cd25..8e000cafa5 100644
|
|
|
533c21 |
--- a/xml/api/fence-event-2.15.rng
|
|
|
533c21 |
+++ b/xml/api/fence-event-2.15.rng
|
|
|
533c21 |
@@ -18,6 +18,9 @@
|
|
|
533c21 |
<optional>
|
|
|
533c21 |
<attribute name="extended-status"> <text /> </attribute>
|
|
|
533c21 |
</optional>
|
|
|
533c21 |
+ <optional>
|
|
|
533c21 |
+ <attribute name="exit-reason"> <text /> </attribute>
|
|
|
533c21 |
+ </optional>
|
|
|
533c21 |
<optional>
|
|
|
533c21 |
<attribute name="delegate"> <text /> </attribute>
|
|
|
533c21 |
</optional>
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 350e71772f67f28af6b67f864cbabc481730035c Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Fri, 7 Jan 2022 11:32:09 -0600
|
|
|
533c21 |
Subject: [PATCH 14/15] Build: libstonithd: bump shared library version
|
|
|
533c21 |
|
|
|
533c21 |
... for stonith_history_t change since 2.1.2.
|
|
|
533c21 |
|
|
|
533c21 |
The struct should only ever be returned by the library as a pointer, so the
|
|
|
533c21 |
changes can be considered backward-compatible. Normally we wouldn't bump shared
|
|
|
533c21 |
library versions mid-cycle, but this will simplify expected backports of this
|
|
|
533c21 |
change.
|
|
|
533c21 |
---
|
|
|
533c21 |
lib/fencing/Makefile.am | 4 ++--
|
|
|
533c21 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/lib/fencing/Makefile.am b/lib/fencing/Makefile.am
|
|
|
533c21 |
index 1ffa3e051b..a10ddb88ec 100644
|
|
|
533c21 |
--- a/lib/fencing/Makefile.am
|
|
|
533c21 |
+++ b/lib/fencing/Makefile.am
|
|
|
533c21 |
@@ -2,7 +2,7 @@
|
|
|
533c21 |
# Original Author: Sun Jiang Dong <sunjd@cn.ibm.com>
|
|
|
533c21 |
# Copyright 2004 International Business Machines
|
|
|
533c21 |
#
|
|
|
533c21 |
-# with later changes copyright 2004-2021 the Pacemaker project contributors.
|
|
|
533c21 |
+# with later changes copyright 2004-2022 the Pacemaker project contributors.
|
|
|
533c21 |
# The version control history for this file may have further details.
|
|
|
533c21 |
#
|
|
|
533c21 |
# This source code is licensed under the GNU General Public License version 2
|
|
|
533c21 |
@@ -14,7 +14,7 @@ noinst_HEADERS = fencing_private.h
|
|
|
533c21 |
|
|
|
533c21 |
lib_LTLIBRARIES = libstonithd.la
|
|
|
533c21 |
|
|
|
533c21 |
-libstonithd_la_LDFLAGS = -version-info 33:0:7
|
|
|
533c21 |
+libstonithd_la_LDFLAGS = -version-info 34:0:8
|
|
|
533c21 |
|
|
|
533c21 |
libstonithd_la_CFLAGS = $(CFLAGS_HARDENED_LIB)
|
|
|
533c21 |
libstonithd_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB)
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|
|
|
533c21 |
|
|
|
533c21 |
From 63ea88620a62ff0759560a02bb5e284ebdd03eb6 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
533c21 |
Date: Wed, 19 Jan 2022 16:53:45 -0600
|
|
|
533c21 |
Subject: [PATCH 15/15] Low: fencer: reset op result before grabbing new one
|
|
|
533c21 |
|
|
|
533c21 |
just in case
|
|
|
533c21 |
---
|
|
|
533c21 |
daemons/fenced/fenced_remote.c | 1 +
|
|
|
533c21 |
1 file changed, 1 insertion(+)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
index 7fb7695fba..dc4649e0fc 100644
|
|
|
533c21 |
--- a/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
+++ b/daemons/fenced/fenced_remote.c
|
|
|
533c21 |
@@ -2219,6 +2219,7 @@ fenced_process_fencing_reply(xmlNode *msg)
|
|
|
533c21 |
return;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
+ pcmk__reset_result(&op->result);
|
|
|
533c21 |
op->result = result; // The operation takes ownership of the result
|
|
|
533c21 |
|
|
|
533c21 |
if (op->devices && device && !pcmk__str_eq(op->devices->data, device, pcmk__str_casei)) {
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|