pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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)
 
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 (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

#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)
#define crm_trace(fmt, args...)
Definition: logging.h:246

Definition at line 1599 of file utils.c.

#define STONITH_DIGEST_TASK   "stonith-on"

Definition at line 2083 of file utils.c.

Function Documentation

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

Definition at line 2309 of file utils.c.

void clear_bit_recursive ( resource_t rsc,
unsigned long long  flag 
)

Definition at line 2146 of file utils.c.

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

void destroy_ticket ( gpointer  data)

Definition at line 1845 of file utils.c.

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

Definition at line 353 of file utils.c.

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

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

Definition at line 370 of file utils.c.

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

Definition at line 1428 of file utils.c.

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

Definition at line 1468 of file utils.c.

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

Definition at line 1398 of file utils.c.

GListPtr find_recurring_actions ( GListPtr  input,
node_t not_on_node 
)

Definition at line 1340 of file utils.c.

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

Definition at line 1247 of file utils.c.

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

Definition at line 1374 of file utils.c.

time_t get_effective_time ( pe_working_set_t data_set)

Definition at line 1725 of file utils.c.

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

Definition at line 152 of file cib_utils.c.

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

Definition at line 1828 of file utils.c.

gboolean get_target_role ( resource_t rsc,
enum rsc_role_e role 
)

Definition at line 1740 of file utils.c.

gboolean ghash_free_str_str ( gpointer  key,
gpointer  value,
gpointer  user_data 
)
node_t* node_copy ( const node_t this_node)

Definition at line 118 of file utils.c.

GHashTable* node_hash_from_list ( GListPtr  list)

Definition at line 174 of file utils.c.

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

Definition at line 191 of file utils.c.

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

Definition at line 139 of file utils.c.

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

Definition at line 1776 of file utils.c.

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

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

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

Definition at line 2403 of file utils.c.

bool pe_can_fence ( pe_working_set_t data_set,
node_t node 
)

Definition at line 91 of file utils.c.

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

void pe_free_action ( action_t action)

Definition at line 1313 of file utils.c.

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

Definition at line 826 of file utils.c.

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

Definition at line 1253 of file utils.c.

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

Definition at line 1297 of file utils.c.

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

Definition at line 1289 of file utils.c.

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

Definition at line 1565 of file utils.c.

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

const char* rsc_printable_id ( resource_t rsc)

Definition at line 2137 of file utils.c.

void set_bit_recursive ( resource_t rsc,
unsigned long long  flag 
)

Definition at line 2159 of file utils.c.

gint sort_node_uname ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 217 of file utils.c.

gint sort_op_by_callid ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 1609 of file utils.c.

gint sort_rsc_index ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 387 of file utils.c.

gint sort_rsc_priority ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 414 of file utils.c.

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

Definition at line 1857 of file utils.c.

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

Definition at line 2275 of file utils.c.

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