pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
scheduler_internal.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2025 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#ifndef PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
11#define PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
12
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36 /* Clear fail count if parameters changed for un-expired start or monitor
37 * last_failure.
38 */
40
41 /* Clear fail count if parameters changed for start, monitor, promote, or
42 * migrate_from actions for active resources.
43 */
45};
46
47// Scheduling options and conditions
49 // No scheduler flags set (compare with equality rather than bit set)
51
52 /* These flags are dynamically determined conditions */
53
54 // Whether partition has quorum (via \c PCMK_XA_HAVE_QUORUM attribute)
56 pcmk__sched_quorate = (1ULL << 0),
57
58 // Whether cluster is symmetric (via symmetric-cluster property)
60
61 // Whether scheduling encountered a non-configuration error
63
64 // Whether cluster is in maintenance mode (via maintenance-mode property)
66
67 // Whether fencing is enabled (via stonith-enabled property)
69
70 // Whether cluster has a fencing resource (via CIB resources)
76
77 // Whether any resource provides or requires unfencing (via CIB resources)
79
80 // Whether concurrent fencing is allowed (via concurrent-fencing property)
82
83 /*
84 * Whether resources removed from the configuration should be stopped (via
85 * stop-orphan-resources property)
86 */
88
89 /*
90 * Whether recurring actions removed from the configuration should be
91 * cancelled (via stop-orphan-actions property)
92 */
94
95 // Whether to stop all resources (via stop-all-resources property)
96 pcmk__sched_stop_all = (1ULL << 10),
97
98 // Whether scheduler processing encountered a warning
100
101 /*
102 * Whether start failure should be treated as if
103 * \c PCMK_META_MIGRATION_THRESHOLD is 1 (via
104 * \c PCMK_OPT_START_FAILURE_IS_FATAL property)
105 */
107
108 // Whether unseen nodes should be fenced (via startup-fencing property)
110
111 /*
112 * Whether resources should be left stopped when their node shuts down
113 * cleanly (via shutdown-lock property)
114 */
116
117 /*
118 * Whether resources' current state should be probed (when unknown) before
119 * scheduling any other actions (via the enable-startup-probes property)
120 */
122
123 // Whether the CIB status section has been parsed yet
125
126 // Whether the cluster includes any Pacemaker Remote nodes (via CIB)
128
129
130 /* The remaining flags are scheduling options that must be set explicitly */
131
132 /*
133 * Whether to skip unpacking the CIB status section and stop the scheduling
134 * sequence after applying node-specific location criteria (skipping
135 * assignment, ordering, actions, etc.).
136 */
138
139 // Whether sensitive resource attributes have been masked
140 pcmk__sched_sanitized = (1ULL << 21),
141
142 // Skip counting of total, disabled, and blocked resource instances
143 pcmk__sched_no_counts = (1ULL << 23),
144
145 // Whether node scores should be output instead of logged
147
148 // Whether to show node and resource utilization (in log or output)
150
151 /*
152 * Whether to stop the scheduling sequence after unpacking the CIB,
153 * calculating cluster status, and applying node health (skipping
154 * applying node-specific location criteria, assignment, etc.)
155 */
157
158 /* Can Pacemaker Remote nodes be fenced even from a node that doesn't
159 * have quorum?
160 */
162};
163
164// Implementation of pcmk__scheduler_private_t
166 // Be careful about when each piece of information is available and final
167
168 char *local_node_name; // Name of node running scheduler (if known)
169 crm_time_t *now; // Time to use when evaluating rules
170 pcmk__output_t *out; // Output object for displaying messages
171 GHashTable *options; // Cluster options
172 const char *fence_action; // Default fencing action
173 guint fence_timeout_ms; // Default fencing action timeout (in ms)
174 guint priority_fencing_ms; // Priority-based fencing delay (in ms)
175 guint shutdown_lock_ms; // How long to lock resources (in ms)
176 guint node_pending_ms; // Pending join times out after this (in ms)
177
178 // @TODO convert to enum
179 const char *placement_strategy; // Value of placement-strategy property
180
181 xmlNode *rsc_defaults; // Configured resource defaults
182 xmlNode *op_defaults; // Configured operation defaults
183 GList *resources; // Resources in cluster
184 GHashTable *templates; // Key = template ID, value = resource list
185 GHashTable *tags; // Key = tag ID, value = element list
186 GList *actions; // All scheduled actions
187 GHashTable *singletons; // Scheduled non-resource actions
188 int next_action_id; // Counter used as ID for actions
189 xmlNode *failed; // History entries of failed actions
190 GList *param_check; // History entries that need to be checked
191 GList *stop_needed; // Containers that need stop actions
192 GList *location_constraints; // Location constraints
193 GList *colocation_constraints; // Colocation constraints
194 GList *ordering_constraints; // Ordering constraints
195 GHashTable *ticket_constraints; // Key = ticket ID, value = pcmk__ticket_t
196 int next_ordering_id; // Counter used as ID for orderings
197 int ninstances; // Total number of resource instances
198 int blocked_resources; // Number of blocked resources in cluster
199 int disabled_resources; // Number of disabled resources in cluster
200 time_t recheck_by; // Hint to controller when to reschedule
201 xmlNode *graph; // Transition graph
202 int synapse_count; // Number of transition graph synapses
203};
204
205// Group of enum pcmk__warnings flags for warnings we want to log once
206extern uint32_t pcmk__warnings;
207
215#define pcmk__rsc_info(rsc, fmt, args...) \
216 crm_log_tag(LOG_INFO, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
217
225#define pcmk__rsc_debug(rsc, fmt, args...) \
226 crm_log_tag(LOG_DEBUG, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
227
235#define pcmk__rsc_trace(rsc, fmt, args...) \
236 crm_log_tag(LOG_TRACE, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
237
245#define pcmk__sched_err(scheduler, fmt...) do { \
246 pcmk__set_scheduler_flags((scheduler), \
247 pcmk__sched_processing_error); \
248 crm_err(fmt); \
249 } while (0)
250
258#define pcmk__sched_warn(scheduler, fmt...) do { \
259 pcmk__set_scheduler_flags((scheduler), \
260 pcmk__sched_processing_warning); \
261 crm_warn(fmt); \
262 } while (0)
263
271#define pcmk__set_scheduler_flags(scheduler, flags_to_set) do { \
272 (scheduler)->flags = pcmk__set_flags_as(__func__, __LINE__, \
273 LOG_TRACE, "Scheduler", crm_system_name, \
274 (scheduler)->flags, (flags_to_set), #flags_to_set); \
275 } while (0)
276
284#define pcmk__clear_scheduler_flags(scheduler, flags_to_clear) do { \
285 (scheduler)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
286 LOG_TRACE, "Scheduler", crm_system_name, \
287 (scheduler)->flags, (flags_to_clear), #flags_to_clear); \
288 } while (0)
289
293 const char *reason);
294
295void pcmk__add_param_check(const xmlNode *rsc_op, pcmk_resource_t *rsc,
298 void (*cb)(pcmk_resource_t*, pcmk_node_t*,
299 const xmlNode*,
302
303#ifdef __cplusplus
304}
305#endif
306
307#endif // PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
struct crm_time_s crm_time_t
Definition iso8601.h:32
pcmk_scheduler_t * scheduler
void pcmk__set_scheduler_defaults(pcmk_scheduler_t *scheduler)
Definition scheduler.c:57
pcmk__check_parameters
@ pcmk__check_last_failure
@ pcmk__check_active
void pcmk__free_param_checks(pcmk_scheduler_t *scheduler)
Definition scheduler.c:410
time_t pcmk__scheduler_epoch_time(pcmk_scheduler_t *scheduler)
Definition scheduler.c:300
void pcmk__foreach_param_check(pcmk_scheduler_t *scheduler, void(*cb)(pcmk_resource_t *, pcmk_node_t *, const xmlNode *, enum pcmk__check_parameters))
Definition scheduler.c:387
uint32_t pcmk__warnings
Definition scheduler.c:19
void pcmk__update_recheck_time(time_t recheck, pcmk_scheduler_t *scheduler, const char *reason)
Definition scheduler.c:321
pcmk__scheduler_flags
@ pcmk__sched_in_maintenance
@ pcmk__sched_sanitized
@ pcmk__sched_enable_unfencing
@ pcmk__sched_show_utilization
@ pcmk__sched_quorate
@ pcmk__sched_stop_removed_resources
@ pcmk__sched_shutdown_lock
@ pcmk__sched_fencing_enabled
@ pcmk__sched_cancel_removed_actions
@ pcmk__sched_fence_remote_no_quorum
@ pcmk__sched_symmetric_cluster
@ pcmk__sched_no_counts
@ pcmk__sched_stop_all
@ pcmk__sched_start_failure_fatal
@ pcmk__sched_output_scores
@ pcmk__sched_have_remote_nodes
@ pcmk__sched_concurrent_fencing
@ pcmk__sched_validate_only
@ pcmk__sched_startup_fencing
@ pcmk__sched_have_status
@ pcmk__sched_none
@ pcmk__sched_processing_warning
@ pcmk__sched_have_fencing
@ pcmk__sched_probe_resources
@ pcmk__sched_location_only
@ pcmk__sched_processing_error
void pcmk__add_param_check(const xmlNode *rsc_op, pcmk_resource_t *rsc, pcmk_node_t *node, enum pcmk__check_parameters)
Definition scheduler.c:360
This structure contains everything that makes up a single output formatter.
Scheduler API for tickets.