Skip to content

Commit

Permalink
Refactor: libpacemaker: Drop unused args from pcmk__schedule_actions()
Browse files Browse the repository at this point in the history
Signed-off-by: Reid Wahl <[email protected]>
  • Loading branch information
nrwahl2 committed Jan 25, 2025
1 parent 1746357 commit ab48cae
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 41 deletions.
2 changes: 1 addition & 1 deletion daemons/fenced/fenced_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fenced_scheduler_run(xmlNode *cib)
pcmk__set_scheduler_flags(scheduler,
pcmk__sched_location_only|pcmk__sched_no_counts);
cluster_status(scheduler);
pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);
g_list_foreach(scheduler->priv->resources, register_if_fencing_device,
NULL);

Expand Down
2 changes: 1 addition & 1 deletion daemons/schedulerd/schedulerd_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ handle_pecalc_request(pcmk__request_t *request)
pcmk__sched_no_counts
|pcmk__sched_show_utilization);
cluster_status(scheduler);
pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);
}

// Get appropriate index into series[] array
Expand Down
5 changes: 2 additions & 3 deletions include/pcmki/pcmki_scheduler.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 the Pacemaker project contributors
* Copyright 2014-2025 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
Expand Down Expand Up @@ -36,8 +36,7 @@ typedef struct {

void pcmk__unpack_constraints(pcmk_scheduler_t *scheduler);

void pcmk__schedule_actions(xmlNode *cib, unsigned long long flags,
pcmk_scheduler_t *scheduler);
void pcmk__schedule_actions(pcmk_scheduler_t *scheduler);

GList *pcmk__copy_node_list(const GList *list, bool reset);

Expand Down
32 changes: 1 addition & 31 deletions lib/pacemaker/pcmk_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,45 +730,15 @@ log_unrunnable_actions(const pcmk_scheduler_t *scheduler)
}
}

/*!
* \internal
* \brief Unpack the CIB for scheduling
*
* \param[in,out] cib CIB XML to unpack (may be NULL if already unpacked)
* \param[in] flags Scheduler flags to set in addition to defaults
* \param[in,out] scheduler Scheduler data
*/
static void
unpack_cib(xmlNode *cib, unsigned long long flags, pcmk_scheduler_t *scheduler)
{
if (pcmk_is_set(scheduler->flags, pcmk__sched_have_status)) {
crm_trace("Reusing previously calculated cluster status");
pcmk__set_scheduler_flags(scheduler, flags);
return;
}
pcmk__assert(cib != NULL);
crm_trace("Calculating cluster status");
pcmk_reset_scheduler(scheduler);
pcmk__set_scheduler_flags(scheduler, flags);
scheduler->input = cib;
cluster_status(scheduler); // Sets pcmk__sched_have_status
}

/*!
* \internal
* \brief Run the scheduler for a given CIB
*
* \param[in,out] cib CIB XML to use as scheduler input
* \param[in] flags Scheduler flags to set in addition to defaults
* \param[in,out] scheduler Scheduler data
*/
void
pcmk__schedule_actions(xmlNode *cib, unsigned long long flags,
pcmk_scheduler_t *scheduler)
pcmk__schedule_actions(pcmk_scheduler_t *scheduler)
{
if (cib != NULL) {
unpack_cib(cib, flags, scheduler);
}
pcmk__set_assignment_methods(scheduler);
pcmk__apply_node_health(scheduler);
pcmk__unpack_constraints(scheduler);
Expand Down
4 changes: 2 additions & 2 deletions lib/pacemaker/pcmk_simulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ profile_file(const char *xml_file, unsigned int repeat,
pcmk__set_scheduler_flags(scheduler, flags);
set_effective_date(scheduler, false, use_date);
cluster_status(scheduler);
pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);

// Avoid freeing cib_object in pcmk_reset_scheduler()
scheduler->input = NULL;
Expand Down Expand Up @@ -965,7 +965,7 @@ pcmk__simulate(pcmk_scheduler_t *scheduler, pcmk__output_t *out,
scheduler->priv->out = logger_out;
}

pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);

if (logger_out == NULL) {
out->end_list(out);
Expand Down
2 changes: 1 addition & 1 deletion lib/pacemaker/pcmk_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pcmk__verify(pcmk__output_t *out, xmlNode **cib_object)
// No status available, so do minimal checks
pcmk__set_scheduler_flags(scheduler, pcmk__sched_validate_only);
}
pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);

// Caller retains ownership of *cib_object; don't free it
scheduler->input = NULL;
Expand Down
4 changes: 2 additions & 2 deletions tools/crm_resource_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ update_dataset(cib_t *cib, pcmk_scheduler_t *scheduler, xmlNode **cib_xml_orig,
goto done;
}

pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);

prev_quiet = out->is_quiet(out);
out->quiet = true;
Expand Down Expand Up @@ -2108,7 +2108,7 @@ wait_till_stable(pcmk__output_t *out, guint timeout_ms, cib_t * cib)
break;
}
pcmk__set_scheduler_flags(scheduler, pcmk__sched_no_counts);
pcmk__schedule_actions(NULL, pcmk__sched_none, scheduler);
pcmk__schedule_actions(scheduler);

if (!printed_version_warning) {
/* If the DC has a different version than the local node, the two
Expand Down

0 comments on commit ab48cae

Please sign in to comment.