pacemaker  2.0.4-2deceaa3ae
Scalable High-Availability cluster resource manager
Macros | Functions
utils.c File Reference
#include <crm_internal.h>
#include <crm/crm.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/util.h>
#include <ctype.h>
#include <glib.h>
#include <stdbool.h>
#include <crm/pengine/rules.h>
#include <crm/pengine/internal.h>
Include dependency graph for utils.c:

Go to the source code of this file.

Macros

#define sort_return(an_int, why)
 
#define STONITH_DIGEST_TASK   "stonith-on"
 

Functions

xmlNode * get_object_root (const char *object_type, xmlNode *the_root)
 
void print_str_str (gpointer key, gpointer value, gpointer user_data)
 
gboolean ghash_free_str_str (gpointer key, gpointer value, gpointer user_data)
 
void unpack_operation (pe_action_t *action, xmlNode *xml_obj, pe_resource_t *container, pe_working_set_t *data_set)
 Unpack operation XML into an action structure. More...
 
bool pe_can_fence (pe_working_set_t *data_set, pe_node_t *node)
 
pe_node_tpe__copy_node (const pe_node_t *this_node)
 
void node_list_exclude (GHashTable *hash, GListPtr list, gboolean merge_scores)
 
GHashTable * pe__node_list2table (GList *list)
 
gint sort_node_uname (gconstpointer a, gconstpointer b)
 
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)
 
void dump_node_capacity (int level, const char *comment, pe_node_t *node)
 
void dump_rsc_utilization (int level, const char *comment, pe_resource_t *rsc, pe_node_t *node)
 
gint sort_rsc_index (gconstpointer a, gconstpointer b)
 
gint sort_rsc_priority (gconstpointer a, gconstpointer b)
 
pe_action_tcustom_action (pe_resource_t *rsc, char *key, const char *task, pe_node_t *on_node, gboolean optional, gboolean save_action, pe_working_set_t *data_set)
 
int pe_get_configured_timeout (pe_resource_t *rsc, const char *action, pe_working_set_t *data_set)
 
xmlNode * find_rsc_op_entry (pe_resource_t *rsc, const char *key)
 
void print_node (const char *pre_text, pe_node_t *node, gboolean details)
 
void pe_free_action (pe_action_t *action)
 
GListPtr find_recurring_actions (GListPtr input, pe_node_t *not_on_node)
 
enum action_tasks get_complex_task (pe_resource_t *rsc, const char *name, gboolean allow_non_atomic)
 
pe_action_tfind_first_action (GListPtr input, const char *uuid, const char *task, pe_node_t *on_node)
 
GListPtr find_actions (GListPtr input, const char *key, const pe_node_t *on_node)
 
GList * find_actions_exact (GList *input, const char *key, const pe_node_t *on_node)
 
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. More...
 
void resource_location (pe_resource_t *rsc, pe_node_t *node, int score, const char *tag, pe_working_set_t *data_set)
 
gint sort_op_by_callid (gconstpointer a, gconstpointer b)
 
time_t get_effective_time (pe_working_set_t *data_set)
 
gboolean get_target_role (pe_resource_t *rsc, enum rsc_role_e *role)
 
gboolean order_actions (pe_action_t *lh_action, pe_action_t *rh_action, enum pe_ordering order)
 
pe_action_tget_pseudo_op (const char *name, pe_working_set_t *data_set)
 
void destroy_ticket (gpointer data)
 
pe_ticket_tticket_new (const char *ticket_id, pe_working_set_t *data_set)
 
op_digest_cache_trsc_action_digest_cmp (pe_resource_t *rsc, xmlNode *xml_op, pe_node_t *node, pe_working_set_t *data_set)
 
const char * rsc_printable_id (pe_resource_t *rsc)
 
void clear_bit_recursive (pe_resource_t *rsc, unsigned long long flag)
 
void set_bit_recursive (pe_resource_t *rsc, unsigned long long flag)
 
pe_action_tpe_fence_op (pe_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t *data_set)
 
void trigger_unfencing (pe_resource_t *rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t *data_set)
 
gboolean add_tag_ref (GHashTable *tags, const char *tag_name, const char *obj_ref)
 
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)
 
void pe_action_set_reason (pe_action_t *action, const char *reason, bool overwrite)
 
bool pe__shutdown_requested (pe_node_t *node)
 
void pe__update_recheck_time (time_t recheck, pe_working_set_t *data_set)
 
void pe__unpack_dataset_nvpairs (xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, pe_working_set_t *data_set)
 
bool pe__resource_is_disabled (pe_resource_t *rsc)
 
pe_action_tpe__clear_resource_history (pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set)
 
