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