pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2023 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 <stdbool.h>
14 # include <stdint.h>
15 # include <string.h>
16 # include <crm/msg_xml.h>
17 # include <crm/pengine/status.h>
19 # include <crm/common/internal.h>
23 
24 const char *pe__resource_description(const pcmk_resource_t *rsc,
25  uint32_t show_opts);
26 
27 bool pe__clone_is_ordered(const pcmk_resource_t *clone);
29 bool pe__clone_flag_is_set(const pcmk_resource_t *clone, uint32_t flags);
30 
31 bool pe__group_flag_is_set(const pcmk_resource_t *group, uint32_t flags);
33 
34 
35 # define pe_rsc_info(rsc, fmt, args...) crm_log_tag(LOG_INFO, rsc ? rsc->id : "<NULL>", fmt, ##args)
36 # define pe_rsc_debug(rsc, fmt, args...) crm_log_tag(LOG_DEBUG, rsc ? rsc->id : "<NULL>", fmt, ##args)
37 # define pe_rsc_trace(rsc, fmt, args...) crm_log_tag(LOG_TRACE, rsc ? rsc->id : "<NULL>", fmt, ##args)
38 
39 # define pe_err(fmt...) do { \
40  was_processing_error = TRUE; \
41  pcmk__config_err(fmt); \
42  } while (0)
43 
44 # define pe_warn(fmt...) do { \
45  was_processing_warning = TRUE; \
46  pcmk__config_warn(fmt); \
47  } while (0)
48 
49 # define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); }
50 # define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); }
51 
52 #define pe__set_working_set_flags(scheduler, flags_to_set) do { \
53  (scheduler)->flags = pcmk__set_flags_as(__func__, __LINE__, \
54  LOG_TRACE, "Scheduler", crm_system_name, \
55  (scheduler)->flags, (flags_to_set), #flags_to_set); \
56  } while (0)
57 
58 #define pe__clear_working_set_flags(scheduler, flags_to_clear) do { \
59  (scheduler)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
60  LOG_TRACE, "Scheduler", crm_system_name, \
61  (scheduler)->flags, (flags_to_clear), #flags_to_clear); \
62  } while (0)
63 
64 #define pe__set_resource_flags(resource, flags_to_set) do { \
65  (resource)->flags = pcmk__set_flags_as(__func__, __LINE__, \
66  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
67  (flags_to_set), #flags_to_set); \
68  } while (0)
69 
70 #define pe__clear_resource_flags(resource, flags_to_clear) do { \
71  (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
72  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
73  (flags_to_clear), #flags_to_clear); \
74  } while (0)
75 
76 #define pe__set_action_flags(action, flags_to_set) do { \
77  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
78  LOG_TRACE, \
79  "Action", (action)->uuid, \
80  (action)->flags, \
81  (flags_to_set), \
82  #flags_to_set); \
83  } while (0)
84 
85 #define pe__clear_action_flags(action, flags_to_clear) do { \
86  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
87  LOG_TRACE, \
88  "Action", (action)->uuid, \
89  (action)->flags, \
90  (flags_to_clear), \
91  #flags_to_clear); \
92  } while (0)
93 
94 #define pe__set_raw_action_flags(action_flags, action_name, flags_to_set) do { \
95  action_flags = pcmk__set_flags_as(__func__, __LINE__, \
96  LOG_TRACE, "Action", action_name, \
97  (action_flags), \
98  (flags_to_set), #flags_to_set); \
99  } while (0)
100 
101 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
102  action_flags = pcmk__clear_flags_as(__func__, __LINE__, \
103  LOG_TRACE, \
104  "Action", action_name, \
105  (action_flags), \
106  (flags_to_clear), \
107  #flags_to_clear); \
108  } while (0)
109 
110 #define pe__set_action_flags_as(function, line, action, flags_to_set) do { \
111  (action)->flags = pcmk__set_flags_as((function), (line), \
112  LOG_TRACE, \
113  "Action", (action)->uuid, \
114  (action)->flags, \
115  (flags_to_set), \
116  #flags_to_set); \
117  } while (0)
118 
119 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
120  (action)->flags = pcmk__clear_flags_as((function), (line), \
121  LOG_TRACE, \
122  "Action", (action)->uuid, \
123  (action)->flags, \
124  (flags_to_clear), \
125  #flags_to_clear); \
126  } while (0)
127 
128 #define pe__set_order_flags(order_flags, flags_to_set) do { \
129  order_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
130  "Ordering", "constraint", \
131  order_flags, (flags_to_set), \
132  #flags_to_set); \
133  } while (0)
134 
135 #define pe__clear_order_flags(order_flags, flags_to_clear) do { \
136  order_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
137  "Ordering", "constraint", \
138  order_flags, (flags_to_clear), \
139  #flags_to_clear); \
140  } while (0)
141 
142 #define pe_warn_once(pe_wo_bit, fmt...) do { \
143  if (!pcmk_is_set(pcmk__warnings, pe_wo_bit)) { \
144  if (pe_wo_bit == pcmk__wo_blind) { \
145  crm_warn(fmt); \
146  } else { \
147  pe_warn(fmt); \
148  } \
149  pcmk__warnings = pcmk__set_flags_as(__func__, __LINE__, \
150  LOG_TRACE, \
151  "Warn-once", "logging", \
152  pcmk__warnings, \
153  (pe_wo_bit), #pe_wo_bit); \
154  } \
155  } while (0);
156 
157 
159  char *id; // Constraint XML ID
160  pcmk_resource_t *rsc_lh; // Resource being located
161  enum rsc_role_e role_filter; // Role to locate
162  enum pe_discover_e discover_mode; // Resource discovery
163  GList *node_list_rh; // List of pcmk_node_t*
165 
166 typedef struct pe__order_constraint_s {
167  int id;
168  uint32_t flags; // Group of enum pcmk__action_relation_flags
169 
170  void *lh_opaque;
174 
175  void *rh_opaque;
180 
182  bool include_bundle);
183 
184 int pe__clone_max(const pcmk_resource_t *clone);
185 int pe__clone_node_max(const pcmk_resource_t *clone);
186 int pe__clone_promoted_max(const pcmk_resource_t *clone);
191  pcmk_action_t *start,
192  pcmk_action_t *started,
193  pcmk_action_t *stop,
194  pcmk_action_t *stopped);
195 
197  bool optional, bool runnable);
198 
200  bool any_promoting, bool any_demoting);
201 
202 bool pe_can_fence(const pcmk_scheduler_t *scheduler, const pcmk_node_t *node);
203 
204 void add_hash_param(GHashTable * hash, const char *name, const char *value);
205 
206 char *native_parameter(pcmk_resource_t *rsc, pcmk_node_t *node, gboolean create,
207  const char *name, pcmk_scheduler_t *scheduler);
208 pcmk_node_t *native_location(const pcmk_resource_t *rsc, GList **list,
209  int current);
210 
211 void pe_metadata(pcmk__output_t *out);
212 void verify_pe_options(GHashTable * options);
213 
215  pcmk_scheduler_t *scheduler, gboolean failed);
216 
221 
222 pcmk_resource_t *native_find_rsc(pcmk_resource_t *rsc, const char *id,
223  const pcmk_node_t *node, int flags);
224 
225 gboolean native_active(pcmk_resource_t *rsc, gboolean all);
226 gboolean group_active(pcmk_resource_t *rsc, gboolean all);
227 gboolean clone_active(pcmk_resource_t *rsc, gboolean all);
228 gboolean pe__bundle_active(pcmk_resource_t *rsc, gboolean all);
229 
231 void native_print(pcmk_resource_t *rsc, const char *pre_text, long options,
232  void *print_data);
233 
235 void group_print(pcmk_resource_t *rsc, const char *pre_text, long options,
236  void *print_data);
237 
239 void clone_print(pcmk_resource_t *rsc, const char *pre_text, long options,
240  void *print_data);
241 
243 void pe__print_bundle(pcmk_resource_t *rsc, const char *pre_text, long options,
244  void *print_data);
245 
246 gchar *pcmk__native_output_string(const pcmk_resource_t *rsc, const char *name,
247  const pcmk_node_t *node, uint32_t show_opts,
248  const char *target_role, bool show_nodes);
249 
250 int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
251  , size_t pairs_count, ...);
252 char *pe__node_display_name(pcmk_node_t *node, bool print_detail);
253 
254 
255 // Clone notifications (pe_notif.c)
257  pcmk_resource_t *rsc,
258  pcmk_action_t *stonith_op);
259 
260 
261 static inline const char *
262 pe__rsc_bool_str(const pcmk_resource_t *rsc, uint64_t rsc_flag)
263 {
264  return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
265 }
266 
267 int pe__clone_xml(pcmk__output_t *out, va_list args);
268 int pe__clone_default(pcmk__output_t *out, va_list args);
269 int pe__group_xml(pcmk__output_t *out, va_list args);
270 int pe__group_default(pcmk__output_t *out, va_list args);
271 int pe__bundle_xml(pcmk__output_t *out, va_list args);
272 int pe__bundle_html(pcmk__output_t *out, va_list args);
273 int pe__bundle_text(pcmk__output_t *out, va_list args);
274 int pe__node_html(pcmk__output_t *out, va_list args);
275 int pe__node_text(pcmk__output_t *out, va_list args);
276 int pe__node_xml(pcmk__output_t *out, va_list args);
277 int pe__resource_xml(pcmk__output_t *out, va_list args);
278 int pe__resource_html(pcmk__output_t *out, va_list args);
279 int pe__resource_text(pcmk__output_t *out, va_list args);
280 
281 void native_free(pcmk_resource_t *rsc);
282 void group_free(pcmk_resource_t *rsc);
283 void clone_free(pcmk_resource_t *rsc);
285 
287  gboolean current);
289  gboolean current);
291  gboolean current);
293  gboolean current);
294 
297 
298 void common_free(pcmk_resource_t *rsc);
299 
300 pcmk_node_t *pe__copy_node(const pcmk_node_t *this_node);
302 
303 /* Failure handling utilities (from failcounts.c) */
304 
305 int pe_get_failcount(const pcmk_node_t *node, pcmk_resource_t *rsc,
306  time_t *last_failure, uint32_t flags,
307  const xmlNode *xml_op);
308 
310  const pcmk_node_t *node, const char *reason,
312 
313 /* Functions for finding/counting a resource's active nodes */
314 
315 bool pe__count_active_node(const pcmk_resource_t *rsc, pcmk_node_t *node,
316  pcmk_node_t **active, unsigned int *count_all,
317  unsigned int *count_clean);
318 
320  unsigned int *count);
321 
322 static inline pcmk_node_t *
323 pe__current_node(const pcmk_resource_t *rsc)
324 {
325  return (rsc == NULL)? NULL : rsc->fns->active_node(rsc, NULL, NULL);
326 }
327 
328 
329 /* Binary like operators for lists of nodes */
330 GHashTable *pe__node_list2table(const GList *list);
331 
333 gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action,
334  uint32_t flags);
335 
336 void pe__show_node_scores_as(const char *file, const char *function,
337  int line, bool to_log, const pcmk_resource_t *rsc,
338  const char *comment, GHashTable *nodes,
340 
341 #define pe__show_node_scores(level, rsc, text, nodes, scheduler) \
342  pe__show_node_scores_as(__FILE__, __func__, __LINE__, \
343  (level), (rsc), (text), (nodes), (scheduler))
344 
346  const pcmk_node_t *node,
347  const char *action_name, guint interval_ms,
348  const xmlNode *action_config);
349 GHashTable *pcmk__unpack_action_rsc_params(const xmlNode *action_xml,
350  GHashTable *node_attrs,
351  pcmk_scheduler_t *data_set);
352 xmlNode *pcmk__find_action_config(const pcmk_resource_t *rsc,
353  const char *action_name, guint interval_ms,
354  bool include_disabled);
355 
357  const char *action_name);
358 
360  const char *action_name,
361  guint interval_ms,
362  const char *value);
363 
365  const char *action_name,
366  enum action_fail_response on_fail,
367  GHashTable *meta);
368 
369 pcmk_action_t *custom_action(pcmk_resource_t *rsc, char *key, const char *task,
370  const pcmk_node_t *on_node, gboolean optional,
372 
373 # define delete_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_DELETE, 0)
374 # define delete_action(rsc, node, optional) custom_action( \
375  rsc, delete_key(rsc), PCMK_ACTION_DELETE, node, \
376  optional, rsc->cluster);
377 
378 # define stop_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_STOP, 0)
379 # define stop_action(rsc, node, optional) custom_action( \
380  rsc, stop_key(rsc), PCMK_ACTION_STOP, node, \
381  optional, rsc->cluster);
382 
383 # define reload_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_RELOAD_AGENT, 0)
384 # define start_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_START, 0)
385 # define start_action(rsc, node, optional) custom_action( \
386  rsc, start_key(rsc), PCMK_ACTION_START, node, \
387  optional, rsc->cluster)
388 
389 # define promote_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_PROMOTE, 0)
390 # define promote_action(rsc, node, optional) custom_action( \
391  rsc, promote_key(rsc), PCMK_ACTION_PROMOTE, node, \
392  optional, rsc->cluster)
393 
394 # define demote_key(rsc) pcmk__op_key(rsc->id, PCMK_ACTION_DEMOTE, 0)
395 # define demote_action(rsc, node, optional) custom_action( \
396  rsc, demote_key(rsc), PCMK_ACTION_DEMOTE, node, \
397  optional, rsc->cluster)
398 
399 extern int pe_get_configured_timeout(pcmk_resource_t *rsc, const char *action,
401 
402 pcmk_action_t *find_first_action(const GList *input, const char *uuid,
403  const char *task, const pcmk_node_t *on_node);
404 
406  const char *name);
407 
408 GList *find_actions(GList *input, const char *key, const pcmk_node_t *on_node);
409 GList *find_actions_exact(GList *input, const char *key,
410  const pcmk_node_t *on_node);
411 GList *pe__resource_actions(const pcmk_resource_t *rsc, const pcmk_node_t *node,
412  const char *task, bool require_node);
413 
414 extern void pe_free_action(pcmk_action_t *action);
415 
416 void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score,
417  const char *tag, pcmk_scheduler_t *scheduler);
418 
419 extern int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b,
420  bool same_node_default);
421 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
422 gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role);
423 void pe__set_next_role(pcmk_resource_t *rsc, enum rsc_role_e role,
424  const char *why);
425 
427  const char *sub_id);
428 
429 extern void destroy_ticket(gpointer data);
430 pcmk_ticket_t *ticket_new(const char *ticket_id, pcmk_scheduler_t *scheduler);
431 
432 // Resources for manipulating resource names
433 const char *pe_base_name_end(const char *id);
434 char *clone_strip(const char *last_rsc_id);
435 char *clone_zero(const char *last_rsc_id);
436 
437 static inline bool
438 pe_base_name_eq(const pcmk_resource_t *rsc, const char *id)
439 {
440  if (id && rsc && rsc->id) {
441  // Number of characters in rsc->id before any clone suffix
442  size_t base_len = pe_base_name_end(rsc->id) - rsc->id + 1;
443 
444  return (strlen(id) == base_len) && !strncmp(id, rsc->id, base_len);
445  }
446  return false;
447 }
448 
449 int pe__target_rc_from_xml(const xmlNode *xml_op);
450 
451 gint pe__cmp_node_name(gconstpointer a, gconstpointer b);
452 bool is_set_recursive(const pcmk_resource_t *rsc, long long flag, bool any);
453 
454 typedef struct op_digest_cache_s {
456  xmlNode *params_all;
457  xmlNode *params_secure;
458  xmlNode *params_restart;
463 
465  guint *interval_ms,
466  const pcmk_node_t *node,
467  const xmlNode *xml_op,
468  GHashTable *overrides,
469  bool calc_secure,
471 
472 void pe__free_digests(gpointer ptr);
473 
475  const xmlNode *xml_op,
476  pcmk_node_t *node,
478 
479 pcmk_action_t *pe_fence_op(pcmk_node_t *node, const char *op, bool optional,
480  const char *reason, bool priority_delay,
483  const char *reason, pcmk_action_t *dependency,
485 
486 char *pe__action2reason(const pcmk_action_t *action, enum pe_action_flags flag);
487 void pe_action_set_reason(pcmk_action_t *action, const char *reason,
488  bool overwrite);
489 void pe__add_action_expected_result(pcmk_action_t *action, int expected_result);
490 
494  uint64_t flag);
495 
496 gboolean add_tag_ref(GHashTable * tags, const char * tag_name, const char * obj_ref);
497 
499 void print_rscs_brief(GList *rsc_list, const char * pre_text, long options,
500  void * print_data, gboolean print_all);
501 int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options);
503  const char *reason, bool priority_delay);
504 
505 pcmk_node_t *pe_create_node(const char *id, const char *uname, const char *type,
506  const char *score, pcmk_scheduler_t *scheduler);
507 
509 void common_print(pcmk_resource_t *rsc, const char *pre_text, const char *name,
510  const pcmk_node_t *node, long options, void *print_data);
512  const char *name, const pcmk_node_t *node,
513  unsigned int options);
515  const char *name, const pcmk_node_t *node,
516  unsigned int options);
517 
519 typedef struct {
520  int offset;
521  char *ipaddr;
528 
529 GList *pe__bundle_containers(const pcmk_resource_t *bundle);
530 
531 int pe__bundle_max(const pcmk_resource_t *rsc);
533  const pcmk_node_t *node);
538  bool (*fn)(pe__bundle_replica_t *, void *),
539  void *user_data);
541  bool (*fn)(const pe__bundle_replica_t *,
542  void *),
543  void *user_data);
545  const pcmk_node_t *node);
549  xmlNode *xml, const char *field);
550 
551 const char *pe__node_attribute_calculated(const pcmk_node_t *node,
552  const char *name,
553  const pcmk_resource_t *rsc,
555  bool force_host);
556 const char *pe_node_attribute_raw(const pcmk_node_t *node, const char *name);
558  const pcmk_scheduler_t *scheduler);
559 void pe__add_param_check(const xmlNode *rsc_op, pcmk_resource_t *rsc,
563  void (*cb)(pcmk_resource_t*, pcmk_node_t*,
564  const xmlNode*,
565  enum pcmk__check_parameters));
567 
568 bool pe__shutdown_requested(const pcmk_node_t *node);
570  const char *reason);
571 
579 
580 void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name,
581  const pe_rule_eval_data_t *rule_data,
582  GHashTable *hash, const char *always_first,
583  gboolean overwrite,
585 
588 
589 GList *pe__rscs_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name);
590 GList *pe__unames_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name);
591 bool pe__rsc_has_tag(pcmk_scheduler_t *scheduler, const char *rsc,
592  const char *tag);
593 bool pe__uname_has_tag(pcmk_scheduler_t *scheduler, const char *node,
594  const char *tag);
595 
597  const pcmk_node_t *node);
598 bool pe__rsc_running_on_any(pcmk_resource_t *rsc, GList *node_list);
599 GList *pe__filter_rsc_list(GList *rscs, GList *filter);
600 GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s);
601 GList * pe__build_rsc_list(pcmk_scheduler_t *scheduler, const char *s);
602 
603 bool pcmk__rsc_filtered_by_node(pcmk_resource_t *rsc, GList *only_node);
604 
605 gboolean pe__bundle_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc,
606  gboolean check_parent);
607 gboolean pe__clone_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc,
608  gboolean check_parent);
609 gboolean pe__group_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc,
610  gboolean check_parent);
611 gboolean pe__native_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc,
612  gboolean check_parent);
613 
614 xmlNode *pe__failed_probe_for_rsc(const pcmk_resource_t *rsc, const char *name);
615 
616 const char *pe__clone_child_id(const pcmk_resource_t *rsc);
617 
618 int pe__sum_node_health_scores(const pcmk_node_t *node, int base_health);
619 int pe__node_health(pcmk_node_t *node);
620 
621 static inline enum pcmk__health_strategy
622 pe__health_strategy(pcmk_scheduler_t *scheduler)
623 {
626 }
627 
628 static inline int
629 pe__health_score(const char *option, pcmk_scheduler_t *scheduler)
630 {
631  return char2score(pe_pref(scheduler->config_hash, option));
632 }
633 
644 static inline const char *
645 pe__node_name(const pcmk_node_t *node)
646 {
647  if (node == NULL) {
648  return "unspecified node";
649 
650  } else if (node->details->uname != NULL) {
651  return node->details->uname;
652 
653  } else if (node->details->id != NULL) {
654  return node->details->id;
655 
656  } else {
657  return "unidentified node";
658  }
659 }
660 
670 static inline bool
671 pe__same_node(const pcmk_node_t *node1, const pcmk_node_t *node2)
672 {
673  return (node1 != NULL) && (node2 != NULL)
674  && (node1->details == node2->details);
675 }
676 
685 static inline const char *
686 pe__xe_history_key(const xmlNode *xml)
687 {
688  if (xml == NULL) {
689  return NULL;
690  } else {
691  /* @COMPAT Pacemaker <= 1.1.5 did not add the key, and used the ID
692  * instead. Checking for that allows us to process old saved CIBs,
693  * including some regression tests.
694  */
695  const char *key = crm_element_value(xml, XML_LRM_ATTR_TASK_KEY);
696 
697  return pcmk__str_empty(key)? ID(xml) : key;
698  }
699 }
700 
701 #endif
gboolean native_active(pcmk_resource_t *rsc, gboolean all)
Definition: native.c:351
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
Definition: complex.c:962
void pe__count_bundle(pcmk_resource_t *rsc)
Definition: bundle.c:2045
bool pe_can_fence(const pcmk_scheduler_t *scheduler, const pcmk_node_t *node)
Definition: utils.c:36
pcmk_action_t * lh_action
Definition: internal.h:172
void verify_pe_options(GHashTable *options)
Definition: common.c:308
enum rsc_role_e role_filter
Definition: internal.h:161
void pe__create_clone_notif_pseudo_ops(pcmk_resource_t *clone, pcmk_action_t *start, pcmk_action_t *started, pcmk_action_t *stop, pcmk_action_t *stopped)
Definition: clone.c:1475
bool pe__shutdown_requested(const pcmk_node_t *node)
Definition: utils.c:666
pcmk_ticket_t * ticket_new(const char *ticket_id, pcmk_scheduler_t *scheduler)
Definition: utils.c:510
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
Definition: utils.c:89
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
Definition: utils.c:581
pcmk_resource_t * ip
IP address resource for ipaddr.
Definition: internal.h:523
node_type
Possible node types.
Definition: nodes.h:33
char data[0]
Definition: cpg.c:55
pcmk_action_t * get_pseudo_op(const char *name, pcmk_scheduler_t *scheduler)
Definition: pe_actions.c:1160
bool pe__is_universal_clone(const pcmk_resource_t *rsc, const pcmk_scheduler_t *scheduler)
Definition: clone.c:1240
void pe__free_bundle(pcmk_resource_t *rsc)
Definition: bundle.c:1984
const char * pe_node_attribute_raw(const pcmk_node_t *node, const char *name)
Definition: common.c:621
pcmk_resource_t * pe__find_bundle_replica(const pcmk_resource_t *bundle, const pcmk_node_t *node)
Definition: bundle.c:1367
gchar * pcmk__native_output_string(const pcmk_resource_t *rsc, const char *name, const pcmk_node_t *node, uint32_t show_opts, const char *target_role, bool show_nodes)
Definition: native.c:563
pcmk_node_t * pe__find_active_requires(const pcmk_resource_t *rsc, unsigned int *count)
Definition: complex.c:1139
pcmk_action_t * rh_action
Definition: internal.h:177
const char * name
Definition: cib.c:26
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
Definition: utils.c:146
xmlNode * pe__failed_probe_for_rsc(const pcmk_resource_t *rsc, const char *name)
Definition: utils.c:869
enum pcmk__digest_result rc
Definition: internal.h:455
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
Definition: utils.c:450
int pe__target_rc_from_xml(const xmlNode *xml_op)
Definition: unpack.c:4275
struct op_digest_cache_s op_digest_cache_t
gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:411
Implementation of pcmk_action_t.
Definition: actions.h:390
int pe__is_newer_op(const xmlNode *xml_a, const xmlNode *xml_b, bool same_node_default)
Definition: pe_actions.c:1682
int pe__group_default(pcmk__output_t *out, va_list args)
int char2score(const char *score)
Get the integer value of a score string.
Definition: scores.c:36
const char * pe__resource_description(const pcmk_resource_t *rsc, uint32_t show_opts)
Definition: pe_output.c:22
void common_print(pcmk_resource_t *rsc, const char *pre_text, const char *name, const pcmk_node_t *node, long options, void *print_data)
Definition: native.c:811
GHashTable * pcmk__unpack_action_rsc_params(const xmlNode *action_xml, GHashTable *node_attrs, pcmk_scheduler_t *data_set)
Definition: pe_actions.c:240
pcmk_action_t * pe_fence_op(pcmk_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pcmk_scheduler_t *scheduler)
Definition: pe_actions.c:1265
op_digest_cache_t * rsc_action_digest_cmp(pcmk_resource_t *rsc, const xmlNode *xml_op, pcmk_node_t *node, pcmk_scheduler_t *scheduler)
Definition: pe_digest.c:389
int pe__clone_max(const pcmk_resource_t *clone)
Definition: clone.c:63
int pe_get_configured_timeout(pcmk_resource_t *rsc, const char *action, pcmk_scheduler_t *scheduler)
Definition: pe_actions.c:1404
void pe_action_set_reason(pcmk_action_t *action, const char *reason, bool overwrite)
Definition: pe_actions.c:1639
int pe__clone_default(pcmk__output_t *out, va_list args)
void print_rscs_brief(GList *rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
Definition: native.c:1253
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
Definition: pe_actions.c:1815
enum rsc_role_e native_resource_state(const pcmk_resource_t *rsc, gboolean current)
Definition: native.c:1093
action_tasks
Possible actions (including some pseudo-actions)
Definition: actions.h:79
GList * pe__rscs_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
Definition: tags.c:20
void pe_fence_node(pcmk_scheduler_t *scheduler, pcmk_node_t *node, const char *reason, bool priority_delay)
Schedule a fence action for a node.
Definition: unpack.c:110
pcmk_node_t node2
pcmk_node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pcmk_scheduler_t *scheduler)
Definition: unpack.c:440
action_fail_response
Possible responses to a resource action failure.
Definition: actions.h:149
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:314
pcmk__clone_flags
xmlNode * params_restart
Definition: internal.h:458
GList * pe__build_rsc_list(pcmk_scheduler_t *scheduler, const char *s)
Definition: utils.c:834
pcmk_action_t * pe__clear_failcount(pcmk_resource_t *rsc, const pcmk_node_t *node, const char *reason, pcmk_scheduler_t *scheduler)
Schedule a controller operation to clear a fail count.
Definition: failcounts.c:453
enum crm_ais_msg_types type
Definition: cpg.c:48
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
Definition: health.c:41
void pe__set_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
Definition: utils.c:571
GList * pe__resource_actions(const pcmk_resource_t *rsc, const pcmk_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource.
Definition: pe_actions.c:1588
void pe__foreach_const_bundle_replica(const pcmk_resource_t *bundle, bool(*fn)(const pe__bundle_replica_t *, void *), void *user_data)
Definition: bundle.c:234
int pe__resource_text(pcmk__output_t *out, va_list args)
void pe__foreach_param_check(pcmk_scheduler_t *scheduler, void(*cb)(pcmk_resource_t *, pcmk_node_t *, const xmlNode *, enum pcmk__check_parameters))
Definition: remote.c:252
Implementation of pcmk_scheduler_t.
Definition: scheduler.h:172
pcmk_resource_t * rsc_lh
Definition: internal.h:160
int pe__set_clone_flag(pcmk_resource_t *clone, enum pcmk__clone_flags flag)
Definition: clone.c:1319
pcmk_resource_t * remote
Pacemaker Remote connection into container.
Definition: internal.h:526
int pe_get_failcount(const pcmk_node_t *node, pcmk_resource_t *rsc, time_t *last_failure, uint32_t flags, const xmlNode *xml_op)
Definition: failcounts.c:360
gboolean clone_unpack(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
Definition: clone.c:325
int pe__bundle_html(pcmk__output_t *out, va_list args)
const char * action
Definition: pcmk_fence.c:30
rsc_start_requirement
What resource needs before it can be recovered from a failed node.
Definition: resources.h:58
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
Definition: utils.c:781
#define XML_LRM_ATTR_TASK_KEY
Definition: msg_xml.h:307
gboolean native_unpack(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
Definition: native.c:206
void pe__print_bundle(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1882
gboolean group_unpack(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
Definition: group.c:180
pcmk_action_t * pe__new_rsc_pseudo_action(pcmk_resource_t *rsc, const char *task, bool optional, bool runnable)
Definition: pe_actions.c:1835
void pe__clear_resource_flags_on_all(pcmk_scheduler_t *scheduler, uint64_t flag)
Definition: utils.c:562
GList * find_actions_exact(GList *input, const char *key, const pcmk_node_t *on_node)
Definition: pe_actions.c:1549
enum pe_discover_e discover_mode
Definition: internal.h:162
void common_free(pcmk_resource_t *rsc)
Definition: complex.c:980
Formatted output for pacemaker tools.
gboolean clone_active(pcmk_resource_t *rsc, gboolean all)
Definition: clone.c:442
void pe__set_next_role(pcmk_resource_t *rsc, enum rsc_role_e role, const char *why)
Definition: complex.c:1184
int offset
0-origin index of this instance in bundle
Definition: internal.h:520
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int options)
Implementation of pcmk_resource_t.
Definition: resources.h:399
struct pe__order_constraint_s pe__ordering_t
int pe__bundle_text(pcmk__output_t *out, va_list args)
int pe__bundle_max(const pcmk_resource_t *rsc)
Definition: bundle.c:96
gboolean pe__bundle_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: bundle.c:2069
const char * pe__add_bundle_remote_name(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler, xmlNode *xml, const char *field)
Definition: bundle.c:938
pcmk_node_t * node
Node created for this instance.
Definition: internal.h:522
gboolean pe__clone_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: clone.c:1254
const pcmk_resource_t * pe__get_rsc_in_container(const pcmk_resource_t *instance)
Definition: bundle.c:131
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition: nvpair.c:447
pcmk_resource_t * pe__last_group_member(const pcmk_resource_t *group)
Definition: group.c:37
void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score, const char *tag, pcmk_scheduler_t *scheduler)
Definition: utils.c:360
char * digest_all_calc
Definition: internal.h:459
char * clone_strip(const char *last_rsc_id)
Definition: unpack.c:1865
void pe__free_param_checks(pcmk_scheduler_t *scheduler)
Definition: remote.c:268
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:597
const char * pe__node_attribute_calculated(const pcmk_node_t *node, const char *name, const pcmk_resource_t *rsc, enum pcmk__rsc_node node_type, bool force_host)
Definition: common.c:546
int pe__clone_xml(pcmk__output_t *out, va_list args)
char * digest_secure_calc
Definition: internal.h:460
bool pe__rsc_running_on_any(pcmk_resource_t *rsc, GList *node_list)
Definition: utils.c:761
op_digest_cache_t * pe__calculate_digests(pcmk_resource_t *rsc, const char *task, guint *interval_ms, const pcmk_node_t *node, const xmlNode *xml_op, GHashTable *overrides, bool calc_secure, pcmk_scheduler_t *scheduler)
Definition: pe_digest.c:306
int pe__node_health(pcmk_node_t *node)
Definition: pe_health.c:114
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:99
enum rsc_start_requirement pcmk__action_requires(const pcmk_resource_t *rsc, const char *action_name)
Definition: pe_actions.c:851
pcmk__digest_result
enum rsc_role_e clone_resource_state(const pcmk_resource_t *rsc, gboolean current)
Definition: clone.c:1214
struct pe_node_shared_s * details
Basic node information.
Definition: nodes.h:134
void pe_metadata(pcmk__output_t *out)
Definition: common.c:295
bool pe__bundle_needs_remote_name(pcmk_resource_t *rsc)
Definition: bundle.c:920
void pe__create_promotable_pseudo_ops(pcmk_resource_t *clone, bool any_promoting, bool any_demoting)
Definition: clone.c:1362
GList * pe__unames_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
Definition: tags.c:52
unsigned long long flags
Group of enum pcmk_rsc_flags.
Definition: resources.h:429
const char * uname
Node name in cluster.
Definition: nodes.h:68
void pe__show_node_scores_as(const char *file, const char *function, int line, bool to_log, const pcmk_resource_t *rsc, const char *comment, GHashTable *nodes, pcmk_scheduler_t *scheduler)
Definition: utils.c:250
GHashTable * config_hash
Cluster properties.
Definition: scheduler.h:187
rsc_role_e
Definition: roles.h:27
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:617
void group_free(pcmk_resource_t *rsc)
Definition: group.c:456
void native_free(pcmk_resource_t *rsc)
Definition: native.c:1086
pcmk_resource_t * container
Container associated with this instance.
Definition: internal.h:525
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, pcmk_scheduler_t *scheduler)
Definition: utils.c:707
Ticket constraint object.
Definition: tickets.h:27
char * ipaddr
IP address associated with this instance.
Definition: internal.h:521
GHashTable * pe__node_list2table(const GList *list)
Definition: utils.c:116
enum rsc_role_e pe__bundle_resource_state(const pcmk_resource_t *rsc, gboolean current)
Definition: bundle.c:2018
pe_action_flags
Action scheduling flags.
Definition: actions.h:233
void group_print(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:290
GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s)
Definition: utils.c:801
bool pe__clone_flag_is_set(const pcmk_resource_t *clone, uint32_t flags)
Definition: clone.c:1343
void pe__free_digests(gpointer ptr)
Definition: pe_digest.c:34
void pe__register_messages(pcmk__output_t *out)
Definition: pe_output.c:3162
bool pe__rsc_has_tag(pcmk_scheduler_t *scheduler, const char *rsc, const char *tag)
Definition: tags.c:85
Implementation of pcmk_node_t.
Definition: nodes.h:130
bool is_set_recursive(const pcmk_resource_t *rsc, long long flag, bool any)
Definition: clone.c:558
#define PCMK__OPT_NODE_HEALTH_STRATEGY
gboolean group_active(pcmk_resource_t *rsc, gboolean all)
Definition: group.c:236
int pe__clone_promoted_node_max(const pcmk_resource_t *clone)
Definition: clone.c:114
int pe__clone_promoted_max(const pcmk_resource_t *clone)
Definition: clone.c:97
void pe__update_recheck_time(time_t recheck, pcmk_scheduler_t *scheduler, const char *reason)
Definition: utils.c:682
pcmk_resource_t * lh_rsc
Definition: internal.h:171
xmlNode * params_all
Definition: internal.h:456
const char * id
Node ID at the cluster layer.
Definition: nodes.h:67
void native_add_running(pcmk_resource_t *rsc, pcmk_node_t *node, pcmk_scheduler_t *scheduler, gboolean failed)
Definition: native.c:90
pcmk_action_t * custom_action(pcmk_resource_t *rsc, char *key, const char *task, const pcmk_node_t *on_node, gboolean optional, pcmk_scheduler_t *scheduler)
Create or update an action object.
Definition: pe_actions.c:1117
int pe__resource_xml(pcmk__output_t *out, va_list args)
void pe__add_action_expected_result(pcmk_action_t *action, int expected_result)
Definition: pe_actions.c:1861
char * native_parameter(pcmk_resource_t *rsc, pcmk_node_t *node, gboolean create, const char *name, pcmk_scheduler_t *scheduler)
Definition: native.c:329
pcmk_resource_t * native_find_rsc(pcmk_resource_t *rsc, const char *id, const pcmk_node_t *node, int flags)
Definition: native.c:275
pcmk__check_parameters
gboolean pe__native_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: native.c:1425
int pe__bundle_xml(pcmk__output_t *out, va_list args)
xmlNode * pcmk__find_action_config(const pcmk_resource_t *rsc, const char *action_name, guint interval_ms, bool include_disabled)
Definition: pe_actions.c:129
void clone_print(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:593
int pe__common_output_html(pcmk__output_t *out, const pcmk_resource_t *rsc, const char *name, const pcmk_node_t *node, unsigned int options)
Cluster status and scheduling.
gboolean pe__unpack_bundle(pcmk_resource_t *rsc, pcmk_scheduler_t *scheduler)
Definition: bundle.c:984
void pe__create_clone_notifications(pcmk_resource_t *clone)
Definition: clone.c:1426
int pe__node_text(pcmk__output_t *out, va_list args)
gboolean pe__bundle_active(pcmk_resource_t *rsc, gboolean all)
Definition: bundle.c:1319
void add_hash_param(GHashTable *hash, const char *name, const char *value)
Definition: common.c:508
void pe__clear_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
Definition: utils.c:552
pcmk_rsc_methods_t * fns
Resource object methods.
Definition: resources.h:416
pcmk__rsc_node
void pe__free_clone_notification_data(pcmk_resource_t *clone)
Definition: clone.c:1445
void pe__order_notifs_after_fencing(const pcmk_action_t *action, pcmk_resource_t *rsc, pcmk_action_t *stonith_op)
Definition: pe_notif.c:992
pcmk_action_t * find_first_action(const GList *input, const char *uuid, const char *task, const pcmk_node_t *on_node)
Definition: pe_actions.c:1486
pcmk_scheduler_t * scheduler
int pe__common_output_text(pcmk__output_t *out, const pcmk_resource_t *rsc, const char *name, const pcmk_node_t *node, unsigned int options)
GList * find_actions(GList *input, const char *key, const pcmk_node_t *on_node)
Definition: pe_actions.c:1515
xmlNode * input
pcmk_resource_t * pe__first_container(const pcmk_resource_t *bundle)
Definition: bundle.c:187
char * clone_zero(const char *last_rsc_id)
Definition: unpack.c:1887
bool pcmk__rsc_filtered_by_node(pcmk_resource_t *rsc, GList *only_node)
Definition: utils.c:775
void pe__foreach_bundle_replica(pcmk_resource_t *bundle, bool(*fn)(pe__bundle_replica_t *, void *), void *user_data)
Definition: bundle.c:210
int pe__node_xml(pcmk__output_t *out, va_list args)
int pe__group_xml(pcmk__output_t *out, va_list args)
This structure contains everything that makes up a single output formatter.
pcmk_node_t *(* active_node)(const pcmk_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
Find a node (and optionally count all) where resource is active.
Definition: resources.h:384
bool pe__resource_is_disabled(const pcmk_resource_t *rsc)
Definition: utils.c:725
pe_discover_e
When to probe a resource on a node (as specified in location constraints)
Definition: nodes.h:48
bool pe__uname_has_tag(pcmk_scheduler_t *scheduler, const char *node, const char *tag)
Definition: tags.c:101
xmlNode * params_secure
Definition: internal.h:457
void pe_free_action(pcmk_action_t *action)
Definition: pe_actions.c:1382
pcmk__health_strategy
char uname[MAX_NAME]
Definition: cpg.c:50
void pe__count_common(pcmk_resource_t *rsc)
Definition: complex.c:1156
pcmk_resource_t * child
Instance of bundled resource.
Definition: internal.h:524
char * pe__node_display_name(pcmk_node_t *node, bool print_detail)
Definition: pe_output.c:544
int pe__resource_html(pcmk__output_t *out, va_list args)
int pe__clone_node_max(const pcmk_resource_t *clone)
Definition: clone.c:80
void pe__clear_resource_history(pcmk_resource_t *rsc, const pcmk_node_t *node)
Definition: pe_actions.c:1664
void destroy_ticket(gpointer data)
Definition: utils.c:498
void clone_free(pcmk_resource_t *rsc)
Definition: clone.c:1180
int pe__node_html(pcmk__output_t *out, va_list args)
A single instance of a bundle.
Definition: internal.h:519
pcmk_resource_t * pe__bundled_resource(const pcmk_resource_t *rsc)
Definition: bundle.c:113
enum rsc_role_e group_resource_state(const pcmk_resource_t *rsc, gboolean current)
Definition: group.c:477
enum action_fail_response pcmk__parse_on_fail(const pcmk_resource_t *rsc, const char *action_name, guint interval_ms, const char *value)
Definition: pe_actions.c:889
bool pe__count_active_node(const pcmk_resource_t *rsc, pcmk_node_t *node, pcmk_node_t **active, unsigned int *count_all, unsigned int *count_clean)
Definition: complex.c:1058
int pe__sum_node_health_scores(const pcmk_node_t *node, int base_health)
Definition: pe_health.c:96
bool pe__clone_is_ordered(const pcmk_resource_t *clone)
Definition: clone.c:1300
#define ID(x)
Definition: msg_xml.h:474
pcmk_node_t * native_location(const pcmk_resource_t *rsc, GList **list, int current)
Definition: native.c:1116
bool pe__rsc_running_on_only(const pcmk_resource_t *rsc, const pcmk_node_t *node)
Definition: utils.c:754
pcmk_resource_t * find_clone_instance(const pcmk_resource_t *rsc, const char *sub_id)
Definition: clone.c:227
bool pe__group_flag_is_set(const pcmk_resource_t *group, uint32_t flags)
Definition: group.c:57
char * pe__action2reason(const pcmk_action_t *action, enum pe_action_flags flag)
Definition: pe_actions.c:1614
enum rsc_role_e pcmk__role_after_failure(const pcmk_resource_t *rsc, const char *action_name, enum action_fail_response on_fail, GHashTable *meta)
Definition: pe_actions.c:1024
bool pe__node_is_bundle_instance(const pcmk_resource_t *bundle, const pcmk_node_t *node)
Definition: bundle.c:161
pcmk_node_t node1
enum action_tasks get_complex_task(const pcmk_resource_t *rsc, const char *name)
Definition: pe_actions.c:1453
pcmk_resource_t * rh_rsc
Definition: internal.h:176
time_t get_effective_time(pcmk_scheduler_t *scheduler)
Definition: utils.c:396
gboolean pe__group_is_filtered(const pcmk_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: group.c:496
const char * pe_base_name_end(const char *id)
Definition: unpack.c:1825
const char * pe__clone_child_id(const pcmk_resource_t *rsc)
Definition: clone.c:1284
void pe__add_param_check(const xmlNode *rsc_op, pcmk_resource_t *rsc, pcmk_node_t *node, enum pcmk__check_parameters, pcmk_scheduler_t *scheduler)
Definition: remote.c:225
struct pe__location_constraint_s pe__location_t
GList * pe__bundle_containers(const pcmk_resource_t *bundle)
Definition: bundle.c:2113
char * digest_restart_calc
Definition: internal.h:461
GHashTable * pcmk__unpack_action_meta(pcmk_resource_t *rsc, const pcmk_node_t *node, const char *action_name, guint interval_ms, const xmlNode *action_config)
Definition: pe_actions.c:692
uint64_t flags
Definition: remote.c:215
void native_print(pcmk_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:931
char * id
Resource ID in configuration.
Definition: resources.h:400