bool pe__rsc_running_on_any_node_in_list (pe_resource_t *rsc, GListPtr node_list)
 
bool pcmk__rsc_is_filtered (pe_resource_t *rsc, GListPtr only_show)
 

Macro Definition Documentation

◆ sort_return

#define sort_return (   an_int,
  why 
)
Value:
do { \
free(a_uuid); \
free(b_uuid); \
crm_trace("%s (%d) %c %s (%d) : %s", \
a_xml_id, a_call_id, an_int>0?'>':an_int<0?'<':'=', \
b_xml_id, b_call_id, why); \
return an_int; \
} while(0)

Definition at line 1706 of file utils.c.

◆ STONITH_DIGEST_TASK

#define STONITH_DIGEST_TASK   "stonith-on"

Definition at line 2273 of file utils.c.

Function Documentation

◆ add_tag_ref()

gboolean add_tag_ref ( GHashTable *  tags,
const char *  tag_name,
const char *  obj_ref 
)

Definition at line 2601 of file utils.c.

◆ clear_bit_recursive()

void clear_bit_recursive ( pe_resource_t rsc,
unsigned long long  flag 
)

Definition at line 2348 of file utils.c.

◆ custom_action()

pe_action_t* custom_action ( pe_resource_t rsc,
char *  key,
const char *  task,
pe_node_t on_node,
gboolean  optional,
gboolean  save_action,
pe_working_set_t data_set 
)

Definition at line 510 of file utils.c.

◆ destroy_ticket()

void destroy_ticket ( gpointer  data)

Definition at line 1955 of file utils.c.

◆ dump_node_capacity()

void dump_node_capacity ( int  level,
const char *  comment,
pe_node_t node 
)

Definition at line 395 of file utils.c.

◆ dump_rsc_utilization()

void dump_rsc_utilization ( int  level,
const char *  comment,
pe_resource_t rsc,
pe_node_t node 
)

Definition at line 412 of file utils.c.

◆ find_actions()

GListPtr find_actions ( GListPtr  input,
const char *  key,
const pe_node_t on_node 
)

Definition at line 1535 of file utils.c.

◆ find_actions_exact()

GList* find_actions_exact ( GList *  input,
const char *  key,
const pe_node_t on_node 
)

Definition at line 1575 of file utils.c.

◆ find_first_action()

pe_action_t* find_first_action ( GListPtr  input,
const char *  uuid,
const char *  task,
pe_node_t on_node 
)

Definition at line 1505 of file utils.c.

◆ find_recurring_actions()

GListPtr find_recurring_actions ( GListPtr  input,
pe_node_t not_on_node 
)

Definition at line 1447 of file utils.c.

◆ find_rsc_op_entry()

xmlNode* find_rsc_op_entry ( pe_resource_t rsc,
const char *  key 
)

Definition at line 1367 of file utils.c.

◆ get_complex_task()

enum action_tasks get_complex_task ( pe_resource_t rsc,
const char *  name,
gboolean  allow_non_atomic 
)

Definition at line 1447 of file utils.c.

◆ get_effective_time()

time_t get_effective_time ( pe_working_set_t data_set)

Definition at line 1833 of file utils.c.

◆ get_object_root()

xmlNode* get_object_root ( const char *  object_type,
xmlNode *  the_root 
)

Definition at line 144 of file cib_utils.c.

◆ get_pseudo_op()

pe_action_t* get_pseudo_op ( const char *  name,
pe_working_set_t data_set 
)

Definition at line 1938 of file utils.c.

◆ get_target_role()

gboolean get_target_role ( pe_resource_t rsc,
enum rsc_role_e role 
)

Definition at line 1848 of file utils.c.

◆ ghash_free_str_str()

gboolean ghash_free_str_str ( gpointer  key,
gpointer  value,
gpointer  user_data 
)

◆ node_list_exclude()

void node_list_exclude ( GHashTable *  hash,
GListPtr  list,
gboolean  merge_scores 
)

Definition at line 158 of file utils.c.

◆ order_actions()

gboolean order_actions ( pe_action_t lh_action,
pe_action_t rh_action,
enum pe_ordering  order 
)

Definition at line 1886 of file utils.c.

◆ pcmk__rsc_is_filtered()

bool pcmk__rsc_is_filtered ( pe_resource_t rsc,
GListPtr  only_show 
)

Definition at line 2829 of file utils.c.

◆ pe__clear_resource_history()

pe_action_t* pe__clear_resource_history ( pe_resource_t rsc,
pe_node_t node,
pe_working_set_t data_set 
)

Definition at line 2804 of file utils.c.

◆ pe__copy_node()

