From ab48cae4bdd972a4203977edfb99ce76729f8f1b Mon Sep 17 00:00:00 2001 From: Reid Wahl Date: Sat, 25 Jan 2025 01:31:54 -0800 Subject: [PATCH] Refactor: libpacemaker: Drop unused args from pcmk__schedule_actions() Signed-off-by: Reid Wahl --- daemons/fenced/fenced_scheduler.c | 2 +- daemons/schedulerd/schedulerd_messages.c | 2 +- include/pcmki/pcmki_scheduler.h | 5 ++-- lib/pacemaker/pcmk_scheduler.c | 32 +----------------------- lib/pacemaker/pcmk_simulate.c | 4 +-- lib/pacemaker/pcmk_verify.c | 2 +- tools/crm_resource_runtime.c | 4 +-- 7 files changed, 10 insertions(+), 41 deletions(-) diff --git a/daemons/fenced/fenced_scheduler.c b/daemons/fenced/fenced_scheduler.c index dbce24d80f1..c6c3ab0af03 100644 --- a/daemons/fenced/fenced_scheduler.c +++ b/daemons/fenced/fenced_scheduler.c @@ -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); diff --git a/daemons/schedulerd/schedulerd_messages.c b/daemons/schedulerd/schedulerd_messages.c index d1f4cb83adb..a73a90b2ef3 100644 --- a/daemons/schedulerd/schedulerd_messages.c +++ b/daemons/schedulerd/schedulerd_messages.c @@ -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 diff --git a/include/pcmki/pcmki_scheduler.h b/include/pcmki/pcmki_scheduler.h index 77eb98ec8c1..b2daea7dc3e 100644 --- a/include/pcmki/pcmki_scheduler.h +++ b/include/pcmki/pcmki_scheduler.h @@ -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. * @@ -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); diff --git a/lib/pacemaker/pcmk_scheduler.c b/lib/pacemaker/pcmk_scheduler.c index 4427061447e..dee857b0d97 100644 --- a/lib/pacemaker/pcmk_scheduler.c +++ b/lib/pacemaker/pcmk_scheduler.c @@ -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); diff --git a/lib/pacemaker/pcmk_simulate.c b/lib/pacemaker/pcmk_simulate.c index a1de723374b..87349f6dbf6 100644 --- a/lib/pacemaker/pcmk_simulate.c +++ b/lib/pacemaker/pcmk_simulate.c @@ -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; @@ -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); diff --git a/lib/pacemaker/pcmk_verify.c b/lib/pacemaker/pcmk_verify.c index e47aeeff5c5..5282c105277 100644 --- a/lib/pacemaker/pcmk_verify.c +++ b/lib/pacemaker/pcmk_verify.c @@ -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; diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c index 670029400ce..361949b45d6 100644 --- a/tools/crm_resource_runtime.c +++ b/tools/crm_resource_runtime.c @@ -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; @@ -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