pacemaker  2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2022 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 PE_INTERNAL__H
11 # define PE_INTERNAL__H
12 
13 # include <stdint.h>
14 # include <string.h>
15 # include <crm/pengine/status.h>
17 # include <crm/common/internal.h>
20 
22  // Whether instances should be started sequentially
23  pe__clone_ordered = (1 << 0),
24 
25  // Whether promotion scores have been added
27 
28  // Whether promotion constraints have been added
30 };
31 
33 int pe__set_clone_flag(pe_resource_t *clone, enum pe__clone_flags flag);
34 
35 
37  pe__group_ordered = (1 << 0), // Members start sequentially
38  pe__group_colocated = (1 << 1), // Members must be on same node
39 };
40 
41 bool pe__group_flag_is_set(const pe_resource_t *group, uint32_t flags);
43 
44 
45 # define pe_rsc_info(rsc, fmt, args...) crm_log_tag(LOG_INFO, rsc ? rsc->id : "<NULL>", fmt, ##args)
46 # define pe_rsc_debug(rsc, fmt, args...) crm_log_tag(LOG_DEBUG, rsc ? rsc->id : "<NULL>", fmt, ##args)
47 # define pe_rsc_trace(rsc, fmt, args...) crm_log_tag(LOG_TRACE, rsc ? rsc->id : "<NULL>", fmt, ##args)
48 
49 # define pe_err(fmt...) do { \
50  was_processing_error = TRUE; \
51  pcmk__config_err(fmt); \
52  } while (0)
53 
54 # define pe_warn(fmt...) do { \
55  was_processing_warning = TRUE; \
56  pcmk__config_warn(fmt); \
57  } while (0)
58 
59 # define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); }
60 # define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); }
61 
62 #define pe__set_working_set_flags(working_set, flags_to_set) do { \
63  (working_set)->flags = pcmk__set_flags_as(__func__, __LINE__, \
64  LOG_TRACE, "Working set", crm_system_name, \
65  (working_set)->flags, (flags_to_set), #flags_to_set); \
66  } while (0)
67 
68 #define pe__clear_working_set_flags(working_set, flags_to_clear) do { \
69  (working_set)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
70  LOG_TRACE, "Working set", crm_system_name, \
71  (working_set)->flags, (flags_to_clear), #flags_to_clear); \
72  } while (0)
73 
74 #define pe__set_resource_flags(resource, flags_to_set) do { \
75  (resource)->flags = pcmk__set_flags_as(__func__, __LINE__, \
76  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
77  (flags_to_set), #flags_to_set); \
78  } while (0)
79 
80 #define pe__clear_resource_flags(resource, flags_to_clear) do { \
81  (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
82  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
83  (flags_to_clear), #flags_to_clear); \
84  } while (0)
85 
86 #define pe__set_action_flags(action, flags_to_set) do { \
87  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
88  LOG_TRACE, \
89  "Action", (action)->uuid, \
90  (action)->flags, \
91  (flags_to_set), \
92  #flags_to_set); \
93  } while (0)
94 
95 #define pe__clear_action_flags(action, flags_to_clear) do { \
96  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
97  LOG_TRACE, \
98  "Action", (action)->uuid, \
99  (action)->flags, \
100  (flags_to_clear), \
101  #flags_to_clear); \
102  } while (0)
103 
104 #define pe__set_raw_action_flags(action_flags, action_name, flags_to_set) do { \
105  action_flags = pcmk__set_flags_as(__func__, __LINE__, \
106  LOG_TRACE, "Action", action_name, \
107  (action_flags), \
108  (flags_to_set), #flags_to_set); \
109  } while (0)
110 
111 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
112  action_flags = pcmk__clear_flags_as(__func__, __LINE__, \
113  LOG_TRACE, \
114  "Action", action_name, \
115  (action_flags), \
116  (flags_to_clear), \
117  #flags_to_clear); \
118  } while (0)
119 
120 #define pe__set_action_flags_as(function, line, action, flags_to_set) do { \
121  (action)->flags = pcmk__set_flags_as((function), (line), \
122  LOG_TRACE, \
123  "Action", (action)->uuid, \
124  (action)->flags, \
125  (flags_to_set), \
126  #flags_to_set); \
127  } while (0)
128 
129 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
130  (action)->flags = pcmk__clear_flags_as((function), (line), \
131  LOG_TRACE, \
132  "Action", (action)->uuid, \
133  (action)->flags, \
134  (flags_to_clear), \
135  #flags_to_clear); \
136  } while (0)
137 
138 #define pe__set_order_flags(order_flags, flags_to_set) do { \
139  order_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
140  "Ordering", "constraint", \
141  order_flags, (flags_to_set), \
142  #flags_to_set); \
143  } while (0)
144 
145 #define pe__clear_order_flags(order_flags, flags_to_clear) do { \
146  order_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
147  "Ordering", "constraint", \
148  order_flags, (flags_to_clear), \
149  #flags_to_clear); \
150  } while (0)
151 
152 // Some warnings we don't want to print every transition
153 
155  pe_wo_blind = (1 << 0),
156  pe_wo_restart_type = (1 << 1),
157  pe_wo_role_after = (1 << 2),
158  pe_wo_poweroff = (1 << 3),
159  pe_wo_require_all = (1 << 4),
160  pe_wo_order_score = (1 << 5),
162  pe_wo_remove_after = (1 << 7),
163  pe_wo_ping_node = (1 << 8),
164  pe_wo_order_inst = (1 << 9),
165  pe_wo_coloc_inst = (1 << 10),
166  pe_wo_group_order = (1 << 11),
167  pe_wo_group_coloc = (1 << 12),
168 };
169 
170 extern uint32_t pe_wo;
171 
172 #define pe_warn_once(pe_wo_bit, fmt...) do { \
173  if (!pcmk_is_set(pe_wo, pe_wo_bit)) { \
174  if (pe_wo_bit == pe_wo_blind) { \
175  crm_warn(fmt); \
176  } else { \
177  pe_warn(fmt); \
178  } \
179  pe_wo = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
180  "Warn-once", "logging", pe_wo, \
181  (pe_wo_bit), #pe_wo_bit); \
182  } \
183  } while (0);
184 
185 
187  char *id; // Constraint XML ID
188  pe_resource_t *rsc_lh; // Resource being located
189  enum rsc_role_e role_filter; // Role to locate
190  enum pe_discover_e discover_mode; // Resource discovery
191  GList *node_list_rh; // List of pe_node_t*
193 
194 typedef struct pe__order_constraint_s {
195  int id;
196  uint32_t flags; // Group of enum pe_ordering flags
197 
198  void *lh_opaque;
202 
203  void *rh_opaque;
208 
209 typedef struct notify_data_s {
210  GSList *keys; // Environment variable name/value pairs
211 
212  const char *action;
213 
218 
219  GList *active; /* notify_entry_t* */
220  GList *inactive; /* notify_entry_t* */
221  GList *start; /* notify_entry_t* */
222  GList *stop; /* notify_entry_t* */
223  GList *demote; /* notify_entry_t* */
224  GList *promote; /* notify_entry_t* */
225  GList *promoted; /* notify_entry_t* */
226  GList *unpromoted; /* notify_entry_t* */
227  GHashTable *allowed_nodes;
228 
229 } notify_data_t;
230 
233 
234 pe_action_t *pe__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task,
235  bool optional, bool runnable);
236 
237 void pe__create_promotable_pseudo_ops(pe_resource_t *clone, bool any_promoting,
238  bool any_demoting);
239 
241 
242 void add_hash_param(GHashTable * hash, const char *name, const char *value);
243 
244 char *native_parameter(pe_resource_t * rsc, pe_node_t * node, gboolean create, const char *name,
246 pe_node_t *native_location(const pe_resource_t *rsc, GList **list, int current);
247 
248 void pe_metadata(pcmk__output_t *out);
249 void verify_pe_options(GHashTable * options);
250 
251 void common_update_score(pe_resource_t * rsc, const char *id, int score);
252 void native_add_running(pe_resource_t * rsc, pe_node_t * node, pe_working_set_t * data_set, gboolean failed);
253 
258 
259 pe_resource_t *native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node,
260  int flags);
261 
262 gboolean native_active(pe_resource_t * rsc, gboolean all);
263 gboolean group_active(pe_resource_t * rsc, gboolean all);
264 gboolean clone_active(pe_resource_t * rsc, gboolean all);
265 gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all);
266 
268 void native_print(pe_resource_t *rsc, const char *pre_text, long options,
269  void *print_data);
270 
272 void group_print(pe_resource_t *rsc, const char *pre_text, long options,
273  void *print_data);
274 
276 void clone_print(pe_resource_t *rsc, const char *pre_text, long options,
277  void *print_data);
278 
280 void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
281  void *print_data);
282 
283 gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
284  uint32_t show_opts, const char *target_role, bool show_nodes);
285 
286 int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
287  , size_t pairs_count, ...);
288 char *pe__node_display_name(pe_node_t *node, bool print_detail);
289 
290 
291 // Clone notifications (pe_notif.c)
295  pe_action_t *complete);
298  pe_action_t *stonith_op);
299 
300 
301 static inline const char *
302 pe__rsc_bool_str(const pe_resource_t *rsc, uint64_t rsc_flag)
303 {
304  return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
305 }
306 
307 int pe__clone_xml(pcmk__output_t *out, va_list args);
308 int pe__clone_default(pcmk__output_t *out, va_list args);
309 int pe__group_xml(pcmk__output_t *out, va_list args);
310 int pe__group_default(pcmk__output_t *out, va_list args);
311 int pe__bundle_xml(pcmk__output_t *out, va_list args);
312 int pe__bundle_html(pcmk__output_t *out, va_list args);
313 int pe__bundle_text(pcmk__output_t *out, va_list args);
314 int pe__node_html(pcmk__output_t *out, va_list args);
315 int pe__node_text(pcmk__output_t *out, va_list args);
316 int pe__node_xml(pcmk__output_t *out, va_list args);
317 int pe__resource_xml(pcmk__output_t *out, va_list args);
318 int pe__resource_html(pcmk__output_t *out, va_list args);
319 int pe__resource_text(pcmk__output_t *out, va_list args);
320 
321 void native_free(pe_resource_t * rsc);
322 void group_free(pe_resource_t * rsc);
323 void clone_free(pe_resource_t * rsc);
324 void pe__free_bundle(pe_resource_t *rsc);
325 
326 enum rsc_role_e native_resource_state(const pe_resource_t * rsc, gboolean current);
327 enum rsc_role_e group_resource_state(const pe_resource_t * rsc, gboolean current);
328 enum rsc_role_e clone_resource_state(const pe_resource_t * rsc, gboolean current);
330  gboolean current);
331 
334 
335 void common_free(pe_resource_t * rsc);
336 
337 pe_node_t *pe__copy_node(const pe_node_t *this_node);
339 
340 /* Failure handling utilities (from failcounts.c) */
341 
342 // bit flags for fail count handling options
344  pe_fc_default = (1 << 0),
345  pe_fc_effective = (1 << 1), // don't count expired failures
346  pe_fc_fillers = (1 << 2), // if container, include filler failures in count
347 };
348 
349 int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure,
350  uint32_t flags, xmlNode *xml_op,
352 
354  const char *reason,
356 
357 /* Functions for finding/counting a resource's active nodes */
358 
360  unsigned int *count_all,
361  unsigned int *count_clean);
363  unsigned int *count);
364 
365 static inline pe_node_t *
366 pe__current_node(const pe_resource_t *rsc)
367 {
368  return pe__find_active_on(rsc, NULL, NULL);
369 }
370 
371 
372 /* Binary like operators for lists of nodes */
373 extern void node_list_exclude(GHashTable * list, GList *list2, gboolean merge_scores);
374 
375 GHashTable *pe__node_list2table(GList *list);
376 
377 static inline gpointer
378 pe_hash_table_lookup(GHashTable * hash, gconstpointer key)
379 {
380  if (hash) {
381  return g_hash_table_lookup(hash, key);
382  }
383  return NULL;
384 }
385 
386 extern pe_action_t *get_pseudo_op(const char *name, pe_working_set_t * data_set);
387 extern gboolean order_actions(pe_action_t * lh_action, pe_action_t * rh_action, enum pe_ordering order);
388 
389 void pe__show_node_weights_as(const char *file, const char *function,
390  int line, bool to_log, pe_resource_t *rsc,
391  const char *comment, GHashTable *nodes,
393 
394 #define pe__show_node_weights(level, rsc, text, nodes, data_set) \
395  pe__show_node_weights_as(__FILE__, __func__, __LINE__, \
396  (level), (rsc), (text), (nodes), (data_set))
397 
398 xmlNode *find_rsc_op_entry(const pe_resource_t *rsc, const char *key);
399 
400 pe_action_t *custom_action(pe_resource_t *rsc, char *key, const char *task,
401  const pe_node_t *on_node, gboolean optional,
402  gboolean foo, pe_working_set_t *data_set);
403 
404 # define delete_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DELETE, 0)
405 # define delete_action(rsc, node, optional) custom_action( \
406  rsc, delete_key(rsc), CRMD_ACTION_DELETE, node, \
407  optional, TRUE, rsc->cluster);
408 
409 # define stopped_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOPPED, 0)
410 # define stopped_action(rsc, node, optional) custom_action( \
411  rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node, \
412  optional, TRUE, rsc->cluster);
413 
414 # define stop_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOP, 0)
415 # define stop_action(rsc, node, optional) custom_action( \
416  rsc, stop_key(rsc), CRMD_ACTION_STOP, node, \
417  optional, TRUE, rsc->cluster);
418 
419 # define reload_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_RELOAD_AGENT, 0)
420 # define start_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_START, 0)
421 # define start_action(rsc, node, optional) custom_action( \
422  rsc, start_key(rsc), CRMD_ACTION_START, node, \
423  optional, TRUE, rsc->cluster)
424 
425 # define started_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STARTED, 0)
426 # define started_action(rsc, node, optional) custom_action( \
427  rsc, started_key(rsc), CRMD_ACTION_STARTED, node, \
428  optional, TRUE, rsc->cluster)
429 
430 # define promote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTE, 0)
431 # define promote_action(rsc, node, optional) custom_action( \
432  rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node, \
433  optional, TRUE, rsc->cluster)
434 
435 # define promoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTED, 0)
436 # define promoted_action(rsc, node, optional) custom_action( \
437  rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node, \
438  optional, TRUE, rsc->cluster)
439 
440 # define demote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTE, 0)
441 # define demote_action(rsc, node, optional) custom_action( \
442  rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node, \
443  optional, TRUE, rsc->cluster)
444 
445 # define demoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTED, 0)
446 # define demoted_action(rsc, node, optional) custom_action( \
447  rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node, \
448  optional, TRUE, rsc->cluster)
449 
450 extern int pe_get_configured_timeout(pe_resource_t *rsc, const char *action,
452 
453 pe_action_t *find_first_action(const GList *input, const char *uuid,
454  const char *task, const pe_node_t *on_node);
455 extern enum action_tasks get_complex_task(pe_resource_t * rsc, const char *name,
456  gboolean allow_non_atomic);
457 
458 extern GList *find_actions(GList *input, const char *key, const pe_node_t *on_node);
459 GList *find_actions_exact(GList *input, const char *key,
460  const pe_node_t *on_node);
461 GList *pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node,
462  const char *task, bool require_node);
463 
464 extern void pe_free_action(pe_action_t * action);
465 
466 extern void resource_location(pe_resource_t * rsc, pe_node_t * node, int score, const char *tag,
468 
469 extern int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b,
470  bool same_node_default);
471 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
472 extern gboolean get_target_role(pe_resource_t * rsc, enum rsc_role_e *role);
473 void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role,
474  const char *why);
475 
476 extern pe_resource_t *find_clone_instance(pe_resource_t * rsc, const char *sub_id,
478 
479 extern void destroy_ticket(gpointer data);
480 extern pe_ticket_t *ticket_new(const char *ticket_id, pe_working_set_t * data_set);
481 
482 // Resources for manipulating resource names
483 const char *pe_base_name_end(const char *id);
484 char *clone_strip(const char *last_rsc_id);
485 char *clone_zero(const char *last_rsc_id);
486 
487 static inline bool
488 pe_base_name_eq(pe_resource_t *rsc, const char *id)
489 {
490  if (id && rsc && rsc->id) {
491  // Number of characters in rsc->id before any clone suffix
492  size_t base_len = pe_base_name_end(rsc->id) - rsc->id + 1;
493 
494  return (strlen(id) == base_len) && !strncmp(id, rsc->id, base_len);
495  }
496  return false;
497 }
498 
499 int pe__target_rc_from_xml(xmlNode *xml_op);
500 
501 gint pe__cmp_node_name(gconstpointer a, gconstpointer b);
502 bool is_set_recursive(const pe_resource_t *rsc, long long flag, bool any);
503 
514 };
515 
516 typedef struct op_digest_cache_s {
518  xmlNode *params_all;
519  xmlNode *params_secure;
520  xmlNode *params_restart;
525 
527  guint *interval_ms, pe_node_t *node,
528  xmlNode *xml_op, GHashTable *overrides,
529  bool calc_secure,
531 
532 void pe__free_digests(gpointer ptr);
533 
534 op_digest_cache_t *rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node,
536 
537 pe_action_t *pe_fence_op(pe_node_t * node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t * data_set);
538 void trigger_unfencing(
539  pe_resource_t * rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t * data_set);
540 
542 void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite);
543 void pe__add_action_expected_result(pe_action_t *action, int expected_result);
544 
548 
549 gboolean add_tag_ref(GHashTable * tags, const char * tag_name, const char * obj_ref);
550 
552 void print_rscs_brief(GList *rsc_list, const char * pre_text, long options,
553  void * print_data, gboolean print_all);
554 int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options);
555 void pe_fence_node(pe_working_set_t * data_set, pe_node_t * node, const char *reason, bool priority_delay);
556 
557 pe_node_t *pe_create_node(const char *id, const char *uname, const char *type,
558  const char *score, pe_working_set_t * data_set);
559 
561 void common_print(pe_resource_t *rsc, const char *pre_text, const char *name,
562  pe_node_t *node, long options, void *print_data);
563 int pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, unsigned int options);
564 int pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, unsigned int options);
566  const pe_node_t *node);
571  xmlNode *xml, const char *field);
572 const char *pe_node_attribute_calculated(const pe_node_t *node,
573  const char *name,
574  const pe_resource_t *rsc);
575 const char *pe_node_attribute_raw(const pe_node_t *node, const char *name);
578 void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node,
581  void (*cb)(pe_resource_t*, pe_node_t*, xmlNode*,
582  enum pe_check_parameters,
583  pe_working_set_t*));
585 
587 void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set);
588 
596 
597 void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name,
598  pe_rule_eval_data_t *rule_data, GHashTable *hash,
599  const char *always_first, gboolean overwrite,
601 
605 
606 GList *pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name);
607 GList *pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name);
608 bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag);
609 bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag);
610 
611 bool pe__rsc_running_on_any(pe_resource_t *rsc, GList *node_list);
612 GList *pe__filter_rsc_list(GList *rscs, GList *filter);
613 GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s);
614 GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s);
615 
616 bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node);
617 
618 gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
619 gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
620 gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
621 gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
622 
623 xmlNode *pe__failed_probe_for_rsc(pe_resource_t *rsc, const char *name);
624 
625 const char *pe__clone_child_id(pe_resource_t *rsc);
626 
627 int pe__sum_node_health_scores(const pe_node_t *node, int base_health);
628 int pe__node_health(pe_node_t *node);
629 
630 static inline enum pcmk__health_strategy
631 pe__health_strategy(pe_working_set_t *data_set)
632 {
635 }
636 
637 static inline int
638 pe__health_score(const char *option, pe_working_set_t *data_set)
639 {
640  return char2score(pe_pref(data_set->config_hash, option));
641 }
642 
653 static inline const char *
654 pe__node_name(const pe_node_t *node)
655 {
656  if (node == NULL) {
657  return "unspecified node";
658 
659  } else if (node->details->uname != NULL) {
660  return node->details->uname;
661 
662  } else if (node->details->id != NULL) {
663  return node->details->id;
664 
665  } else {
666  return "unidentified node";
667  }
668 }
669 
679 static inline bool
680 pe__same_node(const pe_node_t *node1, const pe_node_t *node2)
681 {
682  return (node1 != NULL) && (node2 != NULL)
683  && (node1->details == node2->details);
684 }
685 #endif
int pe__node_health(pe_node_t *node)
Definition: pe_health.c:112
void pe__foreach_param_check(pe_working_set_t *data_set, void(*cb)(pe_resource_t *, pe_node_t *, xmlNode *, enum pe_check_parameters, pe_working_set_t *))
Definition: remote.c:246
void verify_pe_options(GHashTable *options)
Definition: common.c:301
xmlNode * find_rsc_op_entry(const pe_resource_t *rsc, const char *key)
Definition: pe_actions.c:145
pe_action_t * lh_action
Definition: internal.h:200
enum rsc_role_e role_filter
Definition: internal.h:189
void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
Definition: utils.c:577
GHashTable * pe__node_list2table(GList *list)
Definition: utils.c:151
int pe__target_rc_from_xml(xmlNode *xml_op)
Definition: unpack.c:3786
const char * pe_node_attribute_calculated(const pe_node_t *node, const char *name, const pe_resource_t *rsc)
Definition: common.c:522
void group_free(pe_resource_t *rsc)
Definition: group.c:433
char * pe__action2reason(pe_action_t *action, enum pe_action_flags flag)
Definition: pe_actions.c:1424
char data[0]
Definition: cpg.c:55
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:280
int pe__clone_promoted_node_max(pe_resource_t *clone)
Definition: clone.c:59
int pe__common_output_html(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, unsigned int options)
pe_check_parameters
Definition: pe_types.h:202
GHashTable * allowed_nodes
Definition: internal.h:227
void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node, enum pe_check_parameters, pe_working_set_t *data_set)
Definition: remote.c:220
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Definition: complex.c:1003
const char * name
Definition: cib.c:24
GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s)
Definition: utils.c:826
GList * start
Definition: internal.h:221
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
Definition: utils.c:703
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
Definition: utils.c:180
void pe__free_bundle(pe_resource_t *rsc)
Definition: bundle.c:1714
GList * find_actions(GList *input, const char *key, const pe_node_t *on_node)
Definition: pe_actions.c:1325
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: bundle.c:1748
struct op_digest_cache_s op_digest_cache_t
void pe__count_common(pe_resource_t *rsc)
Definition: complex.c:1092
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: group.c:473
int pe__clone_promoted_max(pe_resource_t *clone)
Definition: clone.c:42
gboolean group_active(pe_resource_t *rsc, gboolean all)
Definition: group.c:226
int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b, bool same_node_default)
Definition: pe_actions.c:1494
int pe__group_default(pcmk__output_t *out, va_list args)
Definition: group.c:381
pe_action_t * find_first_action(const GList *input, const char *uuid, const char *task, const pe_node_t *on_node)
Definition: pe_actions.c:1296
int char2score(const char *score)
Get the integer value of a score string.
Definition: scores.c:36
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition: native.c:1068
int pe__set_clone_flag(pe_resource_t *clone, enum pe__clone_flags flag)
Definition: clone.c:1235
pe_node_t * pe__copy_node(const pe_node_t *this_node)
Definition: utils.c:89
int pe__clone_default(pcmk__output_t *out, va_list args)
Definition: clone.c:817
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:690
void print_rscs_brief(GList *rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
Definition: native.c:1204
void node_list_exclude(GHashTable *list, GList *list2, gboolean merge_scores)
Definition: utils.c:108
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
Definition: pe_actions.c:1627
time_t get_effective_time(pe_working_set_t *data_set)
Definition: utils.c:421
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:307
pe_action_t * rh_action
Definition: internal.h:205
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
Definition: utils.c:385
xmlNode * params_restart
Definition: internal.h:520
pe_action_t * pe__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task, bool optional, bool runnable)
Definition: pe_actions.c:1647
enum crm_ais_msg_types type
Definition: cpg.c:48
pe_resource_t * rsc_lh
Definition: internal.h:188
bool pe__rsc_running_on_any(pe_resource_t *rsc, GList *node_list)
Definition: utils.c:754
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
Definition: health.c:41
int pe__resource_text(pcmk__output_t *out, va_list args)
Definition: native.c:1015
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1612
pe_discover_e
Definition: pe_types.h:472
GList * inactive
Definition: internal.h:220
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:754
char * pe__node_display_name(pe_node_t *node, bool print_detail)
Definition: pe_output.c:491
int pe__bundle_html(pcmk__output_t *out, va_list args)
Definition: bundle.c:1347
const char * action
Definition: pcmk_fence.c:30
bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag)
Definition: tags.c:99
void native_free(pe_resource_t *rsc)
Definition: native.c:1038
op_digest_cache_t * pe__calculate_digests(pe_resource_t *rsc, const char *task, guint *interval_ms, pe_node_t *node, xmlNode *xml_op, GHashTable *overrides, bool calc_secure, pe_working_set_t *data_set)
Definition: pe_digest.c:298
GList * pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name)
Definition: tags.c:20
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
Definition: utils.c:604
void clone_free(pe_resource_t *rsc)
Definition: clone.c:1098
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
Definition: utils.c:774
int pe__common_output_text(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, unsigned int options)
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: group.c:454
void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
Definition: utils.c:595
GList * active
Definition: internal.h:219
const char * pe__clone_child_id(pe_resource_t *rsc)
Definition: clone.c:1200
pe_resource_t * pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node)
Definition: bundle.c:1140
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: clone.c:1132
enum pe_discover_e discover_mode
Definition: internal.h:190
Formatted output for pacemaker tools.
GList * stop
Definition: internal.h:222
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
Definition: pe_actions.c:1447
pe_action_flags
Definition: pe_types.h:298
gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: native.c:1376
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options)
struct pe__order_constraint_s pe__ordering_t
int pe__bundle_text(pcmk__output_t *out, va_list args)
Definition: bundle.c:1475
pe_action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
Definition: pe_actions.c:977
gboolean clone_active(pe_resource_t *rsc, gboolean all)
Definition: clone.c:383
pe__clone_flags
Definition: internal.h:21
const char * pe_node_attribute_raw(const pe_node_t *node, const char *name)
Definition: common.c:562
void pe__order_notifs_after_fencing(pe_action_t *action, pe_resource_t *rsc, pe_action_t *stonith_op)
Definition: pe_notif.c:977
char * digest_all_calc
Definition: internal.h:521
char * clone_strip(const char *last_rsc_id)
Definition: unpack.c:1647
int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name, size_t pairs_count,...)
Definition: pe_output.c:544
void pe__add_action_expected_result(pe_action_t *action, int expected_result)
Definition: pe_actions.c:1673
pe_action_t * post
Definition: internal.h:215
bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag)
Definition: tags.c:84
pe_ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
Definition: utils.c:533
char * native_parameter(pe_resource_t *rsc, pe_node_t *node, gboolean create, const char *name, pe_working_set_t *data_set)
Definition: native.c:318
enum action_tasks get_complex_task(pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
Definition: pe_actions.c:1262
enum rsc_digest_cmp_val rc
Definition: internal.h:517
void pe_fence_node(pe_working_set_t *data_set, pe_node_t *node, const char *reason, bool priority_delay)
Schedule a fence action for a node.
Definition: unpack.c:95
int pe__clone_xml(pcmk__output_t *out, va_list args)
Definition: clone.c:755
char * digest_secure_calc
Definition: internal.h:522
GList * promote
Definition: internal.h:224
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:121
struct pe_node_shared_s * details
Definition: pe_types.h:252
void pe_metadata(pcmk__output_t *out)
Definition: common.c:288
void pe__create_promotable_pseudo_ops(pe_resource_t *clone, bool any_promoting, bool any_demoting)
Definition: clone.c:1258
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:436
bool pe__shutdown_requested(pe_node_t *node)
Definition: utils.c:688
pe_resource_t * find_clone_instance(pe_resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
Definition: clone.c:167
void common_free(pe_resource_t *rsc)
Definition: complex.c:926
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
Definition: utils.c:474
unsigned long long flags
Definition: pe_types.h:355
const char * uname
Definition: pe_types.h:216
pe_working_set_t * data_set
GHashTable * config_hash
Definition: pe_types.h:158
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:639
pe_resource_t * lh_rsc
Definition: internal.h:199
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: native.c:1045
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:531
bool pe__clone_is_ordered(pe_resource_t *clone)
Definition: clone.c:1216
GSList * keys
Definition: internal.h:210
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:891
pe_node_t node1
bool is_set_recursive(const pe_resource_t *rsc, long long flag, bool any)
Definition: clone.c:496
gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: bundle.c:1799
void pe__free_digests(gpointer ptr)
Definition: pe_digest.c:34
void pe__register_messages(pcmk__output_t *out)
Definition: pe_output.c:3010
GList * promoted
Definition: internal.h:225
int pe_get_configured_timeout(pe_resource_t *rsc, const char *action, pe_working_set_t *data_set)
Definition: pe_actions.c:1215
void common_update_score(pe_resource_t *rsc, const char *id, int score)
Definition: complex.c:873
#define PCMK__OPT_NODE_HEALTH_STRATEGY
pe_node_t node2
void common_print(pe_resource_t *rsc, const char *pre_text, const char *name, pe_node_t *node, long options, void *print_data)
Definition: native.c:771
xmlNode * params_all
Definition: internal.h:518
pe_warn_once_e
Definition: internal.h:154
void pe__free_param_checks(pe_working_set_t *data_set)
Definition: remote.c:261
const char * id
Definition: pe_types.h:215
const char * pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, xmlNode *xml, const char *field)
Definition: bundle.c:708
gboolean native_active(pe_resource_t *rsc, gboolean all)
Definition: native.c:340
pe_action_t * post_done
Definition: internal.h:217
int pe__resource_xml(pcmk__output_t *out, va_list args)
Definition: native.c:914
void pe__free_notification_data(notify_data_t *n_data)
Definition: pe_notif.c:945
bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node)
Definition: utils.c:36
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
Definition: utils.c:794
pe__group_flags
Definition: internal.h:36
void pe__create_notifications(pe_resource_t *rsc, notify_data_t *n_data)
Definition: pe_notif.c:928
uint32_t pe_wo
Definition: unpack.c:67
pe_resource_t * pe__last_group_member(const pe_resource_t *group)
Definition: group.c:37
int pe__bundle_xml(pcmk__output_t *out, va_list args)
Definition: bundle.c:1223
xmlNode * pe__failed_probe_for_rsc(pe_resource_t *rsc, const char *name)
Definition: utils.c:859
Cluster status and scheduling.
bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node)
Definition: utils.c:768
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
Definition: native.c:264
GList * unpromoted
Definition: internal.h:226
gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node, uint32_t show_opts, const char *target_role, bool show_nodes)
Definition: native.c:542
int pe__node_text(pcmk__output_t *out, va_list args)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:504
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:236
void pe__show_node_weights_as(const char *file, const char *function, int line, bool to_log, pe_resource_t *rsc, const char *comment, GHashTable *nodes, pe_working_set_t *data_set)
Definition: utils.c:280
pe_action_t * pe__clear_failcount(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_working_set_t *data_set)
Schedule a controller operation to clear a fail count.
Definition: failcounts.c:360
op_digest_cache_t * rsc_action_digest_cmp(pe_resource_t *rsc, xmlNode *xml_op, pe_node_t *node, pe_working_set_t *data_set)
Definition: pe_digest.c:380
xmlNode * input
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
Definition: complex.c:1120
char * clone_zero(const char *last_rsc_id)
Definition: unpack.c:1669
int pe__node_xml(pcmk__output_t *out, va_list args)
int pe__group_xml(pcmk__output_t *out, va_list args)
Definition: group.c:331
This structure contains everything that makes up a single output formatter.
xmlNode * params_secure
Definition: internal.h:519
void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag)
Definition: utils.c:586
void native_add_running(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, gboolean failed)
Definition: native.c:89
pcmk__health_strategy
char uname[MAX_NAME]
Definition: cpg.c:50
GList * demote
Definition: internal.h:223
int pe__resource_html(pcmk__output_t *out, va_list args)
Definition: native.c:991
rsc_role_e
Possible roles that a resource can be in.
Definition: common.h:92
bool pe__is_universal_clone(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:1158
pe_node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t *data_set)
Definition: unpack.c:381
void destroy_ticket(gpointer data)
Definition: utils.c:521
pe_resource_t * rh_rsc
Definition: internal.h:204
int pe__node_html(pcmk__output_t *out, va_list args)
GList * find_actions_exact(GList *input, const char *key, const pe_node_t *on_node)
Definition: pe_actions.c:1359
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition: complex.c:1083
notify_data_t * pe__clone_notif_pseudo_ops(pe_resource_t *rsc, const char *task, pe_action_t *action, pe_action_t *complete)
Definition: pe_notif.c:428
struct notify_data_s notify_data_t
bool pe__resource_is_disabled(pe_resource_t *rsc)
Definition: utils.c:735
bool pe__group_flag_is_set(const pe_resource_t *group, uint32_t flags)
Definition: group.c:57
GList * pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource.
Definition: pe_actions.c:1398
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Definition: pe_actions.c:1473
const char * action
Definition: internal.h:212
pe_fc_flags_e
Definition: internal.h:343
GList * pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name)
Definition: tags.c:51
gboolean native_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: native.c:198
pe_action_t * custom_action(pe_resource_t *rsc, char *key, const char *task, const pe_node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
Create or update an action object.
Definition: pe_actions.c:940
const char * pe_base_name_end(const char *id)
Definition: unpack.c:1607
int pe__sum_node_health_scores(const pe_node_t *node, int base_health)
Definition: pe_health.c:94
gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: clone.c:1173
struct pe__location_constraint_s pe__location_t
char * digest_restart_calc
Definition: internal.h:523
void pe__count_bundle(pe_resource_t *rsc)
Definition: bundle.c:1775
pe_action_t * pre_done
Definition: internal.h:216
pe_ordering
Definition: pe_types.h:479
uint64_t flags
Definition: remote.c:215
int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure, uint32_t flags, xmlNode *xml_op, pe_working_set_t *data_set)
Definition: failcounts.c:251
action_tasks
Definition: common.h:61
pe_action_t * pre
Definition: internal.h:214
pe_action_t * pe_fence_op(pe_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t *data_set)
Definition: pe_actions.c:1081
void pe_free_action(pe_action_t *action)
Definition: pe_actions.c:1193
rsc_digest_cmp_val
Definition: internal.h:504
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition: bundle.c:1092
char * id
Definition: pe_types.h:329
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: group.c:171
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
Definition: utils.c:717