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