Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
19e9e9e
Refactor: libcrmcommon, libpe_status: Drop an unused Coverity annotation
nrwahl2 May 5, 2026
e883bcd
Refactor: libcrmcommon: Simplify crm_ipc_close()
nrwahl2 May 5, 2026
74afade
Refactor: libcrmcommon: Simplify crm_ipc_destroy()
nrwahl2 May 5, 2026
a09a5fa
Refactor: libcrmcommon: Simplify mainloop_gio_destroy()
nrwahl2 May 5, 2026
07ddc7a
Refactor: libcrmcommon: Simplify freeing of client->channel
nrwahl2 May 5, 2026
5436c11
Refactor: liblrmd: Make/rename some variables in lrmd_dispatch_internal
nrwahl2 May 5, 2026
dcbba40
Refactor: liblrmd: Unindent in a few more places
nrwahl2 May 5, 2026
051f846
API: libcrmcommon: did_rsc_op_fail() argument is now const
nrwahl2 May 5, 2026
7c8a953
API: liblrmd: lrmd_copy_event() argument is now const
nrwahl2 May 5, 2026
3167a71
Refactor: various: const lrmd_event_data_t in internal functions
nrwahl2 May 5, 2026
90a0db7
API: liblrmd: lrmd_event_data_t char * members are now non-const
nrwahl2 May 5, 2026
c0dac64
Low: cts-lab: Fix corosync-ignore pattern for CPG API connection failed
nrwahl2 May 5, 2026
eae7cc1
Refactor: liblrmd: Inline lrmd__reset_result()
nrwahl2 May 5, 2026
0ef6cad
Refactor: libcrmcommon: Use pcmk__str_update() in pcmk__set_result()
nrwahl2 May 5, 2026
1da33b4
Refactor: libcrmservice: Drop services__grab_{stdout,stderr}()
nrwahl2 May 5, 2026
a3901ab
Refactor: fencer: Drop list_to_string() terminate_with_delim argument
nrwahl2 May 5, 2026
ee20c67
Refactor: fencer: Simplify list_to_string() a bit further
nrwahl2 May 5, 2026
c89a4a6
Refactor: fencer: Drop some elses in execute_agent_action()
nrwahl2 May 5, 2026
b86b981
Refactor: fencer: Drop list_to_string()
nrwahl2 May 5, 2026
3d778d6
Refactor: libcrmcommon: Drop pcmk__set_result_output()
nrwahl2 May 5, 2026
180c180
Feature: libcib: Assert on allocation error when creating new cib_t
nrwahl2 May 9, 2026
64d4e57
Refactor: libcrmcommon: Make pcmk__dup_alert() static
nrwahl2 May 13, 2026
82eaefc
Low: libcrmcommon: Avoid memory leak when creating alert recipient entry
nrwahl2 May 13, 2026
5d53405
Refactor: libpe_status: Change a condition in pe__unpack_bundle()
nrwahl2 May 13, 2026
434491d
Refactor: libpe_status: Use bool in pe__unpack_bundle()
nrwahl2 May 14, 2026
1c66c9f
Refactor: libpe_status: Rename GLib iterators to iter and iter2
nrwahl2 May 14, 2026
551a0c9
Refactor: libpe_status: Drop strdup() within bundle.c
nrwahl2 May 14, 2026
c1d394d
Refactor: libpe_status: Functionize getting container XML for bundle
nrwahl2 May 14, 2026
5f6bfcd
Refactor: libpe_status: New unpack_bundle_container()
nrwahl2 May 14, 2026
e8aa6b9
Refactor: libpe_status: New unpack_bundle_network()
nrwahl2 May 14, 2026
0edb3ff
Refactor: libpe_status: New unpack_bundle_storage()
nrwahl2 May 14, 2026
40e552b
Refactor: libpe_status: New unpack_bundle_primitive()
nrwahl2 May 14, 2026
cd9c603
Refactor: libpe_status: Use pcmk__xe_set_{int,bool} in unpack primitive
nrwahl2 May 14, 2026
aecff95
Refactor: libpe_status: Drop data arg from create_replica_resources()
nrwahl2 May 14, 2026
44b8f6d
Refactor: libpe_status: Drop redundant valid_network() call
nrwahl2 May 14, 2026
c38849e
Refactor: libpe_status: Clean up valid_network()
nrwahl2 May 14, 2026
6615a79
Low: libpe_status: Clear unique flag on setting nreplicas_per_host to 1
nrwahl2 May 14, 2026
066a443
Refactor: libpe_status: Set globally-unique based on rsc unique flag
nrwahl2 May 14, 2026
876e458
Refactor: libpe_status: Rename variables in unpack_bundle_primitive()
nrwahl2 May 14, 2026
27f627d
Refactor: libpe_status: New create_child_resource() in bundle.c
nrwahl2 May 14, 2026
d564305
Refactor: libpe_status: Drop most uses of bundle_data->prefix
nrwahl2 May 14, 2026
4eb60de
Refactor: libpe_status: Drop agent_type validation for bundles
nrwahl2 May 14, 2026
76af8bd
Refactor: libpe_status: allocate_ip() takes a pcmk_resource_t argument
nrwahl2 May 14, 2026
435ef6e
Refactor: libpe_status: Drop pe__bundle_variant_data_t:prefix
nrwahl2 May 14, 2026
dfacfc1
Refactor: libpe_status: New create_simple_replicas()
nrwahl2 May 14, 2026
b750799
Medium: libpe_status: Fix double-free in pe__unpack_bundle()
nrwahl2 May 14, 2026
0e612fe
Refactor: libpe_status: Move utilization to create_replica_resources()
nrwahl2 May 14, 2026
a9b1f66
Low: libcrmcommon, tools: Fix NULL dereference in crm_resource.c
nrwahl2 May 14, 2026
e38b486
Refactor: libcrmcommon: Check controld API reply type
nrwahl2 May 14, 2026
670054b
Low: libpacemaker: Fix list memory leaks in pcmk_agents.c
nrwahl2 May 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion daemons/controld/controld_alerts.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ crmd_alert_fencing_op(stonith_event_t * e)
}

