10 #ifndef PE_INTERNAL__H
11 # define PE_INTERNAL__H
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)
22 # define pe_err(fmt...) do { \
23 was_processing_error = TRUE; \
24 pcmk__config_err(fmt); \
27 # define pe_warn(fmt...) do { \
28 was_processing_warning = TRUE; \
29 pcmk__config_warn(fmt); \
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); }
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); \
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); \
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); \
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); \
59 #define pe__set_action_flags(action, flags_to_set) do { \
60 (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
62 "Action", (action)->uuid, \
68 #define pe__clear_action_flags(action, flags_to_clear) do { \
69 (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
71 "Action", (action)->uuid, \
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, \
81 (flags_to_set), #flags_to_set); \
84 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
85 action_flags = pcmk__clear_flags_as(__func__, __LINE__, \
87 "Action", action_name, \
93 #define pe__set_action_flags_as(function, line, action, flags_to_set) do { \
94 (action)->flags = pcmk__set_flags_as((function), (line), \
96 "Action", (action)->uuid, \
102 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
103 (action)->flags = pcmk__clear_flags_as((function), (line), \
105 "Action", (action)->uuid, \
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), \
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), \
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); \
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); \
152 extern uint32_t
pe_wo;
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) { \
161 pe_wo = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
162 "Warn-once", "logging", pe_wo, \
163 (pe_wo_bit), #pe_wo_bit); \
248 long options,
const char *target_role,
bool show_nodes);
251 ,
size_t pairs_count, ...);
254 static inline const char *
323 uint32_t
flags, xmlNode *xml_op,
333 unsigned int *count_all,
334 unsigned int *count_clean);
336 unsigned int *count);
346 extern void node_list_exclude(GHashTable * list, GList *list2, gboolean merge_scores);
350 static inline gpointer
351 pe_hash_table_lookup(GHashTable * hash, gconstpointer key)
354 return g_hash_table_lookup(hash, key);
363 extern void print_str_str(gpointer key, gpointer value, gpointer user_data);
368 const char *comment, GHashTable *nodes,
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))
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);
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);
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);
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)
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)
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)
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)
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)
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)
436 gboolean allow_non_atomic);
443 const char *task,
bool require_node);
469 if (
id && rsc && rsc->
id) {
473 return (strlen(
id) == base_len) && !strncmp(
id, rsc->
id, base_len);
507 xmlNode *xml_op, GHashTable *overrides,
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, \
534 gboolean
add_tag_ref(GHashTable * tags,
const char * tag_name,
const char * obj_ref);
537 void * print_data, gboolean print_all);
552 xmlNode *xml,
const char *field);
578 const char *always_first, gboolean overwrite,
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 *))
void verify_pe_options(GHashTable *options)
enum rsc_role_e role_filter
void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
bool is_set_recursive(pe_resource_t *rsc, long long flag, bool any)
GHashTable * pe__node_list2table(GList *list)
int pe__common_output_html(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, long options)
int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args)
int pe__target_rc_from_xml(xmlNode *xml_op)
const char * pe_node_attribute_calculated(const pe_node_t *node, const char *name, const pe_resource_t *rsc)
void group_free(pe_resource_t *rsc)
gint sort_rsc_priority(gconstpointer a, gconstpointer b)
GList * find_recurring_actions(GList *input, pe_node_t *not_on_node)
gint sort_rsc_index(gconstpointer a, gconstpointer b)
int pe__failed_action_text(pcmk__output_t *out, va_list args)
void group_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
int pe__ticket_text(pcmk__output_t *out, va_list args)
GHashTable * allowed_nodes
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)
pe_node_t * pe__find_active_on(const pe_resource_t *rsc, unsigned int *count_all, unsigned int *count_clean)
GList * pe__build_rsc_list(pe_working_set_t *data_set, const char *s)
void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set)
int pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, long options, gboolean print_all)
void pe__free_bundle(pe_resource_t *rsc)
GList * find_actions(GList *input, const char *key, const pe_node_t *on_node)
enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc, gboolean current)
struct op_digest_cache_s op_digest_cache_t
void pe__count_common(pe_resource_t *rsc)
gboolean pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
int pe__cluster_options_text(pcmk__output_t *out, va_list args)
gboolean group_active(pe_resource_t *rsc, gboolean all)
pe_node_t * native_location(const pe_resource_t *rsc, GList **list, int current)
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)
pe_node_t * pe__copy_node(const pe_node_t *this_node)
int pe__cluster_times_text(pcmk__output_t *out, va_list args)
bool pe__bundle_needs_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set)
int pe__cluster_counts_text(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)
void node_list_exclude(GHashTable *list, GList *list2, gboolean merge_scores)
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
time_t get_effective_time(pe_working_set_t *data_set)
void resource_location(pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
int pe__ban_text(pcmk__output_t *out, va_list args)
enum crm_ais_msg_types type
int pe__resource_text(pcmk__output_t *out, va_list args)
void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
int pe__group_text(pcmk__output_t *out, va_list args)
gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set)
char * pe__node_display_name(pe_node_t *node, bool print_detail)
int pe__bundle_html(pcmk__output_t *out, va_list args)
bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag)
void native_free(pe_resource_t *rsc)
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)
int pe__op_history_text(pcmk__output_t *out, va_list args)
GList * pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name)
void trigger_unfencing(pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
void clone_free(pe_resource_t *rsc)
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)
int pe__clone_html(pcmk__output_t *out, va_list args)
int pe__node_list_text(pcmk__output_t *out, va_list args)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
enum rsc_role_e group_resource_state(const pe_resource_t *rsc, gboolean current)
void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags)
pe_resource_t * pe__find_bundle_replica(const pe_resource_t *bundle, const pe_node_t *node)
enum rsc_role_e clone_resource_state(const pe_resource_t *rsc, gboolean current)
enum pe_discover_e discover_mode
Formatted output for pacemaker tools.
void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite)
gboolean pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
struct pe__order_constraint_s pe__ordering_t
int pe__bundle_text(pcmk__output_t *out, va_list args)
pe_action_t * get_pseudo_op(const char *name, pe_working_set_t *data_set)
gboolean clone_active(pe_resource_t *rsc, gboolean all)
char * clone_strip(const char *last_rsc_id)
int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name, size_t pairs_count,...)
bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag)
pe_ticket_t * ticket_new(const char *ticket_id, pe_working_set_t *data_set)
char * native_parameter(pe_resource_t *rsc, pe_node_t *node, gboolean create, const char *name, pe_working_set_t *data_set)
int pe__group_html(pcmk__output_t *out, va_list args)
enum action_tasks get_complex_task(pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
enum rsc_digest_cmp_val rc
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.
int pe__clone_xml(pcmk__output_t *out, va_list args)
char * digest_secure_calc
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
gboolean get_target_role(pe_resource_t *rsc, enum rsc_role_e *role)
bool pe__shutdown_requested(pe_node_t *node)
pe_resource_t * find_clone_instance(pe_resource_t *rsc, const char *sub_id, pe_working_set_t *data_set)
void common_free(pe_resource_t *rsc)
gboolean order_actions(pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
xmlNode * find_rsc_op_entry(pe_resource_t *rsc, const char *key)
gboolean add_tag_ref(GHashTable *tags, const char *tag_name, const char *obj_ref)
int pe__resource_history_text(pcmk__output_t *out, va_list args)
enum rsc_role_e native_resource_state(const pe_resource_t *rsc, gboolean current)
const char * pe_node_attribute_raw(pe_node_t *node, const char *name)
void clone_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
void native_print(pe_resource_t *rsc, const char *pre_text, long options, void *print_data)
gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
void pe__free_digests(gpointer ptr)
void pe__register_messages(pcmk__output_t *out)
int pe__cluster_dc_text(pcmk__output_t *out, va_list args)
int pe_get_configured_timeout(pe_resource_t *rsc, const char *action, pe_working_set_t *data_set)
void common_update_score(pe_resource_t *rsc, const char *id, int score)
void common_print(pe_resource_t *rsc, const char *pre_text, const char *name, pe_node_t *node, long options, void *print_data)
void pe__free_param_checks(pe_working_set_t *data_set)
const char * pe__add_bundle_remote_name(pe_resource_t *rsc, pe_working_set_t *data_set, xmlNode *xml, const char *field)
gboolean native_active(pe_resource_t *rsc, gboolean all)
int pe__resource_xml(pcmk__output_t *out, va_list args)
bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node)
GList * pe__build_node_name_list(pe_working_set_t *data_set, const char *s)
int pe__bundle_xml(pcmk__output_t *out, va_list args)
Cluster status and scheduling.
bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GList *only_node)
pe_resource_t * native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node, int flags)
int pe__clone_text(pcmk__output_t *out, va_list args)
int pe__node_text(pcmk__output_t *out, va_list args)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
int pe__add_scores(int score1, int score2)
gboolean clone_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
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)
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.
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)
int pe__cluster_stack_text(pcmk__output_t *out, va_list args)
bool pe__rsc_running_on_any_node_in_list(pe_resource_t *rsc, GList *node_list)
void pe__set_next_role(pe_resource_t *rsc, enum rsc_role_e role, const char *why)
char * clone_zero(const char *last_rsc_id)
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.
void pe__clear_resource_flags_on_all(pe_working_set_t *data_set, uint64_t flag)
int pe__node_attribute_text(pcmk__output_t *out, va_list args)
void native_add_running(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, gboolean failed)
int pe__resource_html(pcmk__output_t *out, va_list args)
rsc_role_e
Possible roles that a resource can be in.
bool pe__is_universal_clone(pe_resource_t *rsc, pe_working_set_t *data_set)
pe_node_t * pe_create_node(const char *id, const char *uname, const char *type, const char *score, pe_working_set_t *data_set)
void destroy_ticket(gpointer data)
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)
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)
GList * find_actions_exact(GList *input, const char *key, const pe_node_t *on_node)
pe_node_t * pe__find_active_requires(const pe_resource_t *rsc, unsigned int *count)
struct notify_data_s notify_data_t
bool pe__resource_is_disabled(pe_resource_t *rsc)
void pe__output_node(pe_node_t *node, gboolean details, pcmk__output_t *out)
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.
pe_action_t * pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
void print_str_str(gpointer key, gpointer value, gpointer user_data)
GList * pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name)
gboolean native_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)
int pe__common_output_text(pcmk__output_t *out, pe_resource_t *rsc, const char *name, pe_node_t *node, long options)
gint sort_node_uname(gconstpointer a, gconstpointer b)
const char * pe_base_name_end(const char *id)
gboolean pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
struct pe__location_constraint_s pe__location_t
char * digest_restart_calc
pe_action_t * find_first_action(GList *input, const char *uuid, const char *task, pe_node_t *on_node)
void pe__count_bundle(pe_resource_t *rsc)
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)
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)
void pe_free_action(pe_action_t *action)
gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all)
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)
gboolean group_unpack(pe_resource_t *rsc, pe_working_set_t *data_set)