pacemaker  2.0.1-15814c6c0d
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 <crm/pengine/rules.h>
#include <crm/pengine/internal.h>
#include <unpack.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 (action_t *action, xmlNode *xml_obj, 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, node_t *node)
 
node_tnode_copy (const node_t *this_node)
 
void node_list_exclude (GHashTable *hash, GListPtr list, gboolean merge_scores)
 
GHashTable * node_hash_from_list (GListPtr list)
 
GListPtr node_list_dup (GListPtr list1, gboolean reset, gboolean filter)
 
gint sort_node_uname (gconstpointer a, gconstpointer b)
 
void dump_node_scores_worker (int level, const char *file, const char *function, int line, resource_t *rsc, const char *comment, GHashTable *nodes)
 
void dump_node_capacity (int level, const char *comment, node_t *node)
 
void dump_rsc_utilization (int level, const char *comment, resource_t *rsc, node_t *node)
 
gint sort_rsc_index (gconstpointer a, gconstpointer b)
 
gint sort_rsc_priority (gconstpointer a, gconstpointer b)
 
action_tcustom_action (resource_t *rsc, char *key, const char *task, node_t *on_node, gboolean optional, gboolean save_action, pe_working_set_t *data_set)
 
int pe_get_configured_timeout (resource_t *rsc, const char *action, pe_working_set_t *data_set)
 
xmlNode * find_rsc_op_entry (resource_t *rsc, const char *key)
 
void print_node (const char *pre_text, node_t *node, gboolean details)
 
void print_resource (int log_level, const char *pre_text, resource_t *rsc, gboolean details)
 
void pe_free_action (action_t *action)
 
GListPtr find_recurring_actions (GListPtr input, node_t *not_on_node)
 
enum action_tasks get_complex_task (resource_t *rsc, const char *name, gboolean allow_non_atomic)
 
action_tfind_first_action (GListPtr input, const char *uuid, const char *task, node_t *on_node)
 
GListPtr find_actions (GListPtr input, const char *key, const node_t *on_node)
 
GListPtr find_actions_exact (GListPtr input, const char *key, node_t *on_node)
 