void
crmd_alert_resource_op(const char *node, lrmd_event_data_t * op)
crmd_alert_resource_op(const char *node, const lrmd_event_data_t *op)
{
lrm_state_t *lrm_state;

Expand Down
4 changes: 2 additions & 2 deletions daemons/controld/controld_alerts.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2024 the Pacemaker project contributors
* Copyright 2015-2026 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
Expand All @@ -19,6 +19,6 @@
void crmd_unpack_alerts(xmlNode *alerts);
void crmd_alert_node_event(pcmk__node_status_t *node);
void crmd_alert_fencing_op(stonith_event_t *e);
void crmd_alert_resource_op(const char *node, lrmd_event_data_t *op);
void crmd_alert_resource_op(const char *node, const lrmd_event_data_t *op);

#endif
6 changes: 3 additions & 3 deletions daemons/controld/controld_cib.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ build_parameter_list(const lrmd_event_data_t *op,
}

static void
append_restart_list(lrmd_event_data_t *op, struct ra_metadata_s *metadata,
append_restart_list(const lrmd_event_data_t *op, struct ra_metadata_s *metadata,
xmlNode *update, const char *version)
{
GString *list = NULL;
Expand Down Expand Up @@ -576,7 +576,7 @@ append_restart_list(lrmd_event_data_t *op, struct ra_metadata_s *metadata,
}

static void
append_secure_list(lrmd_event_data_t *op, struct ra_metadata_s *metadata,
append_secure_list(const lrmd_event_data_t *op, struct ra_metadata_s *metadata,
xmlNode *update, const char *version)
{
GString *list = NULL;
Expand Down Expand Up @@ -753,7 +753,7 @@ cib_rsc_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *use
* until it is active there again after the node comes back up.
*/
static bool
should_preserve_lock(lrmd_event_data_t *op)
should_preserve_lock(const lrmd_event_data_t *op)
{
if (!pcmk__is_set(controld_globals.flags, controld_shutdown_lock_enabled)) {
return false;
Expand Down
11 changes: 7 additions & 4 deletions daemons/controld/controld_execd.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ history_free(gpointer data)
}

static void
update_history_cache(lrm_state_t * lrm_state, lrmd_rsc_info_t * rsc, lrmd_event_data_t * op)
update_history_cache(lrm_state_t *lrm_state, lrmd_rsc_info_t *rsc,
const lrmd_event_data_t *op)
{
int target_rc = 0;
rsc_history_t *entry = NULL;
Expand Down Expand Up @@ -269,7 +270,7 @@ send_task_ok_ack(const lrm_state_t *lrm_state, const ha_msg_input_t *input,
}

static inline const char *
op_node_name(lrmd_event_data_t *op)
op_node_name(const lrmd_event_data_t *op)
{
return pcmk__s(op->remote_nodename,
controld_globals.cluster->priv->node_name);
Expand Down Expand Up @@ -1725,11 +1726,13 @@ controld_ack_event_directly(const char *to_host, const char *to_sys,
pcmk__node_status_t *peer = NULL;

CRM_CHECK(op != NULL, return);

if (op->rsc_id == NULL) {
// op->rsc_id is a (const char *) but lrmd_free_event() frees it
pcmk__assert(rsc_id != NULL);
op->rsc_id = pcmk__str_copy(rsc_id);
}

pcmk__assert(op->rsc_id != NULL);

if (to_sys == NULL) {
to_sys = CRM_SYSTEM_TENGINE;
}
Expand Down
27 changes: 12 additions & 15 deletions daemons/controld/controld_execd_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,28 @@ free_recurring_op(gpointer value)
static gboolean
fail_pending_op(gpointer key, gpointer value, gpointer user_data)
{
lrmd_event_data_t event = { 0, };
lrm_state_t *lrm_state = user_data;
active_op_t *op = value;
lrmd_event_data_t *event = lrmd_new_event(op->rsc_id, op->op_type,
op->interval_ms);

pcmk__trace("Pre-emptively failing " PCMK__OP_FMT " on %s (call=%s, %s)",
op->rsc_id, op->op_type, op->interval_ms,
lrm_state->node_name, (const char *) key, op->user_data);

event.type = lrmd_event_exec_complete;
event.rsc_id = op->rsc_id;
event.op_type = op->op_type;
event.user_data = op->user_data;
event.timeout = 0;
event.interval_ms = op->interval_ms;
lrmd__set_result(&event, PCMK_OCF_UNKNOWN_ERROR, PCMK_EXEC_NOT_CONNECTED,
event->type = lrmd_event_exec_complete;
event->user_data = pcmk__str_copy(op->user_data);
lrmd__set_result(event, PCMK_OCF_UNKNOWN_ERROR, PCMK_EXEC_NOT_CONNECTED,
"Action was pending when executor connection was dropped");
event.t_run = op->start_time;
event.t_rcchange = op->start_time;
event->t_run = op->start_time;
event->t_rcchange = op->start_time;

event.call_id = op->call_id;
event.remote_nodename = lrm_state->node_name;
event.params = op->params;
event->call_id = op->call_id;
event->remote_nodename = pcmk__str_copy(lrm_state->node_name);
event->params = op->params;

process_lrm_event(lrm_state, &event, op, NULL);
lrmd__reset_result(&event);
process_lrm_event(lrm_state, event, op, NULL);
lrmd_free_event(event);
return TRUE;
}

Expand Down
57 changes: 26 additions & 31 deletions daemons/controld/controld_remote_ra.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,26 +399,24 @@ check_remote_node_state(const remote_ra_cmd_t *cmd)
static void
report_remote_ra_result(remote_ra_cmd_t * cmd)
{
lrmd_event_data_t op = { 0, };
lrmd_event_data_t *event = lrmd_new_event(cmd->rsc_id, cmd->action,
cmd->interval_ms);

check_remote_node_state(cmd);

op.type = lrmd_event_exec_complete;
op.rsc_id = cmd->rsc_id;
op.op_type = cmd->action;
op.user_data = cmd->userdata;
op.timeout = cmd->timeout;
op.interval_ms = cmd->interval_ms;
op.t_run = cmd->start_time;
op.t_rcchange = cmd->start_time;
event->type = lrmd_event_exec_complete;
event->user_data = pcmk__str_copy(cmd->userdata);
event->timeout = cmd->timeout;
event->t_run = cmd->start_time;
event->t_rcchange = cmd->start_time;

lrmd__set_result(&op, cmd->result.exit_status, cmd->result.execution_status,
cmd->result.exit_reason);
lrmd__set_result(event, cmd->result.exit_status,
cmd->result.execution_status, cmd->result.exit_reason);

if (pcmk__is_set(cmd->status, cmd_reported_success)
&& !pcmk__result_ok(&(cmd->result))) {

op.t_rcchange = time(NULL);
event->t_rcchange = time(NULL);
/* This edge case will likely never ever occur, but if it does the
* result is that a failure will not be processed correctly. This is only
* remotely possible because we are able to detect a connection resource's tcp
Expand All @@ -428,27 +426,25 @@ report_remote_ra_result(remote_ra_cmd_t * cmd)
* basically, we are not guaranteed that the first successful monitor op and
* a subsequent failed monitor op will not occur in the same timestamp. We have to
* make it look like the operations occurred at separate times though. */
if (op.t_rcchange == op.t_run) {
op.t_rcchange++;
if (event->t_rcchange == event->t_run) {
event->t_rcchange++;
}
}

if (cmd->params) {
lrmd_key_value_t *tmp;

op.params = pcmk__strkey_table(free, free);
event->params = pcmk__strkey_table(free, free);
for (tmp = cmd->params; tmp; tmp = tmp->next) {
pcmk__insert_dup(op.params, tmp->key, tmp->value);
pcmk__insert_dup(event->params, tmp->key, tmp->value);
}

}
op.call_id = cmd->call_id;
op.remote_nodename = cmd->owner;
event->call_id = cmd->call_id;
event->remote_nodename = pcmk__str_copy(cmd->owner);

lrm_op_callback(&op);

g_clear_pointer(&op.params, g_hash_table_destroy);
lrmd__reset_result(&op);
lrm_op_callback(event);
lrmd_free_event(event);
}

/*!
Expand Down Expand Up @@ -562,22 +558,21 @@ monitor_timeout_cb(gpointer data)
static void
synthesize_lrmd_success(lrm_state_t *lrm_state, const char *rsc_id, const char *op_type)
{
lrmd_event_data_t op = { 0, };
lrmd_event_data_t *event = NULL;

if (lrm_state == NULL) {
/* if lrm_state not given assume local */
lrm_state = controld_get_executor_state(NULL, false);
}
pcmk__assert(lrm_state != NULL);

op.type = lrmd_event_exec_complete;
op.rsc_id = rsc_id;
op.op_type = op_type;
op.t_run = time(NULL);
op.t_rcchange = op.t_run;
op.call_id = generate_callid();
lrmd__set_result(&op, PCMK_OCF_OK, PCMK_EXEC_DONE, NULL);
process_lrm_event(lrm_state, &op, NULL, NULL);
event = lrmd_new_event(rsc_id, op_type, 0);
event->type = lrmd_event_exec_complete;
event->t_run = time(NULL);
event->t_rcchange = event->t_run;
event->call_id = generate_callid();
lrmd__set_result(event, PCMK_OCF_OK, PCMK_EXEC_DONE, NULL);
process_lrm_event(lrm_state, event, NULL, NULL);
}

void
Expand Down
4 changes: 2 additions & 2 deletions daemons/execd/execd_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,8 @@ action_complete(svc_action_t * action)
#endif

finalize:
pcmk__set_result_output(&(cmd->result), services__grab_stdout(action),
services__grab_stderr(action));
cmd->result.action_stdout = pcmk__str_copy(action->stdout_data);
cmd->result.action_stderr = pcmk__str_copy(action->stderr_data);
cmd_finalize(cmd, rsc);
}

Expand Down
62 changes: 19 additions & 43 deletions daemons/fenced/fenced_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1953,40 +1953,6 @@ fenced_unregister_level(xmlNode *msg, pcmk__action_result_t *result)
pcmk__set_result(result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
}

static char *
list_to_string(GList *list, const char *delim, gboolean terminate_with_delim)
{
int max = g_list_length(list);
size_t delim_len = delim?strlen(delim):0;
size_t alloc_size = 1 + (max?((max-1+(terminate_with_delim?1:0))*delim_len):0);
char *rv;

char *pos = NULL;
const char *lead_delim = "";

for (const GList *iter = list; iter != NULL; iter = iter->next) {
const char *value = (const char *) iter->data;

alloc_size += strlen(value);
}

rv = pcmk__assert_alloc(alloc_size, sizeof(char));
pos = rv;

for (const GList *iter = list; iter != NULL; iter = iter->next) {
const char *value = (const char *) iter->data;

pos = &pos[sprintf(pos, "%s%s", lead_delim, value)];
lead_delim = delim;
}

if ((max != 0) && terminate_with_delim) {
sprintf(pos, "%s", delim);
}

return rv;
}

/*!
* \internal
* \brief Execute a fence agent action directly (and asynchronously)
Expand Down Expand Up @@ -2028,17 +1994,25 @@ execute_agent_action(xmlNode *msg, pcmk__action_result_t *result)
if (fencing_watchdog_timeout_ms <= 0) {
pcmk__set_result(result, CRM_EX_ERROR, PCMK_EXEC_NO_FENCE_DEVICE,
"Watchdog fence device not configured");
return;
}

if (pcmk__str_eq(action, PCMK_ACTION_LIST, pcmk__str_none)) {
GString *buf = g_string_sized_new(64);

for (const GList *iter = stonith_watchdog_targets; iter != NULL;
iter = iter->next) {

g_string_append(buf, iter->data);
g_string_append_c(buf, '\n');
}

} else if (pcmk__str_eq(action, PCMK_ACTION_LIST, pcmk__str_none)) {
pcmk__set_result(result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
pcmk__set_result_output(result,
list_to_string(stonith_watchdog_targets,
"\n", TRUE),
NULL);
result->action_stdout = pcmk__str_copy(buf->str);
g_string_free(buf, TRUE);
return;
}

} else if (pcmk__str_eq(action, PCMK_ACTION_MONITOR, pcmk__str_none)) {
if (pcmk__str_eq(action, PCMK_ACTION_MONITOR, pcmk__str_none)) {
pcmk__set_result(result, CRM_EX_OK, PCMK_EXEC_DONE, NULL);
return;
}
Expand All @@ -2052,9 +2026,11 @@ execute_agent_action(xmlNode *msg, pcmk__action_result_t *result)
pcmk__format_result(result, CRM_EX_ERROR, PCMK_EXEC_NO_FENCE_DEVICE,
"'%s' not found", id);
return;
}

if (!pcmk__is_set(device->flags, fenced_df_api_registered)
&& pcmk__str_eq(action, PCMK_ACTION_MONITOR, pcmk__str_none)) {

} else if (!pcmk__is_set(device->flags, fenced_df_api_registered)
&& (strcmp(action, PCMK_ACTION_MONITOR) == 0)) {
// Monitors may run only on "started" (API-registered) devices
pcmk__info("Ignoring API '%s' action request because device %s not "
"active",
Expand Down
5 changes: 2 additions & 3 deletions daemons/fenced/fenced_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,9 @@ stonith_xml_history_to_list(const xmlNode *history)
}
pcmk__set_result(&op->result, exit_status, execution_status,
pcmk__xe_get(xml_op, PCMK_XA_EXIT_REASON));
pcmk__set_result_output(&op->result,
pcmk__xe_get_copy(xml_op, PCMK__XA_ST_OUTPUT),
NULL);

op->result.action_stdout = pcmk__xe_get_copy(xml_op,
PCMK__XA_ST_OUTPUT);

g_hash_table_replace(rv, id, op);
CRM_LOG_ASSERT(g_hash_table_lookup(rv, id) != NULL);
Expand Down
4 changes: 2 additions & 2 deletions include/crm/common/actions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2025 the Pacemaker project contributors
* Copyright 2004-2026 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
Expand Down Expand Up @@ -77,7 +77,7 @@ gboolean decode_transition_magic(const char *magic, char **uuid,

// @COMPAT Either these shouldn't be in libcrmcommon or lrmd_event_data_t should
int rsc_op_expected_rc(const lrmd_event_data_t *event);
gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc);
gboolean did_rsc_op_fail(const lrmd_event_data_t *event, int target_rc);

bool crm_op_needs_metadata(const char *rsc_class, const char *op);

Expand Down
1 change: 0 additions & 1 deletion include/crm/common/alerts_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ enum pcmk__alert_keys_e {

extern const char *pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX];

pcmk__alert_t *pcmk__dup_alert(const pcmk__alert_t *entry);
pcmk__alert_t *pcmk__alert_new(const char *id, const char *path);
void pcmk__free_alert(pcmk__alert_t *entry);
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name,
Expand Down
3 changes: 0 additions & 3 deletions include/crm/common/results_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ void pcmk__format_result(pcmk__action_result_t *result, int exit_status,
enum pcmk_exec_status exec_status,
const char *format, ...) G_GNUC_PRINTF(4, 5);

void pcmk__set_result_output(pcmk__action_result_t *result,
char *out, char *err);

void pcmk__reset_result(pcmk__action_result_t *result);

void pcmk__copy_result(const pcmk__action_result_t *src,
Expand Down
Loading