1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_PENGINE_PE_TYPES__H
11 # define PCMK__CRM_PENGINE_PE_TYPES__H
12
13
14 # include <stdbool.h>
15 # include <sys/types.h>
16 # include <libxml/tree.h>
17 # include <glib.h>
18 # include <crm/common/iso8601.h>
19 # include <crm/pengine/common.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25
26
27
28
29
30
31 typedef struct pe_node_s pe_node_t;
32 typedef struct pe_action_s pe_action_t;
33 typedef struct pe_resource_s pe_resource_t;
34 typedef struct pe_working_set_s pe_working_set_t;
35
36 enum pe_obj_types {
37 pe_unknown = -1,
38 pe_native = 0,
39 pe_group = 1,
40 pe_clone = 2,
41 pe_container = 3,
42 };
43
44 typedef struct resource_object_functions_s {
45 gboolean (*unpack) (pe_resource_t*, pe_working_set_t*);
46 pe_resource_t *(*find_rsc) (pe_resource_t *parent, const char *search,
47 const pe_node_t *node, int flags);
48
49 char *(*parameter) (pe_resource_t*, pe_node_t*, gboolean, const char*,
50 pe_working_set_t*);
51
52 void (*print) (pe_resource_t*, const char*, long, void*);
53 gboolean (*active) (pe_resource_t*, gboolean);
54 enum rsc_role_e (*state) (const pe_resource_t*, gboolean);
55 pe_node_t *(*location) (const pe_resource_t*, GList**, int);
56 void (*free) (pe_resource_t*);
57 void (*count) (pe_resource_t*);
58 gboolean (*is_filtered) (pe_resource_t*, GList *, gboolean);
59 } resource_object_functions_t;
60
61 typedef struct resource_alloc_functions_s resource_alloc_functions_t;
62
63 enum pe_quorum_policy {
64 no_quorum_freeze,
65 no_quorum_stop,
66 no_quorum_ignore,
67 no_quorum_suicide,
68 no_quorum_demote
69 };
70
71 enum node_type {
72 node_ping,
73 node_member,
74 node_remote
75 };
76
77
78 enum pe_restart {
79 pe_restart_restart,
80 pe_restart_ignore
81 };
82
83
84 enum pe_find {
85 pe_find_renamed = 0x001,
86 pe_find_anon = 0x002,
87 pe_find_clone = 0x004,
88 pe_find_current = 0x008,
89 pe_find_inactive = 0x010,
90 pe_find_any = 0x020,
91 };
92
93
94
95 # define pe_flag_have_quorum 0x00000001ULL
96 # define pe_flag_symmetric_cluster 0x00000002ULL
97 # define pe_flag_maintenance_mode 0x00000008ULL
98
99 # define pe_flag_stonith_enabled 0x00000010ULL
100 # define pe_flag_have_stonith_resource 0x00000020ULL
101 # define pe_flag_enable_unfencing 0x00000040ULL
102 # define pe_flag_concurrent_fencing 0x00000080ULL
103
104 # define pe_flag_stop_rsc_orphans 0x00000100ULL
105 # define pe_flag_stop_action_orphans 0x00000200ULL
106 # define pe_flag_stop_everything 0x00000400ULL
107
108 # define pe_flag_start_failure_fatal 0x00001000ULL
109
110
111 # define pe_flag_remove_after_stop 0x00002000ULL
112
113 # define pe_flag_startup_fencing 0x00004000ULL
114 # define pe_flag_shutdown_lock 0x00008000ULL
115
116 # define pe_flag_startup_probes 0x00010000ULL
117 # define pe_flag_have_status 0x00020000ULL
118 # define pe_flag_have_remote_nodes 0x00040000ULL
119
120 # define pe_flag_quick_location 0x00100000ULL
121 # define pe_flag_sanitized 0x00200000ULL
122
123
124 # define pe_flag_stdout 0x00400000ULL
125
126
127 # define pe_flag_no_counts 0x00800000ULL
128
129
130
131
132 # define pe_flag_no_compat 0x01000000ULL
133
134 # define pe_flag_show_scores 0x02000000ULL
135 # define pe_flag_show_utilization 0x04000000ULL
136
137
138
139
140
141 # define pe_flag_check_config 0x08000000ULL
142
143 struct pe_working_set_s {
144 xmlNode *input;
145 crm_time_t *now;
146
147
148 char *dc_uuid;
149 pe_node_t *dc_node;
150 const char *stonith_action;
151 const char *placement_strategy;
152
153 unsigned long long flags;
154
155 int stonith_timeout;
156 enum pe_quorum_policy no_quorum_policy;
157
158 GHashTable *config_hash;
159 GHashTable *tickets;
160
161
162 GHashTable *singletons;
163
164 GList *nodes;
165 GList *resources;
166 GList *placement_constraints;
167 GList *ordering_constraints;
168 GList *colocation_constraints;
169 GList *ticket_constraints;
170
171 GList *actions;
172 xmlNode *failed;
173 xmlNode *op_defaults;
174 xmlNode *rsc_defaults;
175
176
177 int num_synapse;
178 int max_valid_nodes;
179 int order_id;
180 int action_id;
181
182
183 xmlNode *graph;
184
185 GHashTable *template_rsc_sets;
186 const char *localhost;
187 GHashTable *tags;
188
189 int blocked_resources;
190 int disabled_resources;
191
192 GList *param_check;
193 GList *stop_needed;
194 time_t recheck_by;
195 int ninstances;
196 guint shutdown_lock;
197 int priority_fencing_delay;
198
199 void *priv;
200 };
201
202 enum pe_check_parameters {
203
204
205
206 pe_check_last_failure,
207
208
209
210
211 pe_check_active,
212 };
213
214 struct pe_node_shared_s {
215 const char *id;
216 const char *uname;
217 enum node_type type;
218
219
220 gboolean online;
221 gboolean standby;
222 gboolean standby_onfail;
223 gboolean pending;
224 gboolean unclean;
225 gboolean unseen;
226 gboolean shutdown;
227 gboolean expected_up;
228 gboolean is_dc;
229 gboolean maintenance;
230 gboolean rsc_discovery_enabled;
231 gboolean remote_requires_reset;
232 gboolean remote_was_fenced;
233 gboolean remote_maintenance;
234 gboolean unpacked;
235
236 int num_resources;
237 pe_resource_t *remote_rsc;
238 GList *running_rsc;
239 GList *allocated_rsc;
240
241 GHashTable *attrs;
242 GHashTable *utilization;
243 GHashTable *digest_cache;
244 int priority;
245 pe_working_set_t *data_set;
246 };
247
248 struct pe_node_s {
249 int weight;
250 gboolean fixed;
251 int count;
252 struct pe_node_shared_s *details;
253 int rsc_discover_mode;
254 };
255
256 # define pe_rsc_orphan 0x00000001ULL
257 # define pe_rsc_managed 0x00000002ULL
258 # define pe_rsc_block 0x00000004ULL
259 # define pe_rsc_orphan_container_filler 0x00000008ULL
260
261 # define pe_rsc_notify 0x00000010ULL
262 # define pe_rsc_unique 0x00000020ULL
263 # define pe_rsc_fence_device 0x00000040ULL
264 # define pe_rsc_promotable 0x00000080ULL
265
266 # define pe_rsc_provisional 0x00000100ULL
267 # define pe_rsc_allocating 0x00000200ULL
268 # define pe_rsc_merging 0x00000400ULL
269 # define pe_rsc_restarting 0x00000800ULL
270
271 # define pe_rsc_stop 0x00001000ULL
272 # define pe_rsc_reload 0x00002000ULL
273 # define pe_rsc_allow_remote_remotes 0x00004000ULL
274 # define pe_rsc_critical 0x00008000ULL
275
276 # define pe_rsc_failed 0x00010000ULL
277 # define pe_rsc_runnable 0x00040000ULL
278 # define pe_rsc_start_pending 0x00080000ULL
279
280
281 # define pe_rsc_starting 0x00100000ULL
282
283
284 # define pe_rsc_stopping 0x00200000ULL
285
286 # define pe_rsc_stop_unexpected 0x00400000ULL
287 # define pe_rsc_allow_migrate 0x00800000ULL
288
289 # define pe_rsc_failure_ignored 0x01000000ULL
290 # define pe_rsc_maintenance 0x04000000ULL
291 # define pe_rsc_is_container 0x08000000ULL
292
293 # define pe_rsc_needs_quorum 0x10000000ULL
294 # define pe_rsc_needs_fencing 0x20000000ULL
295 # define pe_rsc_needs_unfencing 0x40000000ULL
296
297
298 enum pe_action_flags {
299 pe_action_pseudo = 0x00001,
300 pe_action_runnable = 0x00002,
301 pe_action_optional = 0x00004,
302 pe_action_print_always = 0x00008,
303
304 pe_action_have_node_attrs = 0x00010,
305 pe_action_implied_by_stonith = 0x00040,
306 pe_action_migrate_runnable = 0x00080,
307
308 pe_action_dumped = 0x00100,
309 pe_action_processed = 0x00200,
310 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
311 pe_action_clear = 0x00400,
312 #endif
313 pe_action_dangle = 0x00800,
314
315
316
317
318 pe_action_requires_any = 0x01000,
319
320 pe_action_reschedule = 0x02000,
321 pe_action_tracking = 0x04000,
322 pe_action_dedup = 0x08000,
323
324 pe_action_dc = 0x10000,
325 };
326
327
328 struct pe_resource_s {
329 char *id;
330 char *clone_name;
331 xmlNode *xml;
332 xmlNode *orig_xml;
333 xmlNode *ops_xml;
334
335 pe_working_set_t *cluster;
336 pe_resource_t *parent;
337
338 enum pe_obj_types variant;
339 void *variant_opaque;
340 resource_object_functions_t *fns;
341 resource_alloc_functions_t *cmds;
342
343 enum rsc_recovery_type recovery_type;
344
345 enum pe_restart restart_type;
346
347 int priority;
348 int stickiness;
349 int sort_index;
350 int failure_timeout;
351 int migration_threshold;
352 guint remote_reconnect_ms;
353 char *pending_task;
354
355 unsigned long long flags;
356
357
358 gboolean is_remote_node;
359 gboolean exclusive_discover;
360
361
362
363 GList *rsc_cons_lhs;
364 GList *rsc_cons;
365 GList *rsc_location;
366 GList *actions;
367 GList *rsc_tickets;
368
369
370 pe_node_t *allocated_to;
371 pe_node_t *partial_migration_target;
372 pe_node_t *partial_migration_source;
373 GList *running_on;
374 GHashTable *known_on;
375 GHashTable *allowed_nodes;
376
377 enum rsc_role_e role;
378 enum rsc_role_e next_role;
379
380 GHashTable *meta;
381 GHashTable *parameters;
382 GHashTable *utilization;
383
384 GList *children;
385 GList *dangling_migrations;
386
387 pe_resource_t *container;
388 GList *fillers;
389
390 pe_node_t *pending_node;
391 pe_node_t *lock_node;
392 time_t lock_time;
393
394
395
396
397
398
399 GHashTable *parameter_cache;
400 };
401
402 struct pe_action_s {
403 int id;
404 int priority;
405
406 pe_resource_t *rsc;
407 pe_node_t *node;
408 xmlNode *op_entry;
409
410 char *task;
411 char *uuid;
412 char *cancel_task;
413 char *reason;
414
415 enum pe_action_flags flags;
416 enum rsc_start_requirement needs;
417 enum action_fail_response on_fail;
418 enum rsc_role_e fail_role;
419
420 GHashTable *meta;
421 GHashTable *extra;
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438 int runnable_before;
439
440
441 int required_runnable_before;
442
443 GList *actions_before;
444 GList *actions_after;
445
446
447
448
449 void *action_details;
450 };
451
452 typedef struct pe_ticket_s {
453 char *id;
454 gboolean granted;
455 time_t last_granted;
456 gboolean standby;
457 GHashTable *state;
458 } pe_ticket_t;
459
460 typedef struct pe_tag_s {
461 char *id;
462 GList *refs;
463 } pe_tag_t;
464
465
466 enum pe_link_state {
467 pe_link_not_dumped,
468 pe_link_dumped,
469 pe_link_dup,
470 };
471
472 enum pe_discover_e {
473 pe_discover_always = 0,
474 pe_discover_never,
475 pe_discover_exclusive,
476 };
477
478
479 enum pe_ordering {
480 pe_order_none = 0x0,
481 pe_order_optional = 0x1,
482 pe_order_apply_first_non_migratable = 0x2,
483
484 pe_order_implies_first = 0x10,
485 pe_order_implies_then = 0x20,
486 pe_order_promoted_implies_first = 0x40,
487
488
489 pe_order_implies_first_migratable = 0x80,
490
491 pe_order_runnable_left = 0x100,
492
493 pe_order_pseudo_left = 0x200,
494 pe_order_implies_then_on_node = 0x400,
495
496
497
498 pe_order_probe = 0x800,
499
500
501
502
503 pe_order_restart = 0x1000,
504 pe_order_stonith_stop = 0x2000,
505 pe_order_serialize_only = 0x4000,
506 pe_order_same_node = 0x8000,
507
508 pe_order_implies_first_printed = 0x10000,
509 pe_order_implies_then_printed = 0x20000,
510
511 pe_order_asymmetrical = 0x100000,
512 pe_order_load = 0x200000,
513 pe_order_one_or_more = 0x400000,
514 pe_order_anti_colocation = 0x800000,
515
516 pe_order_preserve = 0x1000000,
517 pe_order_then_cancels_first = 0x2000000,
518 pe_order_trace = 0x4000000,
519
520 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
521
522 pe_order_implies_first_master = pe_order_promoted_implies_first,
523 #endif
524 };
525
526
527 typedef struct pe_action_wrapper_s {
528 enum pe_ordering type;
529 enum pe_link_state state;
530 pe_action_t *action;
531 } pe_action_wrapper_t;
532
533 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
534 #include <crm/pengine/pe_types_compat.h>
535 #endif
536
537 #ifdef __cplusplus
538 }
539 #endif
540
541 #endif