void resource_location (resource_t *rsc, 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 (resource_t *rsc, enum rsc_role_e *role)
 
gboolean order_actions (action_t *lh_action, action_t *rh_action, enum pe_ordering order)
 
action_tget_pseudo_op (const char *name, pe_working_set_t *data_set)
 
void destroy_ticket (gpointer data)
 
ticket_tticket_new (const char *ticket_id, pe_working_set_t *data_set)
 
op_digest_cache_trsc_action_digest_cmp (resource_t *rsc, xmlNode *xml_op, node_t *node, pe_working_set_t *data_set)
 
const char * rsc_printable_id (resource_t *rsc)
 
void clear_bit_recursive (resource_t *rsc, unsigned long long flag)
 
void set_bit_recursive (resource_t *rsc, unsigned long long flag)
 
action_tpe_fence_op (node_t *node, const char *op, bool optional, const char *reason, pe_working_set_t *data_set)
 
void trigger_unfencing (resource_t *rsc, node_t *node, const char *reason, 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)
 

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 1561 of file utils.c.

◆ STONITH_DIGEST_TASK

#define STONITH_DIGEST_TASK   "stonith-on"

Definition at line 2043 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 2268 of file utils.c.

◆ clear_bit_recursive()

void clear_bit_recursive ( resource_t rsc,
unsigned long long  flag 
)

Definition at line 2106 of file utils.c.

◆ custom_action()

action_t* custom_action ( resource_t rsc,
char *  key,
const char *  task,
node_t on_node,
gboolean  optional,
gboolean  save_action,
pe_working_set_t data_set 
)

Definition at line 439 of file utils.c.

◆ destroy_ticket()

void destroy_ticket ( gpointer  data)

Definition at line 1806 of file utils.c.

◆ dump_node_capacity()

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

Definition at line 351 of file utils.c.

◆ dump_node_scores_worker()

void dump_node_scores_worker ( int  level,
const char *  file,
const char *  function,
int  line,
resource_t rsc,
const char *  comment,
GHashTable *  nodes 
)

Definition at line 267 of file utils.c.

◆ dump_rsc_utilization()

void dump_rsc_utilization ( int  level,
const char *  comment,
resource_t rsc,
node_t node 
)

Definition at line 368 of file utils.c.

◆ find_actions()

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

Definition at line 1426 of file utils.c.

◆ find_actions_exact()

GListPtr find_actions_exact ( GListPtr  input,
const char *  key,
node_t on_node 
)

Definition at line 1466 of file utils.c.

◆ find_first_action()

action_t* find_first_action ( GListPtr  input,
const char *  uuid,
const char *  task,
node_t on_node 
)

Definition at line 1396 of file utils.c.

◆ find_recurring_actions()

GListPtr find_recurring_actions ( GListPtr  input,
node_t not_on_node 
)

Definition at line 1338 of file utils.c.

◆ find_rsc_op_entry()

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

Definition at line 1245 of file utils.c.

◆ get_complex_task()

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

Definition at line 1372 of file utils.c.

◆ get_effective_time()

time_t get_effective_time ( pe_working_set_t data_set)

Definition at line 1686 of file utils.c.

◆ get_object_root()

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

Definition at line 152 of file cib_utils.c.

◆ get_pseudo_op()

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

Definition at line 1789 of file utils.c.

◆ get_target_role()

gboolean get_target_role ( resource_t rsc,
enum rsc_role_e role 
)

Definition at line 1701 of file utils.c.

◆ ghash_free_str_str()

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

◆ node_copy()

node_t* node_copy ( const node_t this_node)

Definition at line 116 of file utils.c.

◆ node_hash_from_list()

GHashTable* node_hash_from_list ( GListPtr  list)

Definition at line 172 of file utils.c.

◆ node_list_dup()

GListPtr node_list_dup ( GListPtr  list1,
gboolean  reset,
gboolean  filter 
)

Definition at line 189 of file utils.c.

◆ node_list_exclude()

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

Definition at line 137 of file utils.c.

◆ order_actions()

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

Definition at line 1737 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 2304 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 2362 of file utils.c.

◆ pe_can_fence()

bool pe_can_fence ( pe_working_set_t data_set,
node_t node 
)

Definition at line 89 of file utils.c.

◆ pe_fence_op()

action_t* pe_fence_op ( node_t node,
const char *  op,
bool  optional,
const char *  reason,
pe_working_set_t data_set 
)

Definition at line 2153 of file utils.c.

◆ pe_free_action()

void pe_free_action ( action_t action)

Definition at line 1311 of file utils.c.

◆ pe_get_configured_timeout()

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

Definition at line 823 of file utils.c.

◆ print_node()

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

Definition at line 1251 of file utils.c.

◆ print_resource()

void print_resource ( int  log_level,
const char *  pre_text,
resource_t rsc,
gboolean  details 
)

Definition at line 1295 of file utils.c.

◆ print_str_str()

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

Definition at line 1287 of file utils.c.

◆ resource_location()

void resource_location ( resource_t rsc,
node_t node,
int  score,
const char *  tag,
pe_working_set_t data_set 
)

Definition at line 1527 of file utils.c.

◆ rsc_action_digest_cmp()

op_digest_cache_t* rsc_action_digest_cmp ( resource_t rsc,
xmlNode *  xml_op,
node_t node,
pe_working_set_t data_set 
)

Definition at line 1993 of file utils.c.

◆ rsc_printable_id()

const char* rsc_printable_id ( resource_t rsc)

Definition at line 2097 of file utils.c.

◆ set_bit_recursive()

void set_bit_recursive ( resource_t rsc,
unsigned long long  flag 
)

Definition at line 2119 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 1571 of file utils.c.

◆ sort_rsc_index()

gint sort_rsc_index ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 385 of file utils.c.

◆ sort_rsc_priority()

gint sort_rsc_priority ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 412 of file utils.c.

◆ ticket_new()

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

Definition at line 1818 of file utils.c.

◆ trigger_unfencing()

void trigger_unfencing ( resource_t rsc,
node_t node,
const char *  reason,
action_t dependency,
pe_working_set_t data_set 
)

Definition at line 2234 of file utils.c.

◆ unpack_operation()

void unpack_operation ( action_t action,
xmlNode *  xml_obj,
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 900 of file utils.c.