This source file includes following definitions.
- pe__rsc_bool_str
- pe__current_node
- pe_hash_table_lookup
- pe_base_name_eq
- pe__health_strategy
- pe__health_score
- pe__node_name
- pe__same_node
- pe__xe_history_key
1
2
3
4
5
6
7
8
9
10 #ifndef PE_INTERNAL__H
11 # define PE_INTERNAL__H
12
13 # include <stdint.h>
14 # include <string.h>
15 # include <crm/msg_xml.h>
16 # include <crm/pengine/status.h>
17 # include <crm/pengine/remote_internal.h>
18 # include <crm/common/internal.h>
19 # include <crm/common/options_internal.h>
20 # include <crm/common/output_internal.h>
21
22 const char *pe__resource_description(const pe_resource_t *rsc, uint32_t show_opts);
23
24 enum pe__clone_flags {
25
26 pe__clone_ordered = (1 << 0),
27
28
29 pe__clone_promotion_added = (1 << 1),
30
31
32 pe__clone_promotion_constrained = (1 << 2),
33 };
34
35 bool pe__clone_is_ordered(const pe_resource_t *clone);
36 int pe__set_clone_flag(pe_resource_t *clone, enum pe__clone_flags flag);
37
38
39 enum pe__group_flags {
40 pe__group_ordered = (1 << 0),
41 pe__group_colocated = (1 << 1),
42 };
43
44 bool pe__group_flag_is_set(const pe_resource_t *group, uint32_t flags);
45 pe_resource_t *pe__last_group_member(const pe_resource_t *group);
46
47
48 # define pe_rsc_info(rsc, fmt, args...) crm_log_tag(LOG_INFO, rsc ? rsc->id : "<NULL>", fmt, ##args)
49 # define pe_rsc_debug(rsc, fmt, args...) crm_log_tag(LOG_DEBUG, rsc ? rsc->id : "<NULL>", fmt, ##args)
50 # define pe_rsc_trace(rsc, fmt, args...) crm_log_tag(LOG_TRACE, rsc ? rsc->id : "<NULL>", fmt, ##args)
51
52 # define pe_err(fmt...) do { \
53 was_processing_error = TRUE; \
54 pcmk__config_err(fmt); \
55 } while (0)
56
57 # define pe_warn(fmt...) do { \
58 was_processing_warning = TRUE; \
59 pcmk__config_warn(fmt); \
60 } while (0)
61
62 # define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); }
63 # define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); }
64
65 #define pe__set_working_set_flags(working_set, flags_to_set) do { \
66 (working_set)->flags = pcmk__set_flags_as(__func__, __LINE__, \
67 LOG_TRACE, "Working set", crm_system_name, \
68 (working_set)->flags, (flags_to_set), #flags_to_set); \
69 } while (0)
70
71 #define pe__clear_working_set_flags(working_set, flags_to_clear) do { \
72 (working_set)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
73 LOG_TRACE, "Working set", crm_system_name, \
74 (working_set)->flags, (flags_to_clear), #flags_to_clear); \
75 } while (0)
76
77 #define pe__set_resource_flags(resource, flags_to_set) do { \
78 (resource)->flags = pcmk__set_flags_as(__func__, __LINE__, \
79 LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
80 (flags_to_set), #flags_to_set); \
81 } while (0)
82
83 #define pe__clear_resource_flags(resource, flags_to_clear) do { \
84 (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
85 LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
86 (flags_to_clear), #flags_to_clear); \
87 } while (0)
88
89 #define pe__set_action_flags(action, flags_to_set) do { \
90 (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
91 LOG_TRACE, \
92 "Action", (action)->uuid, \
93 (action)->flags, \
94 (flags_to_set), \
95 #flags_to_set); \
96 } while (0)
97
98 #define pe__clear_action_flags(action, flags_to_clear) do { \
99 (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
100 LOG_TRACE, \
101 "Action", (action)->uuid, \
102 (action)->flags, \
103 (flags_to_clear), \
104 #flags_to_clear); \
105 } while (0)
106
107 #define pe__set_raw_action_flags(action_flags, action_name, flags_to_set) do { \
108 action_flags = pcmk__set_flags_as(__func__, __LINE__, \
109 LOG_TRACE, "Action", action_name, \
110 (action_flags), \
111 (flags_to_set), #flags_to_set); \
112 } while (0)
113
114 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
115 action_flags = pcmk__clear_flags_as(__func__, __LINE__, \
116 LOG_TRACE, \
117 "Action", action_name, \
118 (action_flags), \
119 (flags_to_clear), \
120 #flags_to_clear); \
121 } while (0)
122
123 #define pe__set_action_flags_as(function, line, action, flags_to_set) do { \
124 (action)->flags = pcmk__set_flags_as((function), (line), \
125 LOG_TRACE, \
126 "Action", (action)->uuid, \
127 (action)->flags, \
128 (flags_to_set), \
129 #flags_to_set); \
130 } while (0)
131
132 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
133 (action)->flags = pcmk__clear_flags_as((function), (line), \
134 LOG_TRACE, \
135 "Action", (action)->uuid, \
136 (action)->flags, \
137 (flags_to_clear), \
138 #flags_to_clear); \
139 } while (0)
140
141 #define pe__set_order_flags(order_flags, flags_to_set) do { \
142 order_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
143 "Ordering", "constraint", \
144 order_flags, (flags_to_set), \
145 #flags_to_set); \
146 } while (0)
147
148 #define pe__clear_order_flags(order_flags, flags_to_clear) do { \
149 order_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
150 "Ordering", "constraint", \
151 order_flags, (flags_to_clear), \
152 #flags_to_clear); \
153 } while (0)
154
155
156
157 enum pe_warn_once_e {
158 pe_wo_blind = (1 << 0),
159 pe_wo_restart_type = (1 << 1),
160 pe_wo_role_after = (1 << 2),
161 pe_wo_poweroff = (1 << 3),
162 pe_wo_require_all = (1 << 4),
163 pe_wo_order_score = (1 << 5),
164 pe_wo_neg_threshold = (1 << 6),
165 pe_wo_remove_after = (1 << 7),
166 pe_wo_ping_node = (1 << 8),
167 pe_wo_order_inst = (1 << 9),
168 pe_wo_coloc_inst = (1 << 10),
169 pe_wo_group_order = (1 << 11),
170 pe_wo_group_coloc = (1 << 12),
171 pe_wo_upstart = (1 << 13),
172 pe_wo_nagios = (1 << 14),
173 };
174
175 extern uint32_t pe_wo;
176
177 #define pe_warn_once(pe_wo_bit, fmt...) do { \
178 if (!pcmk_is_set(pe_wo, pe_wo_bit)) { \
179 if (pe_wo_bit == pe_wo_blind) { \
180 crm_warn(fmt); \
181 } else { \
182 pe_warn(fmt); \
183 } \
184 pe_wo = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
185 "Warn-once", "logging", pe_wo, \
186 (pe_wo_bit), #pe_wo_bit); \
187 } \
188 } while (0);
189
190
191 typedef struct pe__location_constraint_s {
192 char *id;
193 pe_resource_t *rsc_lh;
194 enum rsc_role_e role_filter;
195 enum pe_discover_e discover_mode;
196 GList *node_list_rh;
197 } pe__location_t;
198
199 typedef struct pe__order_constraint_s {
200 int id;
201 uint32_t flags;
202
203 void *lh_opaque;
204 pe_resource_t *lh_rsc;
205 pe_action_t *lh_action;
206 char *lh_action_task;
207
208 void *rh_opaque;
209 pe_resource_t *rh_rsc;
210 pe_action_t *rh_action;
211 char *rh_action_task;
212 } pe__ordering_t;
213
214 const pe_resource_t *pe__const_top_resource(const pe_resource_t *rsc,
215 bool include_bundle);
216
217 int pe__clone_max(const pe_resource_t *clone);
218 int pe__clone_node_max(const pe_resource_t *clone);
219 int pe__clone_promoted_max(const pe_resource_t *clone);
220 int pe__clone_promoted_node_max(const pe_resource_t *clone);
221 void pe__create_clone_notifications(pe_resource_t *clone);
222 void pe__free_clone_notification_data(pe_resource_t *clone);
223 void pe__create_clone_notif_pseudo_ops(pe_resource_t *clone,
224 pe_action_t *start, pe_action_t *started,
225 pe_action_t *stop, pe_action_t *stopped);
226
227
228 pe_action_t *pe__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task,
229 bool optional, bool runnable);
230
231 void pe__create_promotable_pseudo_ops(pe_resource_t *clone, bool any_promoting,
232 bool any_demoting);
233
234 bool pe_can_fence(const pe_working_set_t *data_set, const pe_node_t *node);
235
236 void add_hash_param(GHashTable * hash, const char *name, const char *value);
237
238 char *native_parameter(pe_resource_t * rsc, pe_node_t * node, gboolean create, const char *name,
239 pe_working_set_t * data_set);
240 pe_node_t *native_location(const pe_resource_t *rsc, GList **list, int current);
241
242 void pe_metadata(pcmk__output_t *out);
243 void verify_pe_options(GHashTable * options);
244
245 void native_add_running(pe_resource_t * rsc, pe_node_t * node, pe_working_set_t * data_set, gboolean failed);
246
247 gboolean native_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
248 gboolean group_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
249 gboolean clone_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
250 gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set);
251
252 pe_resource_t *native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node,
253 int flags);
254
255 gboolean native_active(pe_resource_t * rsc, gboolean all);
256 gboolean group_active(pe_resource_t * rsc, gboolean all);
257 gboolean clone_active(pe_resource_t * rsc, gboolean all);
258 gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all);
259
260
261 void native_print(pe_resource_t *rsc, const char *pre_text, long options,
262 void *print_data);
263
264
265 void group_print(pe_resource_t *rsc, const char *pre_text, long options,
266 void *print_data);
267
268
269 void clone_print(pe_resource_t *rsc, const char *pre_text, long options,
270 void *print_data);
271
272
273 void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
274 void *print_data);
275
276 gchar *pcmk__native_output_string(const pe_resource_t *rsc, const char *name,
277 const pe_node_t *node, uint32_t show_opts,
278 const char *target_role, bool show_nodes);
279
280 int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
281 , size_t pairs_count, ...);
282 char *pe__node_display_name(pe_node_t *node, bool print_detail);
283
284
285
286 void pe__order_notifs_after_fencing(const pe_action_t *action,
287 pe_resource_t *rsc,
288 pe_action_t *stonith_op);
289
290
291 static inline const char *
292 pe__rsc_bool_str(const pe_resource_t *rsc, uint64_t rsc_flag)
293 {
294 return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
295 }
296
297 int pe__clone_xml(pcmk__output_t *out, va_list args);
298 int pe__clone_default(pcmk__output_t *out, va_list args);
299 int pe__group_xml(pcmk__output_t *out, va_list args);
300 int pe__group_default(pcmk__output_t *out, va_list args);
301 int pe__bundle_xml(pcmk__output_t *out, va_list args);
302 int pe__bundle_html(pcmk__output_t *out, va_list args);
303 int pe__bundle_text(pcmk__output_t *out, va_list args);
304 int pe__node_html(pcmk__output_t *out, va_list args);
305 int pe__node_text(pcmk__output_t *out, va_list args);
306 int pe__node_xml(pcmk__output_t *out, va_list args);
307 int pe__resource_xml(pcmk__output_t *out, va_list args);
308 int pe__resource_html(pcmk__output_t *out, va_list args);
309 int pe__resource_text(pcmk__output_t *out, va_list args);
310
311 void native_free(pe_resource_t * rsc);
312 void group_free(pe_resource_t * rsc);
313 void clone_free(pe_resource_t * rsc);
314 void pe__free_bundle(pe_resource_t *rsc);
315
316 enum rsc_role_e native_resource_state(const pe_resource_t * rsc, gboolean current);
317 enum rsc_role_e group_resource_state(const pe_resource_t * rsc, gboolean current);
318 enum rsc_role_e clone_resource_state(const pe_resource_t * rsc, gboolean current);
319 enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc,
320 gboolean current);
321
322 void pe__count_common(pe_resource_t *rsc);
323 void pe__count_bundle(pe_resource_t *rsc);
324
325 void common_free(pe_resource_t * rsc);
326
327 pe_node_t *pe__copy_node(const pe_node_t *this_node);
328 extern time_t get_effective_time(pe_working_set_t * data_set);
329
330
331
332
333 enum pe_fc_flags_e {
334 pe_fc_default = (1 << 0),
335 pe_fc_effective = (1 << 1),
336 pe_fc_fillers = (1 << 2),
337 };
338
339 int pe_get_failcount(const pe_node_t *node, pe_resource_t *rsc,
340 time_t *last_failure, uint32_t flags,
341 const xmlNode *xml_op);
342
343 pe_action_t *pe__clear_failcount(pe_resource_t *rsc, const pe_node_t *node,
344 const char *reason,
345 pe_working_set_t *data_set);
346
347
348
349 bool pe__count_active_node(const pe_resource_t *rsc, pe_node_t *node,
350 pe_node_t **active, unsigned int *count_all,
351 unsigned int *count_clean);
352
353 pe_node_t *pe__find_active_requires(const pe_resource_t *rsc,
354 unsigned int *count);
355
356 static inline pe_node_t *
357 pe__current_node(const pe_resource_t *rsc)
358 {
359 return (rsc == NULL)? NULL : rsc->fns->active_node(rsc, NULL, NULL);
360 }
361
362
363
364 extern void node_list_exclude(GHashTable * list, GList *list2, gboolean merge_scores);
365
366 GHashTable *pe__node_list2table(const GList *list);
367
368 static inline gpointer
369 pe_hash_table_lookup(GHashTable * hash, gconstpointer key)
370 {
371 if (hash) {
372 return g_hash_table_lookup(hash, key);
373 }
374 return NULL;
375 }
376
377 extern pe_action_t *get_pseudo_op(const char *name, pe_working_set_t * data_set);
378 extern gboolean order_actions(pe_action_t * lh_action, pe_action_t * rh_action, enum pe_ordering order);
379
380 void pe__show_node_weights_as(const char *file, const char *function,
381 int line, bool to_log, const pe_resource_t *rsc,
382 const char *comment, GHashTable *nodes,
383 pe_working_set_t *data_set);
384
385 #define pe__show_node_weights(level, rsc, text, nodes, data_set) \
386 pe__show_node_weights_as(__FILE__, __func__, __LINE__, \
387 (level), (rsc), (text), (nodes), (data_set))
388
389 xmlNode *find_rsc_op_entry(const pe_resource_t *rsc, const char *key);
390
391 pe_action_t *custom_action(pe_resource_t *rsc, char *key, const char *task,
392 const pe_node_t *on_node, gboolean optional,
393 gboolean foo, pe_working_set_t *data_set);
394
395 # define delete_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DELETE, 0)
396 # define delete_action(rsc, node, optional) custom_action( \
397 rsc, delete_key(rsc), CRMD_ACTION_DELETE, node, \
398 optional, TRUE, rsc->cluster);
399
400 # define stopped_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOPPED, 0)
401 # define stopped_action(rsc, node, optional) custom_action( \
402 rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node, \
403 optional, TRUE, rsc->cluster);
404
405 # define stop_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOP, 0)
406 # define stop_action(rsc, node, optional) custom_action( \
407 rsc, stop_key(rsc), CRMD_ACTION_STOP, node, \
408 optional, TRUE, rsc->cluster);
409
410 # define reload_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_RELOAD_AGENT, 0)
411 # define start_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_START, 0)
412 # define start_action(rsc, node, optional) custom_action( \
413 rsc, start_key(rsc), CRMD_ACTION_START, node, \
414 optional, TRUE, rsc->cluster)
415
416 # define started_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STARTED, 0)
417 # define started_action(rsc, node, optional) custom_action( \
418 rsc, started_key(rsc), CRMD_ACTION_STARTED, node, \
419 optional, TRUE, rsc->cluster)
420
421 # define promote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTE, 0)
422 # define promote_action(rsc, node, optional) custom_action( \
423 rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node, \
424 optional, TRUE, rsc->cluster)
425
426 # define promoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTED, 0)
427 # define promoted_action(rsc, node, optional) custom_action( \
428 rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node, \
429 optional, TRUE, rsc->cluster)
430
431 # define demote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTE, 0)
432 # define demote_action(rsc, node, optional) custom_action( \
433 rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node, \
434 optional, TRUE, rsc->cluster)
435
436 # define demoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTED, 0)
437 # define demoted_action(rsc, node, optional) custom_action( \
438 rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node, \
439 optional, TRUE, rsc->cluster)
440
441 extern int pe_get_configured_timeout(pe_resource_t *rsc, const char *action,
442 pe_working_set_t *data_set);
443
444 pe_action_t *find_first_action(const GList *input, const char *uuid,
445 const char *task, const pe_node_t *on_node);
446
447 enum action_tasks get_complex_task(const pe_resource_t *rsc, const char *name);
448
449 extern GList *find_actions(GList *input, const char *key, const pe_node_t *on_node);
450 GList *find_actions_exact(GList *input, const char *key,
451 const pe_node_t *on_node);
452 GList *pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node,
453 const char *task, bool require_node);
454
455 extern void pe_free_action(pe_action_t * action);
456
457 void resource_location(pe_resource_t *rsc, const pe_node_t *node, int score,
458 const char *tag, pe_working_set_t *data_set);
459
460 extern int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b,
461 bool same_node_default);
462 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
463 gboolean get_target_role(const pe_resource_t *rsc, enum rsc_role_e *role);
464 void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role,
465 const char *why);
466
467 pe_resource_t *find_clone_instance(const pe_resource_t *rsc,
468 const char *sub_id);
469
470 extern void destroy_ticket(gpointer data);
471 extern pe_ticket_t *ticket_new(const char *ticket_id, pe_working_set_t * data_set);
472
473
474 const char *pe_base_name_end(const char *id);
475 char *clone_strip(const char *last_rsc_id);
476 char *clone_zero(const char *last_rsc_id);
477
478 static inline bool
479 pe_base_name_eq(const pe_resource_t *rsc, const char *id)
480 {
481 if (id && rsc && rsc->id) {
482
483 size_t base_len = pe_base_name_end(rsc->id) - rsc->id + 1;
484
485 return (strlen(id) == base_len) && !strncmp(id, rsc->id, base_len);
486 }
487 return false;
488 }
489
490 int pe__target_rc_from_xml(const xmlNode *xml_op);
491
492 gint pe__cmp_node_name(gconstpointer a, gconstpointer b);
493 bool is_set_recursive(const pe_resource_t *rsc, long long flag, bool any);
494
495 enum rsc_digest_cmp_val {
496
497 RSC_DIGEST_MATCH = 0,
498
499 RSC_DIGEST_RESTART,
500
501 RSC_DIGEST_ALL,
502
503
504 RSC_DIGEST_UNKNOWN,
505 };
506
507 typedef struct op_digest_cache_s {
508 enum rsc_digest_cmp_val rc;
509 xmlNode *params_all;
510 xmlNode *params_secure;
511 xmlNode *params_restart;
512 char *digest_all_calc;
513 char *digest_secure_calc;
514 char *digest_restart_calc;
515 } op_digest_cache_t;
516
517 op_digest_cache_t *pe__calculate_digests(pe_resource_t *rsc, const char *task,
518 guint *interval_ms,
519 const pe_node_t *node,
520 const xmlNode *xml_op,
521 GHashTable *overrides,
522 bool calc_secure,
523 pe_working_set_t *data_set);
524
525 void pe__free_digests(gpointer ptr);
526
527 op_digest_cache_t *rsc_action_digest_cmp(pe_resource_t *rsc,
528 const xmlNode *xml_op,
529 pe_node_t *node,
530 pe_working_set_t *data_set);
531
532 pe_action_t *pe_fence_op(pe_node_t *node, const char *op, bool optional,
533 const char *reason, bool priority_delay,
534 pe_working_set_t *data_set);
535 void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node,
536 const char *reason, pe_action_t *dependency,
537 pe_working_set_t *data_set);
538
539 char *pe__action2reason(const pe_action_t *action, enum pe_action_flags flag);
540 void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite);
541 void pe__add_action_expected_result(pe_action_t *action, int expected_result);
542
543 void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags);
544 void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags);
545 void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag);
546
547 gboolean add_tag_ref(GHashTable * tags, const char * tag_name, const char * obj_ref);
548
549
550 void print_rscs_brief(GList *rsc_list, const char * pre_text, long options,
551 void * print_data, gboolean print_all);
552 int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options);
553 void pe_fence_node(pe_working_set_t * data_set, pe_node_t * node, const char *reason, bool priority_delay);
554
555 pe_node_t *pe_create_node(const char *id, const char *uname, const char *type,
556 const char *score, pe_working_set_t * data_set);
557
558
559 void common_print(pe_resource_t *rsc, const char *pre_text, const char *name,
560 const pe_node_t *node, long options, void *print_data);
561 int pe__common_output_text(pcmk__output_t *out, const pe_resource_t *rsc,
562 const char *name, const pe_node_t *node,
563 unsigned int options);
564 int pe__common_output_html(pcmk__output_t *out, const pe_resource_t *rsc,
565 const char *name, const pe_node_t *node,
566 unsigned int options);
567
568 GList *pe__bundle_containers(const pe_resource_t *bundle);
569
570 int pe__bundle_max(const pe_resource_t *rsc);
571 int pe__bundle_max_per_node(const pe_resource_t *rsc);
572
573 pe_resource_t *pe__find_bundle_replica(const pe_resource_t *bundle,
574 const pe_node_t *node);
575 bool pe__bundle_needs_remote_name(pe_resource_t *rsc);
576 const char *pe__add_bundle_remote_name(pe_resource_t *rsc,
577 pe_working_set_t *data_set,
578 xmlNode *xml, const char *field);
579 const char *pe_node_attribute_calculated(const pe_node_t *node,
580 const char *name,
581 const pe_resource_t *rsc);
582 const char *pe_node_attribute_raw(const pe_node_t *node, const char *name);
583 bool pe__is_universal_clone(const pe_resource_t *rsc,
584 const pe_working_set_t *data_set);
585 void pe__add_param_check(const xmlNode *rsc_op, pe_resource_t *rsc,
586 pe_node_t *node, enum pe_check_parameters,
587 pe_working_set_t *data_set);
588 void pe__foreach_param_check(pe_working_set_t *data_set,
589 void (*cb)(pe_resource_t*, pe_node_t*,
590 const xmlNode*,
591 enum pe_check_parameters));
592 void pe__free_param_checks(pe_working_set_t *data_set);
593
594 bool pe__shutdown_requested(const pe_node_t *node);
595 void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set);
596
597
598
599
600
601
602
603 void pe__register_messages(pcmk__output_t *out);
604
605 void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name,
606 const pe_rule_eval_data_t *rule_data,
607 GHashTable *hash, const char *always_first,
608 gboolean overwrite, pe_working_set_t *data_set);
609
610 bool pe__resource_is_disabled(const pe_resource_t *rsc);
611 pe_action_t *pe__clear_resource_history(pe_resource_t *rsc,
612 const pe_node_t *node,
613 pe_working_set_t *data_set);
614
615 GList *pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name);
616 GList *pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name);
617 bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag);
618 bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag);
619
620 bool pe__rsc_running_on_only(const pe_resource_t *rsc, const pe_node_t *node);
621 bool pe__rsc_running_on_any(pe_resource_t *rsc, GList *node_list);
622 GList *pe__filter_rsc_list(GList *rscs, GList *filter);
623 GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s);
624 GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s);
625
626 bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node);
627
628 gboolean pe__bundle_is_filtered(const pe_resource_t *rsc, GList *only_rsc,
629 gboolean check_parent);
630 gboolean pe__clone_is_filtered(const pe_resource_t *rsc, GList *only_rsc,
631 gboolean check_parent);
632 gboolean pe__group_is_filtered(const pe_resource_t *rsc, GList *only_rsc,
633 gboolean check_parent);
634 gboolean pe__native_is_filtered(const pe_resource_t *rsc, GList *only_rsc,
635 gboolean check_parent);
636
637 xmlNode *pe__failed_probe_for_rsc(const pe_resource_t *rsc, const char *name);
638
639 const char *pe__clone_child_id(const pe_resource_t *rsc);
640
641 int pe__sum_node_health_scores(const pe_node_t *node, int base_health);
642 int pe__node_health(pe_node_t *node);
643
644 static inline enum pcmk__health_strategy
645 pe__health_strategy(pe_working_set_t *data_set)
646 {
647 return pcmk__parse_health_strategy(pe_pref(data_set->config_hash,
648 PCMK__OPT_NODE_HEALTH_STRATEGY));
649 }
650
651 static inline int
652 pe__health_score(const char *option, pe_working_set_t *data_set)
653 {
654 return char2score(pe_pref(data_set->config_hash, option));
655 }
656
657
658
659
660
661
662
663
664
665
666
667 static inline const char *
668 pe__node_name(const pe_node_t *node)
669 {
670 if (node == NULL) {
671 return "unspecified node";
672
673 } else if (node->details->uname != NULL) {
674 return node->details->uname;
675
676 } else if (node->details->id != NULL) {
677 return node->details->id;
678
679 } else {
680 return "unidentified node";
681 }
682 }
683
684
685
686
687
688
689
690
691
692
693 static inline bool
694 pe__same_node(const pe_node_t *node1, const pe_node_t *node2)
695 {
696 return (node1 != NULL) && (node2 != NULL)
697 && (node1->details == node2->details);
698 }
699
700
701
702
703
704
705
706
707
708 static inline const char *
709 pe__xe_history_key(const xmlNode *xml)
710 {
711 if (xml == NULL) {
712 return NULL;
713 } else {
714
715
716
717
718 const char *key = crm_element_value(xml, XML_LRM_ATTR_TASK_KEY);
719
720 return pcmk__str_empty(key)? ID(xml) : key;
721 }
722 }
723
724 #endif