pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
|
#include <crm_internal.h>
#include <crm/crm.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/xml_internal.h>
#include <glib.h>
#include <crm/pengine/rules.h>
#include <crm/pengine/rules_internal.h>
#include <crm/pengine/internal.h>
#include <sys/types.h>
#include <regex.h>
#include <ctype.h>
#include <crm/pengine/rules_compat.h>
Go to the source code of this file.
Macros | |
#define | CHECK_ONE(spec, name, var) |
Typedefs | |
typedef struct sorted_set_s | sorted_set_t |
typedef struct unpack_data_s | unpack_data_t |
Functions | |
CRM_TRACE_INIT_DATA (pe_rules) | |
gboolean | pe_evaluate_rules (xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now, crm_time_t *next_change) |
Evaluate any rules contained by given XML element. More... | |
gboolean | pe_test_rule (xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, crm_time_t *next_change, pe_match_data_t *match_data) |
gboolean | pe_test_expression (xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, crm_time_t *next_change, pe_match_data_t *match_data) |
Evaluate one rule subelement (pass/fail) More... | |
enum expression_type | find_expression_type (xmlNode *expr) |
int | pe_cron_range_satisfied (const crm_time_t *now, const xmlNode *cron_spec) |
void | pe_eval_nvpairs (xmlNode *top, const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change) |
Extract nvpair blocks contained by an XML element into a hash table. More... | |
void | pe_unpack_nvpairs (xmlNode *top, const xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now, crm_time_t *next_change) |
Extract nvpair blocks contained by an XML element into a hash table. More... | |
char * | pe_expand_re_matches (const char *string, const pe_re_match_data_t *match_data) |
Expand any regular expression submatches (%0-%9) in a string. More... | |
gboolean | pe_eval_rules (xmlNode *ruleset, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change) |
Evaluate rules. More... | |
gboolean | pe_eval_expr (xmlNode *rule, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change) |
Evaluate all of a rule's expressions. More... | |
gboolean | pe_eval_subexpr (xmlNode *expr, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change) |
Evaluate a single rule expression, including any subexpressions. More... | |
gboolean | pe__eval_attr_expr (const xmlNode *expr, const pe_rule_eval_data_t *rule_data) |
int | pe__eval_date_expr (const xmlNode *expr, const pe_rule_eval_data_t *rule_data, crm_time_t *next_change) |
gboolean | pe__eval_op_expr (const xmlNode *expr, const pe_rule_eval_data_t *rule_data) |
gboolean | pe__eval_role_expr (const xmlNode *expr, const pe_rule_eval_data_t *rule_data) |
gboolean | pe__eval_rsc_expr (const xmlNode *expr, const pe_rule_eval_data_t *rule_data) |
gboolean | test_ruleset (xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now) |
gboolean | test_rule (xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now) |
gboolean | pe_test_rule_re (xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_re_match_data_t *re_match_data) |
gboolean | pe_test_rule_full (xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_match_data_t *match_data) |
gboolean | test_expression (xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now) |
gboolean | pe_test_expression_re (xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_re_match_data_t *re_match_data) |
gboolean | pe_test_expression_full (xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_match_data_t *match_data) |
void | unpack_instance_attributes (xmlNode *top, xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now) |
#define CHECK_ONE | ( | spec, | |
name, | |||
var | |||
) |
typedef struct sorted_set_s sorted_set_t |
typedef struct unpack_data_s unpack_data_t |
CRM_TRACE_INIT_DATA | ( | pe_rules | ) |
enum expression_type find_expression_type | ( | xmlNode * | expr | ) |
gboolean pe__eval_attr_expr | ( | const xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data | ||
) |
int pe__eval_date_expr | ( | const xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data, | ||
crm_time_t * | next_change | ||
) |
gboolean pe__eval_op_expr | ( | const xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data | ||
) |
gboolean pe__eval_role_expr | ( | const xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data | ||
) |
gboolean pe__eval_rsc_expr | ( | const xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data | ||
) |
int pe_cron_range_satisfied | ( | const crm_time_t * | now, |
const xmlNode * | cron_spec | ||
) |
gboolean pe_eval_expr | ( | xmlNode * | rule, |
const pe_rule_eval_data_t * | rule_data, | ||
crm_time_t * | next_change | ||
) |
Evaluate all of a rule's expressions.
[in,out] | rule | XML containing a rule definition or its id-ref |
[in] | rule_data | Matching parameters to check against rule |
[out] | next_change | If not NULL, set to when evaluation will change |
rule_data
passes rule
, otherwise FALSE void pe_eval_nvpairs | ( | xmlNode * | top, |
const xmlNode * | xml_obj, | ||
const char * | set_name, | ||
const pe_rule_eval_data_t * | rule_data, | ||
GHashTable * | hash, | ||
const char * | always_first, | ||
gboolean | overwrite, | ||
crm_time_t * | next_change | ||
) |
Extract nvpair blocks contained by an XML element into a hash table.
[in,out] | top | XML document root (used to expand id-ref's) |
[in] | xml_obj | XML element containing blocks of nvpair elements |
[in] | set_name | If not NULL, only use blocks of this element |
[in] | rule_data | Matching parameters to use when unpacking |
[out] | hash | Where to store extracted name/value pairs |
[in] | always_first | If not NULL, process block with this ID first |
[in] | overwrite | Whether to replace existing values with same name |
[out] | next_change | If not NULL, set to when evaluation will change |
gboolean pe_eval_rules | ( | xmlNode * | ruleset, |
const pe_rule_eval_data_t * | rule_data, | ||
crm_time_t * | next_change | ||
) |
gboolean pe_eval_subexpr | ( | xmlNode * | expr, |
const pe_rule_eval_data_t * | rule_data, | ||
crm_time_t * | next_change | ||
) |
Evaluate a single rule expression, including any subexpressions.
[in,out] | expr | XML containing a rule expression |
[in] | rule_data | Matching parameters to check against expression |
[out] | next_change | If not NULL, set to when evaluation will change |
rule_data
passes expr
, otherwise FALSE gboolean pe_evaluate_rules | ( | xmlNode * | ruleset, |
GHashTable * | node_hash, | ||
crm_time_t * | now, | ||
crm_time_t * | next_change | ||
) |
Evaluate any rules contained by given XML element.
[in,out] | xml | XML element to check for rules |
[in] | node_hash | Node attributes to use to evaluate expressions |
[in] | now | Time to use when evaluating expressions |
[out] | next_change | If not NULL, set to when evaluation will change |
char* pe_expand_re_matches | ( | const char * | string, |
const pe_re_match_data_t * | match_data | ||
) |
Expand any regular expression submatches (%0-%9) in a string.
[in] | string | String possibly containing submatch variables |
[in] | match_data | If not NULL, regular expression matches |
string
with submatches expanded, or NULL if there were no matches gboolean pe_test_expression | ( | xmlNode * | expr, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
crm_time_t * | next_change, | ||
pe_match_data_t * | match_data | ||
) |
Evaluate one rule subelement (pass/fail)
A rule element may contain another rule, a node attribute expression, or a date expression. Given any one of those, evaluate it and return whether it passed.
[in,out] | expr | Rule subelement XML |
[in] | node_hash | Node attributes to use when evaluating expression |
[in] | role | Resource role to use when evaluating expression |
[in] | now | Time to use when evaluating expression |
[out] | next_change | If not NULL, set to when evaluation will change |
[in] | match_data | If not NULL, resource back-references and params |
gboolean pe_test_expression_full | ( | xmlNode * | expr, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
pe_match_data_t * | match_data | ||
) |
gboolean pe_test_expression_re | ( | xmlNode * | expr, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
pe_re_match_data_t * | re_match_data | ||
) |
gboolean pe_test_rule | ( | xmlNode * | rule, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
crm_time_t * | next_change, | ||
pe_match_data_t * | match_data | ||
) |
gboolean pe_test_rule_full | ( | xmlNode * | rule, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
pe_match_data_t * | match_data | ||
) |
gboolean pe_test_rule_re | ( | xmlNode * | rule, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now, | ||
pe_re_match_data_t * | re_match_data | ||
) |
void pe_unpack_nvpairs | ( | xmlNode * | top, |
const xmlNode * | xml_obj, | ||
const char * | set_name, | ||
GHashTable * | node_hash, | ||
GHashTable * | hash, | ||
const char * | always_first, | ||
gboolean | overwrite, | ||
crm_time_t * | now, | ||
crm_time_t * | next_change | ||
) |
Extract nvpair blocks contained by an XML element into a hash table.
[in,out] | top | XML document root (used to expand id-ref's) |
[in] | xml_obj | XML element containing blocks of nvpair elements |
[in] | set_name | Element name to identify nvpair blocks |
[in] | node_hash | Node attributes to use when evaluating rules |
[out] | hash | Where to store extracted name/value pairs |
[in] | always_first | If not NULL, process block with this ID first |
[in] | overwrite | Whether to replace existing values with same name |
[in] | now | Time to use when evaluating rules |
[out] | next_change | If not NULL, set to when evaluation will change |
gboolean test_expression | ( | xmlNode * | expr, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now | ||
) |
gboolean test_rule | ( | xmlNode * | rule, |
GHashTable * | node_hash, | ||
enum rsc_role_e | role, | ||
crm_time_t * | now | ||
) |
gboolean test_ruleset | ( | xmlNode * | ruleset, |
GHashTable * | node_hash, | ||
crm_time_t * | now | ||
) |
void unpack_instance_attributes | ( | xmlNode * | top, |
xmlNode * | xml_obj, | ||
const char * | set_name, | ||
GHashTable * | node_hash, | ||
GHashTable * | hash, | ||
const char * | always_first, | ||
gboolean | overwrite, | ||
crm_time_t * | now | ||
) |