pacemaker
3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
include
crm
common
scheduler_internal.h
Go to the documentation of this file.
1
/*
2
* Copyright 2004-2024 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
13
#include <
crm/common/action_relation_internal.h
>
14
#include <
crm/common/actions_internal.h
>
15
#include <
crm/common/attrs_internal.h
>
16
#include <
crm/common/bundles_internal.h
>
17
#include <
crm/common/clone_internal.h
>
18
#include <
crm/common/digest_internal.h
>
19
#include <
crm/common/failcounts_internal.h
>
20
#include <
crm/common/group_internal.h
>
21
#include <
crm/common/history_internal.h
>
22
#include <
crm/common/location_internal.h
>
23
#include <
crm/common/nodes_internal.h
>
24
#include <
crm/common/primitive_internal.h
>
25
#include <
crm/common/remote_internal.h
>
26
#include <
crm/common/resources_internal.h
>
27
#include <
crm/common/roles_internal.h
>
28
#include <
crm/common/rules_internal.h
>
29
#include <
crm/common/tickets_internal.h
>
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
35
enum
pcmk__check_parameters
{
36
/* Clear fail count if parameters changed for un-expired start or monitor
37
* last_failure.
38
*/
39
pcmk__check_last_failure
,
40
41
/* Clear fail count if parameters changed for start, monitor, promote, or
42
* migrate_from actions for active resources.
43
*/
44
pcmk__check_active
,
45
};
46
47
// Scheduling options and conditions
48
enum
pcmk__scheduler_flags
{
49
// No scheduler flags set (compare with equality rather than bit set)
50
pcmk__sched_none
= 0ULL,
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)
59
pcmk__sched_symmetric_cluster
= (1ULL << 1),
60
61
// Whether scheduling encountered a non-configuration error
62
pcmk__sched_processing_error
= (1ULL << 2),
63
64
// Whether cluster is in maintenance mode (via maintenance-mode property)
65
pcmk__sched_in_maintenance
= (1ULL << 3),
66
67
// Whether fencing is enabled (via stonith-enabled property)
68
pcmk__sched_fencing_enabled
= (1ULL << 4),
69
70
// Whether cluster has a fencing resource (via CIB resources)
75
pcmk__sched_have_fencing
= (1ULL << 5),
76
77
// Whether any resource provides or requires unfencing (via CIB resources)
78
pcmk__sched_enable_unfencing
= (1ULL << 6),
79
80
// Whether concurrent fencing is allowed (via concurrent-fencing property)
81
pcmk__sched_concurrent_fencing
= (1ULL << 7),
82
83
/*
84
* Whether resources removed from the configuration should be stopped (via
85
* stop-orphan-resources property)
86
*/
87
pcmk__sched_stop_removed_resources
= (1ULL << 8),
88
89
/*
90
* Whether recurring actions removed from the configuration should be
91
* cancelled (via stop-orphan-actions property)
92
*/
93
pcmk__sched_cancel_removed_actions
= (1ULL << 9),
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
99
pcmk__sched_processing_warning
= (1ULL << 11),
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
*/
106
pcmk__sched_start_failure_fatal
= (1ULL << 12),
107
108
// Whether unseen nodes should be fenced (via startup-fencing property)
109
pcmk__sched_startup_fencing
= (1ULL << 14),
110
111
/*
112
* Whether resources should be left stopped when their node shuts down
113
* cleanly (via shutdown-lock property)
114
*/
115
pcmk__sched_shutdown_lock
= (1ULL << 15),
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
*/
121
pcmk__sched_probe_resources
= (1ULL << 16),
122
123
// Whether the CIB status section has been parsed yet
124
pcmk__sched_have_status
= (1ULL << 17),
125
126
// Whether the cluster includes any Pacemaker Remote nodes (via CIB)
127
pcmk__sched_have_remote_nodes
= (1ULL << 18),
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
*/
137
pcmk__sched_location_only
= (1ULL << 20),
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
146
pcmk__sched_output_scores
= (1ULL << 25),
147
148
// Whether to show node and resource utilization (in log or output)
149
pcmk__sched_show_utilization
= (1ULL << 26),
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
*/
156
pcmk__sched_validate_only
= (1ULL << 27),
157
};
158
159
// Implementation of pcmk__scheduler_private_t
160
struct
pcmk__scheduler_private
{
161
// Be careful about when each piece of information is available and final
162
163
char
*
local_node_name
;
// Name of node running scheduler (if known)
164
crm_time_t
*
now
;
// Time to use when evaluating rules
165
pcmk__output_t
*
out
;
// Output object for displaying messages
166
GHashTable *
options
;
// Cluster options
167
const
char
*
fence_action
;
// Default fencing action
168
guint
fence_timeout_ms
;
// Default fencing action timeout (in ms)
169
guint
priority_fencing_ms
;
// Priority-based fencing delay (in ms)
170
guint
shutdown_lock_ms
;
// How long to lock resources (in ms)
171
guint
node_pending_ms
;
// Pending join times out after this (in ms)
172
const
char
*
placement_strategy
;
// Value of placement-strategy property
173
xmlNode *
rsc_defaults
;
// Configured resource defaults
174
xmlNode *
op_defaults
;
// Configured operation defaults
175
GList *
resources
;
// Resources in cluster
176
GHashTable *
templates
;
// Key = template ID, value = resource list
177
GHashTable *
tags
;
// Key = tag ID, value = element list
178
GList *
actions
;
// All scheduled actions
179
GHashTable *
singletons
;
// Scheduled non-resource actions
180
int
next_action_id
;
// Counter used as ID for actions
181
xmlNode *
failed
;
// History entries of failed actions
182
GList *
param_check
;
// History entries that need to be checked
183
GList *
stop_needed
;
// Containers that need stop actions
184
GList *
location_constraints
;
// Location constraints
185
GList *
colocation_constraints
;
// Colocation constraints
186
GList *
ordering_constraints
;
// Ordering constraints
187
GHashTable *
ticket_constraints
;
// Key = ticket ID, value = pcmk__ticket_t
188
int
next_ordering_id
;
// Counter used as ID for orderings
189
int
ninstances
;
// Total number of resource instances
190
int
blocked_resources
;
// Number of blocked resources in cluster
191
int
disabled_resources
;
// Number of disabled resources in cluster
192
time_t
recheck_by
;
// Hint to controller when to reschedule
193
xmlNode *
graph
;
// Transition graph
194
int
synapse_count
;
// Number of transition graph synapses
195
};
196
197
// Group of enum pcmk__warnings flags for warnings we want to log once
198
extern
uint32_t
pcmk__warnings
;
199
207
#define pcmk__rsc_info(rsc, fmt, args...) \
208
crm_log_tag(LOG_INFO, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
209
217
#define pcmk__rsc_debug(rsc, fmt, args...) \
218
crm_log_tag(LOG_DEBUG, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
219
227
#define pcmk__rsc_trace(rsc, fmt, args...) \
228
crm_log_tag(LOG_TRACE, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
229
237
#define pcmk__sched_err(scheduler, fmt...) do { \
238
pcmk__set_scheduler_flags((scheduler), \
239
pcmk__sched_processing_error); \
240
crm_err(fmt); \
241
} while (0)
242
250
#define pcmk__sched_warn(scheduler, fmt...) do { \
251
pcmk__set_scheduler_flags((scheduler), \
252
pcmk__sched_processing_warning); \
253
crm_warn(fmt); \
254
} while (0)
255
263
#define pcmk__set_scheduler_flags(scheduler, flags_to_set) do { \
264
(scheduler)->flags = pcmk__set_flags_as(__func__, __LINE__, \
265
LOG_TRACE, "Scheduler", crm_system_name, \
266
(scheduler)->flags, (flags_to_set), #flags_to_set); \
267
} while (0)
268
276
#define pcmk__clear_scheduler_flags(scheduler, flags_to_clear) do { \
277
(scheduler)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
278
LOG_TRACE, "Scheduler", crm_system_name, \
279
(scheduler)->flags, (flags_to_clear), #flags_to_clear); \
280
} while (0)
281
282
#ifdef __cplusplus
283
}
284
#endif
285
286
#endif // PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
rules_internal.h
pcmk__scheduler_private::out
pcmk__output_t * out
Definition:
scheduler_internal.h:165
pcmk__sched_concurrent_fencing
Definition:
scheduler_internal.h:81
digest_internal.h
pcmk__scheduler_private::stop_needed
GList * stop_needed
Definition:
scheduler_internal.h:183
pcmk__sched_output_scores
Definition:
scheduler_internal.h:146
pcmk__sched_shutdown_lock
Definition:
scheduler_internal.h:115
clone_internal.h
pcmk__sched_fencing_enabled
Definition:
scheduler_internal.h:68
crm_time_t
struct crm_time_s crm_time_t
Definition:
iso8601.h:32
pcmk__scheduler_private::options
GHashTable * options
Definition:
scheduler_internal.h:166
resources_internal.h
pcmk__scheduler_private
Definition:
scheduler_internal.h:160
pcmk__sched_cancel_removed_actions
Definition:
scheduler_internal.h:93
pcmk__scheduler_private::now
crm_time_t * now
Definition:
scheduler_internal.h:164
pcmk__scheduler_private::location_constraints
GList * location_constraints
Definition:
scheduler_internal.h:184
pcmk__scheduler_private::ticket_constraints
GHashTable * ticket_constraints
Definition:
scheduler_internal.h:187
group_internal.h
pcmk__check_active
Definition:
scheduler_internal.h:44
pcmk__scheduler_flags
pcmk__scheduler_flags
Definition:
scheduler_internal.h:48
pcmk__scheduler_private::failed
xmlNode * failed
Definition:
scheduler_internal.h:181
pcmk__sched_stop_removed_resources
Definition:
scheduler_internal.h:87
pcmk__scheduler_private::next_action_id
int next_action_id
Definition:
scheduler_internal.h:180
pcmk__scheduler_private::ordering_constraints
GList * ordering_constraints
Definition:
scheduler_internal.h:186
nodes_internal.h
pcmk__sched_have_status
Definition:
scheduler_internal.h:124
pcmk__scheduler_private::graph
xmlNode * graph
Definition:
scheduler_internal.h:193
pcmk__sched_in_maintenance
Definition:
scheduler_internal.h:65
pcmk__sched_sanitized
Definition:
scheduler_internal.h:140
pcmk__sched_symmetric_cluster
Definition:
scheduler_internal.h:59
pcmk__scheduler_private::synapse_count
int synapse_count
Definition:
scheduler_internal.h:194
pcmk__scheduler_private::next_ordering_id
int next_ordering_id
Definition:
scheduler_internal.h:188
pcmk__scheduler_private::blocked_resources
int blocked_resources
Definition:
scheduler_internal.h:190
location_internal.h
pcmk__scheduler_private::node_pending_ms
guint node_pending_ms
Definition:
scheduler_internal.h:171
pcmk__scheduler_private::colocation_constraints
GList * colocation_constraints
Definition:
scheduler_internal.h:185
pcmk__scheduler_private::fence_timeout_ms
guint fence_timeout_ms
Definition:
scheduler_internal.h:168
pcmk__scheduler_private::tags
GHashTable * tags
Definition:
scheduler_internal.h:177
pcmk__scheduler_private::shutdown_lock_ms
guint shutdown_lock_ms
Definition:
scheduler_internal.h:170
pcmk__sched_have_remote_nodes
Definition:
scheduler_internal.h:127
primitive_internal.h
pcmk__sched_no_counts
Definition:
scheduler_internal.h:143
pcmk__scheduler_private::local_node_name
char * local_node_name
Definition:
scheduler_internal.h:163
pcmk__scheduler_private::param_check
GList * param_check
Definition:
scheduler_internal.h:182
pcmk__scheduler_private::fence_action
const char * fence_action
Definition:
scheduler_internal.h:167
pcmk__sched_probe_resources
Definition:
scheduler_internal.h:121
pcmk__scheduler_private::templates
GHashTable * templates
Definition:
scheduler_internal.h:176
pcmk__scheduler_private::rsc_defaults
xmlNode * rsc_defaults
Definition:
scheduler_internal.h:173
pcmk__sched_enable_unfencing
Definition:
scheduler_internal.h:78
pcmk__sched_processing_warning
Definition:
scheduler_internal.h:99
actions_internal.h
failcounts_internal.h
pcmk__check_parameters
pcmk__check_parameters
Definition:
scheduler_internal.h:35
pcmk__scheduler_private::singletons
GHashTable * singletons
Definition:
scheduler_internal.h:179
pcmk__sched_processing_error
Definition:
scheduler_internal.h:62
pcmk__scheduler_private::resources
GList * resources
Definition:
scheduler_internal.h:175
pcmk__sched_none
Definition:
scheduler_internal.h:50
pcmk__sched_location_only
Definition:
scheduler_internal.h:137
roles_internal.h
pcmk__sched_startup_fencing
Definition:
scheduler_internal.h:109
pcmk__scheduler_private::recheck_by
time_t recheck_by
Definition:
scheduler_internal.h:192
pcmk__scheduler_private::placement_strategy
const char * placement_strategy
Definition:
scheduler_internal.h:172
pcmk__output_s
This structure contains everything that makes up a single output formatter.
Definition:
output_internal.h:167
pcmk__sched_show_utilization
Definition:
scheduler_internal.h:149
pcmk__sched_quorate
Definition:
scheduler_internal.h:56
pcmk__sched_stop_all
Definition:
scheduler_internal.h:96
pcmk__scheduler_private::disabled_resources
int disabled_resources
Definition:
scheduler_internal.h:191
pcmk__warnings
uint32_t pcmk__warnings
Definition:
scheduler.c:19
pcmk__scheduler_private::op_defaults
xmlNode * op_defaults
Definition:
scheduler_internal.h:174
bundles_internal.h
pcmk__sched_have_fencing
Definition:
scheduler_internal.h:75
pcmk__scheduler_private::actions
GList * actions
Definition:
scheduler_internal.h:178
action_relation_internal.h
tickets_internal.h
Scheduler API for tickets.
pcmk__check_last_failure
Definition:
scheduler_internal.h:39
pcmk__sched_start_failure_fatal
Definition:
scheduler_internal.h:106
attrs_internal.h
remote_internal.h
pcmk__scheduler_private::ninstances
int ninstances
Definition:
scheduler_internal.h:189
pcmk__sched_validate_only
Definition:
scheduler_internal.h:156
pcmk__scheduler_private::priority_fencing_ms
guint priority_fencing_ms
Definition:
scheduler_internal.h:169
history_internal.h
Generated on Wed Jan 8 2025 16:55:39 for pacemaker by
1.8.14