pacemaker
1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
|
Utility functions. More...
#include <sys/types.h>
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h>
#include <signal.h>
#include <sysexits.h>
#include <glib.h>
#include <libxml/tree.h>
#include <crm/lrmd.h>
Go to the source code of this file.
Macros | |
#define | NORMALNODE "normal" |
#define | ACTIVESTATUS "active"/* fully functional, and all links are up */ |
#define | DEADSTATUS "dead" |
#define | PINGSTATUS "ping" |
#define | JOINSTATUS "join" |
#define | LEAVESTATUS "leave" |
#define | ONLINESTATUS "online"/* Status of an online client */ |
#define | OFFLINESTATUS "offline" |
#define | safe_str_eq(a, b) crm_str_eq(a, b, FALSE) |
#define | crm_str_hash g_str_hash_traditional |
#define | crm_atoi(text, default_text) crm_parse_int(text, default_text) |
#define | CRM_DEFAULT_OP_TIMEOUT_S "20s" |
Functions | |
int | crm_default_remote_port (void) |
Get the default remote connection TCP port on this host. More... | |
char * | crm_itoa_stack (int an_int, char *buf, size_t len) |
char * | crm_itoa (int an_int) |
gboolean | crm_is_true (const char *s) |
int | crm_str_to_boolean (const char *s, int *ret) |
int | crm_parse_int (const char *text, const char *default_text) |
char * | crm_strip_trailing_newline (char *str) |
gboolean | crm_str_eq (const char *a, const char *b, gboolean use_case) |
gboolean | safe_str_neq (const char *a, const char *b) |
guint | crm_strcase_hash (gconstpointer v) |
guint | g_str_hash_traditional (gconstpointer v) |
GHashTable * | crm_str_table_dup (GHashTable *old_table) |
void | crm_build_path (const char *path_c, mode_t mode) |
Create a directory, including any parent directories needed. More... | |
long long | crm_get_msec (const char *input) |
unsigned long long | crm_get_interval (const char *input) |
int | char2score (const char *score) |
char * | score2char (int score) |
char * | score2char_stack (int score, char *buf, size_t len) |
gboolean | parse_op_key (const char *key, char **rsc_id, char **op_type, int *interval) |
gboolean | decode_transition_key (const char *key, char **uuid, int *action, int *transition_id, int *target_rc) |
gboolean | decode_transition_magic (const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc) |
int | rsc_op_expected_rc (lrmd_event_data_t *event) |
gboolean | did_rsc_op_fail (lrmd_event_data_t *event, int target_rc) |
bool | crm_op_needs_metadata (const char *rsc_class, const char *op) |
Check whether an operation requires resource agent meta-data. More... | |
xmlNode * | crm_create_op_xml (xmlNode *parent, const char *prefix, const char *task, const char *interval, const char *timeout) |
Create a CIB XML element for an operation. More... | |
int | compare_version (const char *version1, const char *version2) |
void | crm_abort (const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork) |
char * | crm_meta_name (const char *field) |
const char * | crm_meta_value (GHashTable *hash, const char *field) |
char * | crm_md5sum (const char *buffer) |
char * | crm_generate_uuid (void) |
bool | crm_is_daemon_name (const char *name) |
Check whether a string represents a cluster daemon name. More... | |
int | crm_user_lookup (const char *name, uid_t *uid, gid_t *gid) |
int | crm_exit (int rc) |
bool | pcmk_acl_required (const char *user) |
char * | crm_generate_ra_key (const char *class, const char *provider, const char *type) |
bool | crm_provider_required (const char *standard) |
Check whether a resource standard requires a provider to be specified. More... | |
int | crm_parse_agent_spec (const char *spec, char **standard, char **provider, char **type) |
Parse a "standard[:provider]:type" agent specification. More... | |
Utility functions.
Definition in file util.h.
#define ACTIVESTATUS "active"/* fully functional, and all links are up */ |
#define crm_atoi | ( | text, | |
default_text | |||
) | crm_parse_int(text, default_text) |
#define crm_str_hash g_str_hash_traditional |
#define safe_str_eq | ( | a, | |
b | |||
) | crm_str_eq(a, b, FALSE) |
int compare_version | ( | const char * | version1, |
const char * | version2 | ||
) |
void crm_abort | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | condition, | ||
gboolean | do_core, | ||
gboolean | do_fork | ||
) |
void crm_build_path | ( | const char * | path_c, |
mode_t | mode | ||
) |
xmlNode* crm_create_op_xml | ( | xmlNode * | parent, |
const char * | prefix, | ||
const char * | task, | ||
const char * | interval, | ||
const char * | timeout | ||
) |
Create a CIB XML element for an operation.
[in] | parent | If not NULL, make new XML node a child of this one |
[in] | prefix | Generate an ID using this prefix |
[in] | task | Operation task to set |
[in] | interval | Operation interval to set |
[in] | timeout | If not NULL, operation timeout to set |
Definition at line 439 of file operations.c.
int crm_default_remote_port | ( | void | ) |
char* crm_generate_ra_key | ( | const char * | class, |
const char * | provider, | ||
const char * | type | ||
) |
bool crm_is_daemon_name | ( | const char * | name | ) |
char* crm_itoa_stack | ( | int | an_int, |
char * | buf, | ||
size_t | len | ||
) |
const char* crm_meta_value | ( | GHashTable * | hash, |
const char * | field | ||
) |
bool crm_op_needs_metadata | ( | const char * | rsc_class, |
const char * | op | ||
) |
Check whether an operation requires resource agent meta-data.
[in] | rsc_class | Resource agent class (or NULL to skip class check) |
[in] | op | Operation action (or NULL to skip op check) |
Definition at line 635 of file operations.c.
int crm_parse_agent_spec | ( | const char * | spec, |
char ** | standard, | ||
char ** | provider, | ||
char ** | type | ||
) |
Parse a "standard[:provider]:type" agent specification.
[in] | spec | Agent specification |
[out] | standard | Newly allocated memory containing agent standard (or NULL) |
[out] | provider | Newly allocated memory containing agent provider (or NULL) |
put] | type Newly allocated memory containing agent type (or NULL) |
int crm_parse_int | ( | const char * | text, |
const char * | default_text | ||
) |
bool crm_provider_required | ( | const char * | standard | ) |
gboolean crm_str_eq | ( | const char * | a, |
const char * | b, | ||
gboolean | use_case | ||
) |
int crm_user_lookup | ( | const char * | name, |
uid_t * | uid, | ||
gid_t * | gid | ||
) |
gboolean decode_transition_key | ( | const char * | key, |
char ** | uuid, | ||
int * | action, | ||
int * | transition_id, | ||
int * | target_rc | ||
) |
Definition at line 217 of file operations.c.
gboolean decode_transition_magic | ( | const char * | magic, |
char ** | uuid, | ||
int * | transition_id, | ||
int * | action_id, | ||
int * | op_status, | ||
int * | op_rc, | ||
int * | target_rc | ||
) |
Definition at line 174 of file operations.c.
gboolean did_rsc_op_fail | ( | lrmd_event_data_t * | event, |
int | target_rc | ||
) |
Definition at line 404 of file operations.c.
gboolean parse_op_key | ( | const char * | key, |
char ** | rsc_id, | ||
char ** | op_type, | ||
int * | interval | ||
) |
Definition at line 46 of file operations.c.
int rsc_op_expected_rc | ( | lrmd_event_data_t * | event | ) |
Definition at line 389 of file operations.c.