pe_node_t* pe__copy_node ( const pe_node_t this_node)

Definition at line 139 of file utils.c.

◆ pe__node_list2table()

GHashTable* pe__node_list2table ( GList *  list)

Definition at line 201 of file utils.c.

◆ pe__resource_actions()

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.

Parameters
[in]rscResource to search
[in]nodeFind only actions scheduled on this node
[in]taskAction name to search for
[in]require_nodeIf TRUE, NULL node or action node will not match
Returns
List of actions found (or NULL if none)
Note
If node is not NULL and require_node is FALSE, matching actions without a node will be assigned to node.

Definition at line 1624 of file utils.c.

◆ pe__resource_is_disabled()

bool pe__resource_is_disabled ( pe_resource_t rsc)

Definition at line 2776 of file utils.c.

◆ pe__rsc_running_on_any_node_in_list()

bool pe__rsc_running_on_any_node_in_list ( pe_resource_t rsc,
GListPtr  node_list 
)

Definition at line 2816 of file utils.c.

◆ pe__show_node_weights_as()

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 
)

Definition at line 350 of file utils.c.

◆ pe__shutdown_requested()

bool pe__shutdown_requested ( pe_node_t node)

Definition at line 2729 of file utils.c.

◆ pe__unpack_dataset_nvpairs()

void pe__unpack_dataset_nvpairs ( xmlNode *  xml_obj,
const char *  set_name,
GHashTable *  node_hash,
GHashTable *  hash,
const char *  always_first,
gboolean  overwrite,
pe_working_set_t data_set 
)

Definition at line 2758 of file utils.c.

◆ pe__update_recheck_time()

void pe__update_recheck_time ( time_t  recheck,
pe_working_set_t data_set 
)

Definition at line 2744 of file utils.c.

◆ pe_action_set_flag_reason()

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 at line 2637 of file utils.c.

◆ pe_action_set_reason()

void pe_action_set_reason ( pe_action_t action,
const char *  reason,
bool  overwrite 
)

Definition at line 2695 of file utils.c.

◆ pe_can_fence()

bool pe_can_fence ( pe_working_set_t data_set,
pe_node_t node 
)

Definition at line 87 of file utils.c.

◆ pe_fence_op()

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 at line 2461 of file utils.c.

◆ pe_free_action()

void pe_free_action ( pe_action_t action)

Definition at line 1420 of file utils.c.

◆ pe_get_configured_timeout()

int pe_get_configured_timeout ( pe_resource_t rsc,
const char *  action,
pe_working_set_t data_set 
)

Definition at line 924 of file utils.c.

◆ print_node()

void print_node ( const char *  pre_text,
pe_node_t node,
gboolean  details 
)

Definition at line 1373 of file utils.c.

◆ print_str_str()

void print_str_str ( gpointer  key,
gpointer  value,
gpointer  user_data 
)

Definition at line 1412 of file utils.c.

◆ resource_location()

void resource_location ( pe_resource_t rsc,
pe_node_t node,
int  score,
const char *  tag,
pe_working_set_t data_set 
)

Definition at line 1672 of file utils.c.

◆ rsc_action_digest_cmp()

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 at line 2158 of file utils.c.

◆ rsc_printable_id()

const char* rsc_printable_id ( pe_resource_t rsc)

Definition at line 2339 of file utils.c.

◆ set_bit_recursive()

void set_bit_recursive ( pe_resource_t rsc,
unsigned long long  flag 
)

Definition at line 2361 of file utils.c.

◆ sort_node_uname()

gint sort_node_uname ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 215 of file utils.c.

◆ sort_op_by_callid()

gint sort_op_by_callid ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 1716 of file utils.c.

◆ sort_rsc_index()

gint sort_rsc_index ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 431 of file utils.c.

◆ sort_rsc_priority()

gint sort_rsc_priority ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 458 of file utils.c.

◆ ticket_new()

pe_ticket_t* ticket_new ( const char *  ticket_id,
pe_working_set_t data_set 
)

Definition at line 1967 of file utils.c.

◆ trigger_unfencing()

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 at line 2567 of file utils.c.

◆ unpack_operation()

void unpack_operation ( pe_action_t action,
xmlNode *  xml_obj,
pe_resource_t container,
pe_working_set_t data_set 
)

Unpack operation XML into an action structure.

Unpack an operation's meta-attributes (normalizing the interval, timeout, and start delay values as integer milliseconds), requirements, and failure policy.

Parameters
[in,out]actionAction to unpack into
[in]xml_objOperation XML (or NULL if all defaults)
[in]containerResource that contains affected resource, if any
[in]data_setCluster state

Definition at line 1013 of file utils.c.