|
pacemaker
2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
|
Utility functions. More...
#include <sys/types.h>#include <stdlib.h>#include <stdbool.h>#include <stdint.h>#include <limits.h>#include <signal.h>#include <glib.h>#include <libxml/tree.h>#include <crm/lrmd.h>#include <crm/common/acl.h>#include <crm/common/agents.h>#include <crm/common/results.h>#include <crm/common/util_compat.h>

Go to the source code of this file.
Macros | |
| #define | ONLINESTATUS "online" |
| #define | OFFLINESTATUS "offline" |
| #define | CRM_DEFAULT_OP_TIMEOUT_S "20s" |
| #define | pcmk_is_set(g, f) pcmk_all_flags_set((g), (f)) |
| Convenience alias for pcmk_all_flags_set(), to check single flag. More... | |
Functions | |
| char * | pcmk_promotion_score_name (const char *rsc_id) |
| Return the name of the node attribute used as a promotion score. More... | |
| int | crm_default_remote_port (void) |
| Get the default remote connection TCP port on this host. More... | |
| const char * | pcmk_readable_score (int score) |
| Return a displayable static string for a score value. More... | |
| int | char2score (const char *score) |
| Get the integer value of a score string. More... | |
| int | pcmk__add_scores (int score1, int score2) |
| gboolean | crm_is_true (const char *s) |
| int | crm_str_to_boolean (const char *s, int *ret) |
| long long | crm_get_msec (const char *input) |
| Parse a time+units string and return milliseconds equivalent. More... | |
| char * | crm_strip_trailing_newline (char *str) |
| char * | crm_strdup_printf (char const *format,...) G_GNUC_PRINTF(1 |
| char guint | crm_parse_interval_spec (const char *input) |
| Parse milliseconds from a Pacemaker interval specification. More... | |
| gboolean | parse_op_key (const char *key, char **rsc_id, char **op_type, guint *interval_ms) |
| gboolean | decode_transition_key (const char *key, char **uuid, int *transition_id, int *action_id, int *target_rc) |
| Parse a transition key into its constituent parts. More... | |
| gboolean | decode_transition_magic (const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc) |
| Parse a transition magic string into its constituent parts. More... | |
| 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_spec, const char *timeout) |
| Create a CIB XML element for an operation. More... | |
| bool | pcmk_is_probe (const char *task, guint interval) |
| bool | pcmk_xe_is_probe (xmlNode *xml_op) |
| bool | pcmk_xe_mask_probe_failure (xmlNode *xml_op) |
| 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 string represents a client name used by cluster daemons. More... | |
| int | crm_user_lookup (const char *name, uid_t *uid, gid_t *gid) |
| int | pcmk_daemon_user (uid_t *uid, gid_t *gid) |
| Get user and group IDs of pacemaker daemon user. More... | |
| char * | pcmk_hostname (void) |
| Get the local hostname. More... | |
| bool | pcmk_str_is_infinity (const char *s) |
| bool | pcmk_str_is_minus_infinity (const char *s) |
Utility functions.
Definition in file util.h.
| #define pcmk_is_set | ( | g, | |
| f | |||
| ) | pcmk_all_flags_set((g), (f)) |
| int char2score | ( | const char * | score | ) |
Get the integer value of a score string.
Given a string representation of a score, return the integer equivalent. This accepts infinity strings as well as red, yellow, and green, and bounds the result to +/-INFINITY.
| [in] | score | Score as string |
score | 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 | ||
| ) |
| xmlNode* crm_create_op_xml | ( | xmlNode * | parent, |
| const char * | prefix, | ||
| const char * | task, | ||
| const char * | interval_spec, | ||
| const char * | timeout | ||
| ) |
Create a CIB XML element for an operation.
| [in,out] | parent | If not NULL, make new XML node a child of this |
| [in] | prefix | Generate an ID using this prefix |
| [in] | task | Operation task to set |
| [in] | interval_spec | Operation interval to set |
| [in] | timeout | If not NULL, operation timeout to set |
Definition at line 474 of file operations.c.
| int crm_default_remote_port | ( | void | ) |
| long long crm_get_msec | ( | const char * | input | ) |
Parse a time+units string and return milliseconds equivalent.
| [in] | input | String with a number and optional unit (optionally with whitespace before and/or after the number). If missing, the unit defaults to seconds. |
| bool crm_is_daemon_name | ( | const char * | name | ) |
Check whether string represents a client name used by cluster daemons.
| [in] | name | String to check |
Definition at line 996 of file ipc_server.c.
| 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 501 of file operations.c.
| char guint crm_parse_interval_spec | ( | const char * | input | ) |
Parse milliseconds from a Pacemaker interval specification.
| [in] | input | Pacemaker time interval specification (a bare number of seconds, a number with a unit optionally with whitespace before and/or after the number, or an ISO 8601 duration) |
| char* crm_strdup_printf | ( | char const * | format, |
| ... | |||
| ) |
| int crm_user_lookup | ( | const char * | name, |
| uid_t * | uid, | ||
| gid_t * | gid | ||
| ) |
| gboolean decode_transition_key | ( | const char * | key, |
| char ** | uuid, | ||
| int * | transition_id, | ||
| int * | action_id, | ||
| int * | target_rc | ||
| ) |
Parse a transition key into its constituent parts.
| [in] | key | Transition key to parse (must be non-NULL) |
| [out] | uuid | If non-NULL, where to store copy of parsed UUID |
| [out] | transition_id | If non-NULL, where to store parsed transition ID |
| [out] | action_id | If non-NULL, where to store parsed action ID |
| [out] | target_rc | If non-NULL, where to stored parsed target rc |
Definition at line 318 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 | ||
| ) |
Parse a transition magic string into its constituent parts.
| [in] | magic | Magic string to parse (must be non-NULL) |
| [out] | uuid | If non-NULL, where to store copy of parsed UUID |
| [out] | transition_id | If non-NULL, where to store parsed transition ID |
| [out] | action_id | If non-NULL, where to store parsed action ID |
| [out] | op_status | If non-NULL, where to store parsed result status |
| [out] | op_rc | If non-NULL, where to store parsed actual rc |
| [out] | target_rc | If non-NULL, where to stored parsed target rc |
Definition at line 255 of file operations.c.
| gboolean did_rsc_op_fail | ( | lrmd_event_data_t * | event, |
| int | target_rc | ||
| ) |
Definition at line 437 of file operations.c.
| gboolean parse_op_key | ( | const char * | key, |
| char ** | rsc_id, | ||
| char ** | op_type, | ||
| guint * | interval_ms | ||
| ) |
Definition at line 185 of file operations.c.
| int pcmk_daemon_user | ( | uid_t * | uid, |
| gid_t * | gid | ||
| ) |
| char* pcmk_hostname | ( | void | ) |
| bool pcmk_is_probe | ( | const char * | task, |
| guint | interval | ||
| ) |
Definition at line 541 of file operations.c.
| char* pcmk_promotion_score_name | ( | const char * | rsc_id | ) |
Return the name of the node attribute used as a promotion score.
| [in] | rsc_id | Resource ID that promotion score is for (or NULL to check the OCF_RESOURCE_INSTANCE environment variable) |
| const char* pcmk_readable_score | ( | int | score | ) |
Return a displayable static string for a score value.
Given a score value, return a pointer to a static string representation of the score suitable for log messages, output, etc.
| [in] | score | Score to display |
score | bool pcmk_xe_is_probe | ( | xmlNode * | xml_op | ) |
Definition at line 551 of file operations.c.
| bool pcmk_xe_mask_probe_failure | ( | xmlNode * | xml_op | ) |
Definition at line 562 of file operations.c.
| int rsc_op_expected_rc | ( | lrmd_event_data_t * | event | ) |
Definition at line 426 of file operations.c.
1.8.14