pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2021 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 # include <string.h>
13 # include <crm/pengine/status.h>
15 # include <crm/common/internal.h>
17 
18 # define pe_rsc_info(rsc, fmt, args...) crm_log_tag(LOG_INFO, rsc ? rsc->id : "<NULL>", fmt, ##args)
19 # define pe_rsc_debug(rsc, fmt, args...) crm_log_tag(LOG_DEBUG, rsc ? rsc->id : "<NULL>", fmt, ##args)
20 # define pe_rsc_trace(rsc, fmt, args...) crm_log_tag(LOG_TRACE, rsc ? rsc->id : "<NULL>", fmt, ##args)
21 
22 # define pe_err(fmt...) do { \
23  was_processing_error = TRUE; \
24  pcmk__config_err(fmt); \
25  } while (0)
26 
27 # define pe_warn(fmt...) do { \
28  was_processing_warning = TRUE; \
29  pcmk__config_warn(fmt); \
30  } while (0)
31 
32 # define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); }
33 # define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); }
34 
35 #define pe__set_working_set_flags(working_set, flags_to_set) do { \
36  (working_set)->flags = pcmk__set_flags_as(__func__, __LINE__, \
37  LOG_TRACE, "Working set", crm_system_name, \
38  (working_set)->flags, (flags_to_set), #flags_to_set); \
39  } while (0)
40 
41 #define pe__clear_working_set_flags(working_set, flags_to_clear) do { \
42  (working_set)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
43  LOG_TRACE, "Working set", crm_system_name, \
44  (working_set)->flags, (flags_to_clear), #flags_to_clear); \
45  } while (0)
46 
47 #define pe__set_resource_flags(resource, flags_to_set) do { \
48  (resource)->flags = pcmk__set_flags_as(__func__, __LINE__, \
49  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
50  (flags_to_set), #flags_to_set); \
51  } while (0)
52 
53 #define pe__clear_resource_flags(resource, flags_to_clear) do { \
54  (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
55  LOG_TRACE, "Resource", (resource)->id, (resource)->flags, \
56  (flags_to_clear), #flags_to_clear); \
57  } while (0)
58 
59 #define pe__set_action_flags(action, flags_to_set) do { \
60  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
61  LOG_TRACE, \
62  "Action", (action)->uuid, \
63  (action)->flags, \
64  (flags_to_set), \
65  #flags_to_set); \
66  } while (0)
67 
68 #define pe__clear_action_flags(action, flags_to_clear) do { \
69  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
70  LOG_TRACE, \
71  "Action", (action)->uuid, \
72  (action)->flags, \
73  (flags_to_clear), \
74  #flags_to_clear); \
75  } while (0)
76 
77 #define pe__set_raw_action_flags(action_flags, action_name, flags_to_set) do { \
78  action_flags = pcmk__set_flags_as(__func__, __LINE__, \
79  LOG_TRACE, "Action", action_name, \
80  (action_flags), \
81  (flags_to_set), #flags_to_set); \
82  } while (0)
83 
84 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
85  action_flags = pcmk__clear_flags_as(__func__, __LINE__, \
86  LOG_TRACE, \
87  "Action", action_name, \
88  (action_flags), \
89  (flags_to_clear), \
90  #flags_to_clear); \
91  } while (0)
92 
93 #define pe__set_action_flags_as(function, line, action, flags_to_set) do { \
94  (action)->flags = pcmk__set_flags_as((function), (line), \
95  LOG_TRACE, \
96  "Action", (action)->uuid, \
97  (action)->flags, \
98  (flags_to_set), \
99  #flags_to_set); \
100  } while (0)
101 
102 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
103  (action)->flags = pcmk__clear_flags_as((function), (line), \
104  LOG_TRACE, \
105  "Action", (action)->uuid, \
106  (action)->flags, \
107  (flags_to_clear), \
108  #flags_to_clear); \
109  } while (0)
110 
111 #define pe__set_order_flags(order_flags, flags_to_set) do { \
112  order_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
113  "Ordering", "constraint", \
114  order_flags, (flags_to_set), \
115  #flags_to_set); \
116  } while (0)
117 
118 #define pe__clear_order_flags(order_flags, flags_to_clear) do { \
119  order_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
120  "Ordering", "constraint", \
121  order_flags, (flags_to_clear), \
122  #flags_to_clear); \
123  } while (0)
124 
125 #define pe__set_graph_flags(graph_flags, gr_action, flags_to_set) do { \
126  graph_flags = pcmk__set_flags_as(__func__, __LINE__, \
127  LOG_TRACE, "Graph", \
128  (gr_action)->uuid, graph_flags, \
129  (flags_to_set), #flags_to_set); \
130  } while (0)
131 
132 #define pe__clear_graph_flags(graph_flags, gr_action, flags_to_clear) do { \
133  graph_flags = pcmk__clear_flags_as(__func__, __LINE__, \
134  LOG_TRACE, "Graph", \
135  (gr_action)->uuid, graph_flags, \
136  (flags_to_clear), #flags_to_clear); \
137  } while (0)
138 
139 // Some warnings we don't want to print every transition
140 
142  pe_wo_blind = (1 << 0),
143  pe_wo_restart_type = (1 << 1),
144  pe_wo_role_after = (1 << 2),
145  pe_wo_poweroff = (1 << 3),
146  pe_wo_require_all = (1 << 4),
147  pe_wo_order_score = (1 << 5),
149  pe_wo_remove_after = (1 << 7),
150 };
151 
152 extern uint32_t pe_wo;
153 
154 #define pe_warn_once(pe_wo_bit, fmt...) do { \
155  if (!pcmk_is_set(pe_wo, pe_wo_bit)) { \
156  if (pe_wo_bit == pe_wo_blind) { \
157  crm_warn(fmt); \
158  } else { \
159  pe_warn(fmt); \
160  } \
161  pe_wo = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
162  "Warn-once", "logging", pe_wo, \
163  (pe_wo_bit), #pe_wo_bit); \
164  } \
165  } while (0);
166 
167 
169  char *id; // Constraint XML ID
170  pe_resource_t *rsc_lh; // Resource being located
171  enum rsc_role_e role_filter; // Role to locate
172  enum pe_discover_e discover_mode; // Resource discovery
173  GList *node_list_rh; // List of pe_node_t*
175 
176 typedef struct pe__order_constraint_s {
177  int id;
179 
180  void *lh_opaque;
184 
185  void *rh_opaque;
190 
191 typedef struct notify_data_s {
192  GSList *keys; // Environment variable name/value pairs
193 
194  const char *action;
195 
200 
201  GList *active; /* notify_entry_t* */
202  GList *inactive; /* notify_entry_t* */
203  GList *start; /* notify_entry_t* */
204  GList *stop; /* notify_entry_t* */
205  GList *demote; /* notify_entry_t* */
206  GList *promote; /* notify_entry_t* */
207  GList *promoted; /* notify_entry_t* */
208  GList *unpromoted; /* notify_entry_t* */
209  GHashTable *allowed_nodes;
210 
211 } notify_data_t;
212 
213 bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node);
214 
215 int pe__add_scores(int score1, int score2);
216 void add_hash_param(GHashTable * hash, const char *name, const char *value);
217 
218 char *native_parameter(pe_resource_t * rsc, pe_node_t * node, gboolean create, const char *name,
219  pe_working_set_t * data_set);
220 pe_node_t *native_location(const pe_resource_t *rsc, GList **list, int current);
221 
222 void pe_metadata(void);
223 void verify_pe_options(GHashTable * options);
224 
225 void common_update_score(pe_resource_t * rsc, const char *id, int score);
226 void native_add_running(pe_resource_t * rsc, pe_node_t * node, pe_working_set_t * data_set, gboolean failed);
227 
228 gboolean native_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
229 gboolean group_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
230 gboolean clone_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
231 gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set);
232 
233 pe_resource_t *native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node,
234  int flags);
235 
236 gboolean native_active(pe_resource_t * rsc, gboolean all);
237 gboolean group_active(pe_resource_t * rsc, gboolean all);
238 gboolean clone_active(pe_resource_t * rsc, gboolean all);
239 gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all);
240 
241 void native_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
242 void group_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
243 void clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
244 void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
245  void *print_data);
246 
247 gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node,
248  long options, 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(pe_node_t *node, bool print_detail);
253 
254 static inline const char *
255 pe__rsc_bool_str(pe_resource_t *rsc, uint64_t rsc_flag)
256 {
257  return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
258 }
259 
260 int pe__clone_xml(pcmk__output_t *out, va_list args);
261 int pe__clone_html(pcmk__output_t *out, va_list args);
262 int pe__clone_text(pcmk__output_t *out, va_list args);
263 int pe__group_xml(pcmk__output_t *out, va_list args);
264 int pe__group_html(pcmk__output_t *out, va_list args);
265 int pe__group_text(pcmk__output_t *out, va_list args);
266 int pe__bundle_xml(pcmk__output_t *out, va_list args);
267 int pe__bundle_html(pcmk__output_t *out, va_list args);
268 int pe__bundle_text(pcmk__output_t *out, va_list args);
269 int pe__node_html(pcmk__output_t *out, va_list args);
270 int pe__node_text(pcmk__output_t *out, va_list args);
271 int pe__node_xml(pcmk__output_t *out, va_list args);
272 int pe__resource_xml(pcmk__output_t *out, va_list args);
273 int pe__resource_html(pcmk__output_t *out, va_list args);
274 int pe__resource_text(pcmk__output_t *out, va_list args);
275 
276 /* Exported for crm_mon to reference */
277 int pe__ban_text(pcmk__output_t *out, va_list args);
278 int pe__cluster_counts_text(pcmk__output_t *out, va_list args);
279 int pe__cluster_dc_text(pcmk__output_t *out, va_list args);
280 int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args);
281 int pe__cluster_options_text(pcmk__output_t *out, va_list args);
282 int pe__cluster_stack_text(pcmk__output_t *out, va_list args);
283 int pe__cluster_summary(pcmk__output_t *out, va_list args);
284 int pe__cluster_times_text(pcmk__output_t *out, va_list args);
285 int pe__failed_action_text(pcmk__output_t *out, va_list args);
286 int pe__node_attribute_text(pcmk__output_t *out, va_list args);
287 int pe__node_list_text(pcmk__output_t *out, va_list args);
288 int pe__op_history_text(pcmk__output_t *out, va_list args);
289 int pe__resource_history_text(pcmk__output_t *out, va_list args);
290 int pe__ticket_text(pcmk__output_t *out, va_list args);
291 
292 void native_free(pe_resource_t * rsc);
293 void group_free(pe_resource_t * rsc);
294 void clone_free(pe_resource_t * rsc);
295 void pe__free_bundle(pe_resource_t *rsc);
296 
297 enum rsc_role_e native_resource_state(const pe_resource_t * rsc, gboolean current);
298 enum rsc_role_e group_resource_state(const pe_resource_t * rsc, gboolean current);
299 enum rsc_role_e clone_resource_state(const pe_resource_t * rsc, gboolean current);
301  gboolean current);
302 
305 
306 gboolean common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, pe_resource_t * parent,
307  pe_working_set_t * data_set);
308 void common_free(pe_resource_t * rsc);
309 
310 pe_node_t *pe__copy_node(const pe_node_t *this_node);
311 extern time_t get_effective_time(pe_working_set_t * data_set);
312 
313 /* Failure handling utilities (from failcounts.c) */
314 
315 // bit flags for fail count handling options
317  pe_fc_default = (1 << 0),
318  pe_fc_effective = (1 << 1), // don't count expired failures
319  pe_fc_fillers = (1 << 2), // if container, include filler failures in count
320 };
321 
322 int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure,
323  uint32_t flags, xmlNode *xml_op,
324  pe_working_set_t *data_set);
325 
327  const char *reason,
328  pe_working_set_t *data_set);
329 
330 /* Functions for finding/counting a resource's active nodes */
331 
333  unsigned int *count_all,
334  unsigned int *count_clean);
336  unsigned int *count);
337 
338 static inline pe_node_t *
339 pe__current_node(const pe_resource_t *rsc)
340 {
341  return pe__find_active_on(rsc, NULL, NULL);
342 }
343 
344 
345 /* Binary like operators for lists of nodes */
346 extern void node_list_exclude(GHashTable * list, GList *list2, gboolean merge_scores);
347 
348 GHashTable *pe__node_list2table(GList *list);
349 
350 static inline gpointer
351 pe_hash_table_lookup(GHashTable * hash, gconstpointer key)
352 {
353  if (hash) {
354  return g_hash_table_lookup(hash, key);
355  }
356  return NULL;
357 }
358 
359 extern pe_action_t *get_pseudo_op(const char *name, pe_working_set_t * data_set);
360 extern gboolean order_actions(pe_action_t * lh_action, pe_action_t * rh_action, enum pe_ordering order);
361 
362 /* Printing functions for debug */
363 extern void print_str_str(gpointer key, gpointer value, gpointer user_data);
364 extern void pe__output_node(pe_node_t * node, gboolean details, pcmk__output_t *out);
365 
366 void pe__show_node_weights_as(const char *file, const char *function,
367  int line, bool to_log, pe_resource_t *rsc,
368  const char *comment, GHashTable *nodes,
369  pe_working_set_t *data_set);
370 
371 #define pe__show_node_weights(level, rsc, text, nodes, data_set) \
372  pe__show_node_weights_as(__FILE__, __func__, __LINE__, \
373  (level), (rsc), (text), (nodes), (data_set))
374 
375 /* Sorting functions */
376 extern gint sort_rsc_priority(gconstpointer a, gconstpointer b);
377 extern gint sort_rsc_index(gconstpointer a, gconstpointer b);
378 
379 extern xmlNode *find_rsc_op_entry(pe_resource_t * rsc, const char *key);
380 
381 extern pe_action_t *custom_action(pe_resource_t * rsc, char *key, const char *task, pe_node_t * on_node,
382  gboolean optional, gboolean foo, pe_working_set_t * data_set);
383 
384 # define delete_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DELETE, 0)
385 # define delete_action(rsc, node, optional) custom_action( \
386  rsc, delete_key(rsc), CRMD_ACTION_DELETE, node, \
387  optional, TRUE, data_set);
388 
389 # define stopped_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOPPED, 0)
390 # define stopped_action(rsc, node, optional) custom_action( \
391  rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node, \
392  optional, TRUE, data_set);
393 
394 # define stop_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOP, 0)
395 # define stop_action(rsc, node, optional) custom_action( \
396  rsc, stop_key(rsc), CRMD_ACTION_STOP, node, \
397  optional, TRUE, data_set);
398 
399 # define reload_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_RELOAD_AGENT, 0)
400 # define start_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_START, 0)
401 # define start_action(rsc, node, optional) custom_action( \
402  rsc, start_key(rsc), CRMD_ACTION_START, node, \
403  optional, TRUE, data_set)
404 
405 # define started_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STARTED, 0)
406 # define started_action(rsc, node, optional) custom_action( \
407  rsc, started_key(rsc), CRMD_ACTION_STARTED, node, \
408  optional, TRUE, data_set)
409 
410 # define promote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTE, 0)
411 # define promote_action(rsc, node, optional) custom_action( \
412  rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node, \
413  optional, TRUE, data_set)
414 
415 # define promoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTED, 0)
416 # define promoted_action(rsc, node, optional) custom_action( \
417  rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node, \
418  optional, TRUE, data_set)
419 
420 # define demote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTE, 0)
421 # define demote_action(rsc, node, optional) custom_action( \
422  rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node, \
423  optional, TRUE, data_set)
424 
425 # define demoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTED, 0)
426 # define demoted_action(rsc, node, optional) custom_action( \
427  rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node, \
428  optional, TRUE, data_set)
429 
430 extern int pe_get_configured_timeout(pe_resource_t *rsc, const char *action,
431  pe_working_set_t *data_set);
432 
433 extern pe_action_t *find_first_action(GList *input, const char *uuid, const char *task,
434  pe_node_t * on_node);
435 extern enum action_tasks get_complex_task(pe_resource_t * rsc, const char *name,
436  gboolean allow_non_atomic);
437 
438 extern GList *find_actions(GList *input, const char *key, const pe_node_t *on_node);
439 GList *find_actions_exact(GList *input, const char *key,
440  const pe_node_t *on_node);
441 extern GList *find_recurring_actions(GList *input, pe_node_t * not_on_node);
442 GList *pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node,
443  const char *task, bool require_node);
444 
445 extern void pe_free_action(pe_action_t * action);
446 
447 extern void resource_location(pe_resource_t * rsc, pe_node_t * node, int score, const char *tag,
448  pe_working_set_t * data_set);
449 
450 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
451 extern gboolean get_target_role(pe_resource_t * rsc, enum rsc_role_e *role);
452 void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role,
453  const char *why);
454 
455 extern pe_resource_t *find_clone_instance(pe_resource_t * rsc, const char *sub_id,
456  pe_working_set_t * data_set);
457 
458 extern void destroy_ticket(gpointer data);
459 extern pe_ticket_t *ticket_new(const char *ticket_id, pe_working_set_t * data_set);
460 
461 // Resources for manipulating resource names
462 const char *pe_base_name_end(const char *id);
463 char *clone_strip(const char *last_rsc_id);
464 char *clone_zero(const char *last_rsc_id);
465 
466 static inline bool
467 pe_base_name_eq(pe_resource_t *rsc, const char *id)
468 {
469  if (id && rsc && rsc->id) {
470  // Number of characters in rsc->id before any clone suffix
471  size_t base_len = pe_base_name_end(rsc->id) - rsc->id + 1;
472 
473  return (strlen(id) == base_len) && !strncmp(id, rsc->id, base_len);
474  }
475  return FALSE;
476 }
477 
478 int pe__target_rc_from_xml(xmlNode *xml_op);
479 
480 gint sort_node_uname(gconstpointer a, gconstpointer b);
481 bool is_set_recursive(pe_resource_t * rsc, long long flag, bool any);
482 
493 };
494 
495 typedef struct op_digest_cache_s {
497  xmlNode *params_all;
498  xmlNode *params_secure;
499  xmlNode *params_restart;
504 
506  guint *interval_ms, pe_node_t *node,
507  xmlNode *xml_op, GHashTable *overrides,
508  bool calc_secure,
509  pe_working_set_t *data_set);
510 
511 void pe__free_digests(gpointer ptr);
512 
513 op_digest_cache_t *rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node,
514  pe_working_set_t * data_set);
515 
516 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);
517 void trigger_unfencing(
518  pe_resource_t * rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t * data_set);
519 
520 void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite);
521 void pe_action_set_flag_reason(const char *function, long line, pe_action_t *action, pe_action_t *reason, const char *text, enum pe_action_flags flags, bool overwrite);
522 
523 #define pe_action_required(action, reason, text) \
524  pe_action_set_flag_reason(__func__, __LINE__, action, reason, text, \
525  pe_action_optional, FALSE)
526 #define pe_action_implies(action, reason, flag) \
527  pe_action_set_flag_reason(__func__, __LINE__, action, reason, NULL, \
528  flag, FALSE)
529 
532 void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag);
533 
534 gboolean add_tag_ref(GHashTable * tags, const char * tag_name, const char * obj_ref);
535 
536 void print_rscs_brief(GList *rsc_list, const char * pre_text, long options,
537  void * print_data, gboolean print_all);
538 int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, long options, gboolean print_all);
539 void pe_fence_node(pe_working_set_t * data_set, pe_node_t * node, const char *reason, bool priority_delay);
540 
541 pe_node_t *pe_create_node(const char *id, const char *uname, const char *type,
542  const char *score, pe_working_set_t * data_set);
543 void common_print(pe_resource_t * rsc, const char *pre_text, const char *name, pe_node_t *node, long options, void *print_data);
544 int pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options);
545 int pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options);
547  const pe_node_t *node);
549  pe_working_set_t *data_set);
551  pe_working_set_t *data_set,
552  xmlNode *xml, const char *field);
553 const char *pe_node_attribute_calculated(const pe_node_t *node,
554  const char *name,
555  const pe_resource_t *rsc);
556 const char *pe_node_attribute_raw(pe_node_t *node, const char *name);
558  pe_working_set_t *data_set);
559 void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node,
560  enum pe_check_parameters, pe_working_set_t *data_set);
562  void (*cb)(pe_resource_t*, pe_node_t*, xmlNode*,
563  enum pe_check_parameters,
564  pe_working_set_t*));
566 
568 void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set);
569 
575 
576 void pe__unpack_dataset_nvpairs(xmlNode *xml_obj, const char *set_name,
577  pe_rule_eval_data_t *rule_data, GHashTable *hash,
578  const char *always_first, gboolean overwrite,
579  pe_working_set_t *data_set);
580 
583  pe_working_set_t *data_set);
584 
585 GList *pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name);
586 GList *pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name);
587 bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag);
588 bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag);
589 
590 bool pe__rsc_running_on_any_node_in_list(pe_resource_t *rsc, GList *node_list);
591 GList *pe__filter_rsc_list(GList *rscs, GList *filter);
592 GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s);
593 GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s);
594 
595 bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node);
596 
597 gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
598 gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
599 gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
600 gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent);
601 
602 #endif
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:302
pe_action_t * lh_action
Definition: internal.h:182
enum rsc_role_e role_filter
Definition: internal.h:171
void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
Definition: utils.c:1920
bool is_set_recursive(pe_resource_t *rsc, long long flag, bool any)
Definition: clone.c:363
GHashTable * pe__node_list2table(GList *list)
Definition: utils.c:204
int pe__common_output_html(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, long options)
Definition: native.c:676
int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:905
int pe__target_rc_from_xml(xmlNode *xml_op)
Definition: unpack.c:3508
const char * pe_node_attribute_calculated(const pe_node_t *node, const char *name, const pe_resource_t *rsc)
Definition: common.c:596
void group_free(pe_resource_t *rsc)
Definition: group.c:345
char data[0]
Definition: cpg.c:55
gint sort_rsc_priority(gconstpointer a, gconstpointer b)
Definition: utils.c:362
GList * find_recurring_actions(GList *input, pe_node_t *not_on_node)
Definition: utils.c:1365
gint sort_rsc_index(gconstpointer a, gconstpointer b)
Definition: utils.c:335
int pe__failed_action_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:1164
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: group.c:135
int pe__ticket_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:2606
void pe_metadata(void)
Definition: common.c:292
pe_check_parameters
Definition: pe_types.h:195
GHashTable * allowed_nodes
Definition: internal.h:209
int pe__cluster_summary(pcmk__output_t *out, va_list args)
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:999
GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s)
Definition: utils.c:2464
GList * start
Definition: internal.h:203
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
Definition: utils.c:2321
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, long options, gboolean print_all)
Definition: native.c:1262
void pe__free_bundle(pe_resource_t *rsc)
Definition: bundle.c:1973
GList * find_actions(GList *input, const char *key, const pe_node_t *on_node)
Definition: utils.c:1452
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: bundle.c:2007
struct op_digest_cache_s op_digest_cache_t
void pe__count_common(pe_resource_t *rsc)
Definition: complex.c:1088
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: group.c:385
int pe__cluster_options_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:992
gboolean group_active(pe_resource_t *rsc, gboolean all)
Definition: group.c:90
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
Definition: native.c:1052
void pe_action_set_flag_reason(const char *function, long line, pe_action_t *action, pe_action_t *reason, const char *text, enum pe_action_flags flags, bool overwrite)
Definition: utils.c:2214
pe_node_t * pe__copy_node(const pe_node_t *this_node)
Definition: utils.c:142
int pe__cluster_times_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:1147
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:949
int pe__cluster_counts_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:763
void print_rscs_brief(GList *rsc_list, const char *pre_text, long options, void *print_data, gboolean print_all)
Definition: native.c:1183
void node_list_exclude(GHashTable *list, GList *list2, gboolean merge_scores)
Definition: utils.c:161
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
Definition: utils.c:1632
time_t get_effective_time(pe_working_set_t *data_set)
Definition: utils.c:1749
pe_action_t * rh_action
Definition: internal.h:187
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:1588
xmlNode * params_restart
Definition: internal.h:499
int pe__ban_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:616
enum crm_ais_msg_types type
Definition: cpg.c:48
pe_resource_t * rsc_lh
Definition: internal.h:170
int pe__resource_text(pcmk__output_t *out, va_list args)
Definition: native.c:999
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: bundle.c:1871
pe_discover_e
Definition: pe_types.h:475
GList * inactive
Definition: internal.h:202
int pe__group_text(pcmk__output_t *out, va_list args)
Definition: group.c:291
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: bundle.c:1013
char * pe__node_display_name(pe_node_t *node, bool print_detail)
Definition: pe_output.c:500
int pe__bundle_html(pcmk__output_t *out, va_list args)
Definition: bundle.c:1597
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:1022
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:321
int pe__op_history_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:2181
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:2143
void clone_free(pe_resource_t *rsc)
Definition: clone.c:1142
void pe__unpack_dataset_nvpairs(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:2335
int pe__clone_html(pcmk__output_t *out, va_list args)
Definition: clone.c:668
int pe__node_list_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:1920
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
Definition: utils.c:2412
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: group.c:366
void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
Definition: utils.c:1938
GList * active
Definition: internal.h:201
pe_resource_t * pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node)
Definition: bundle.c:1386
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: clone.c:1176
enum pe_discover_e discover_mode
Definition: internal.h:172
Formatted output for pacemaker tools.
GList * stop
Definition: internal.h:204
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
Definition: utils.c:2272
pe_action_flags
Definition: pe_types.h:291
gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: native.c:1339
struct pe__order_constraint_s pe__ordering_t
int pe__bundle_text(pcmk__output_t *out, va_list args)
Definition: bundle.c:1739
pe_action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
Definition: utils.c:1848
gboolean clone_active(pe_resource_t *rsc, gboolean all)
Definition: clone.c:261
char * digest_all_calc
Definition: internal.h:500
char * clone_strip(const char *last_rsc_id)
Definition: unpack.c:1634
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:552
pe_action_t * post
Definition: internal.h:197
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:1876
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:323
int pe__group_html(pcmk__output_t *out, va_list args)
Definition: group.c:236
enum action_tasks get_complex_task(pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
Definition: utils.c:1399
enum rsc_digest_cmp_val rc
Definition: internal.h:496
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:97
int pe__clone_xml(pcmk__output_t *out, va_list args)
Definition: clone.c:610
char * digest_secure_calc
Definition: internal.h:501
GList * promote
Definition: internal.h:206
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:114
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
Definition: utils.c:1764
bool pe__shutdown_requested(pe_node_t *node)
Definition: utils.c:2306
pe_resource_t * find_clone_instance(pe_resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
Definition: clone.c:50
void common_free(pe_resource_t *rsc)
Definition: complex.c:917
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
Definition: utils.c:1802
unsigned long long flags
Definition: pe_types.h:347
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
Definition: utils.c:1321
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
Definition: utils.c:2178
pe_resource_t * lh_rsc
Definition: internal.h:181
int pe__resource_history_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:2304
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
Definition: native.c:1029
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
Definition: common.c:635
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: clone.c:394
GSList * keys
Definition: internal.h:192
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
Definition: native.c:878
enum pe_ordering type
Definition: internal.h:178
gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: bundle.c:2058
void pe__free_digests(gpointer ptr)
Definition: pe_digest.c:34
void pe__register_messages(pcmk__output_t *out)
Definition: pe_output.c:2767
GList * promoted
Definition: internal.h:207
int pe__cluster_dc_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:861
int pe_get_configured_timeout(pe_resource_t *rsc, const char *action, pe_working_set_t *data_set)
Definition: utils.c:847
void common_update_score(pe_resource_t *rsc, const char *id, int score)
Definition: complex.c:864
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:763
xmlNode * params_all
Definition: internal.h:497
pe_warn_once_e
Definition: internal.h:141
void pe__free_param_checks(pe_working_set_t *data_set)
Definition: remote.c:261
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:967
gboolean native_active(pe_resource_t *rsc, gboolean all)
Definition: native.c:347
pe_action_t * post_done
Definition: internal.h:199
int pe__resource_xml(pcmk__output_t *out, va_list args)
Definition: native.c:900
bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node)
Definition: utils.c:90
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
Definition: utils.c:2432
uint32_t pe_wo
Definition: unpack.c:68
int pe__bundle_xml(pcmk__output_t *out, va_list args)
Definition: bundle.c:1474
Cluster status and scheduling.
bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node)
Definition: utils.c:2406
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
Definition: native.c:267
GList * unpromoted
Definition: internal.h:208
int pe__clone_text(pcmk__output_t *out, va_list args)
Definition: clone.c:908
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:579
int pe__add_scores(int score1, int score2)
Definition: common.c:516
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: clone.c:120
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:304
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:364
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:392
int pe__cluster_stack_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:1081
bool pe__rsc_running_on_any_node_in_list(pe_resource_t *rsc, GList *node_list)
Definition: utils.c:2393
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
Definition: complex.c:1116
char * clone_zero(const char *last_rsc_id)
Definition: unpack.c:1656
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:185
This structure contains everything that makes up a single output formatter.
xmlNode * params_secure
Definition: internal.h:498
void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag)
Definition: utils.c:1929
int pe__node_attribute_text(pcmk__output_t *out, va_list args)
Definition: pe_output.c:1494
void native_add_running(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, gboolean failed)
Definition: native.c:89
char uname[MAX_NAME]
Definition: cpg.c:50
GList * demote
Definition: internal.h:205
int pe__resource_html(pcmk__output_t *out, va_list args)
Definition: native.c:975
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:1202
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:390
void destroy_ticket(gpointer data)
Definition: utils.c:1864
pe_resource_t * rh_rsc
Definition: internal.h:186
gchar * pcmk__native_output_string(pe_resource_t *rsc, const char *name, pe_node_t *node, long options, const char *target_role, bool show_nodes)
Definition: native.c:544
int pe__node_html(pcmk__output_t *out, va_list args)
gboolean common_unpack(xmlNode *xml_obj, pe_resource_t **rsc, pe_resource_t *parent, pe_working_set_t *data_set)
Definition: complex.c:493
GList * find_actions_exact(GList *input, const char *key, const pe_node_t *on_node)
Definition: utils.c:1492
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
Definition: complex.c:1079
struct notify_data_s notify_data_t
bool pe__resource_is_disabled(pe_resource_t *rsc)
Definition: utils.c:2353
void pe__output_node(pe_node_t *node, gboolean details, pcmk__output_t *out)
Definition: pe_output.c:2772
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: utils.c:1540
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
Definition: utils.c:2381
void print_str_str(gpointer key, gpointer value, gpointer user_data)
Definition: utils.c:1330
const char * action
Definition: internal.h:194
char * name
Definition: pcmk_fence.c:31
pe_fc_flags_e
Definition: internal.h:316
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:197
int pe__common_output_text(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, long options)
Definition: native.c:732
gint sort_node_uname(gconstpointer a, gconstpointer b)
Definition: utils.c:218
const char * pe_base_name_end(const char *id)
Definition: unpack.c:1594
gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
Definition: clone.c:1217
struct pe__location_constraint_s pe__location_t
char * digest_restart_calc
Definition: internal.h:502
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
Definition: utils.c:1422
void pe__count_bundle(pe_resource_t *rsc)
Definition: bundle.c:2034
pe_action_t * pre_done
Definition: internal.h:198
pe_ordering
Definition: pe_types.h:482
uint64_t flags
Definition: remote.c:149
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:62
pe_action_t * pre
Definition: internal.h:196
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: utils.c:2035
void pe_free_action(pe_action_t *action)
Definition: utils.c:1338
rsc_digest_cmp_val
Definition: internal.h:483
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
Definition: bundle.c:1338
char * id
Definition: pe_types.h:320
pe_action_t * custom_action(pe_resource_t *rsc, char *key, const char *task, pe_node_t *on_node, gboolean optional, gboolean foo, pe_working_set_t *data_set)
Definition: utils.c:415
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
Definition: group.c:23