pacemaker  2.0.5-ba59be712
Scalable High-Availability cluster resource manager
Enumerations | Functions
rules.h File Reference
#include <glib.h>
#include <crm/crm.h>
#include <crm/common/iso8601.h>
#include <crm/pengine/common.h>
Include dependency graph for rules.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  expression_type {
  not_expr, nested_rule, attr_expr, loc_expr,
  role_expr, time_expr, version_expr, rsc_expr,
  op_expr
}
 

Functions

enum expression_type find_expression_type (xmlNode *expr)
 
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...
 
void pe_eval_nvpairs (xmlNode *top, xmlNode *xml_obj, const char *set_name, pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change)
 
void pe_unpack_nvpairs (xmlNode *top, 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, pe_re_match_data_t *match_data)
 
gboolean pe_eval_rules (xmlNode *ruleset, pe_rule_eval_data_t *rule_data, crm_time_t *next_change)
 
gboolean pe_eval_expr (xmlNode *rule, pe_rule_eval_data_t *rule_data, crm_time_t *next_change)
 
gboolean pe_eval_subexpr (xmlNode *expr, pe_rule_eval_data_t *rule_data, crm_time_t *next_change)
 
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)
 

Enumeration Type Documentation

◆ expression_type

Enumerator
not_expr 
nested_rule 
attr_expr 
loc_expr 
role_expr 
time_expr 
version_expr 
rsc_expr 
op_expr 

Definition at line 23 of file rules.h.

Function Documentation

◆ find_expression_type()

enum expression_type find_expression_type ( xmlNode *  expr)

Definition at line 105 of file rules.c.

◆ pe_eval_expr()

gboolean pe_eval_expr ( xmlNode *  rule,
pe_rule_eval_data_t rule_data,
crm_time_t next_change 
)

Definition at line 849 of file rules.c.

◆ pe_eval_nvpairs()

void pe_eval_nvpairs ( xmlNode *  top,
xmlNode *  xml_obj,
const char *  set_name,
pe_rule_eval_data_t rule_data,
GHashTable *  hash,
const char *  always_first,
gboolean  overwrite,
crm_time_t next_change 
)

Definition at line 690 of file rules.c.

◆ pe_eval_rules()

gboolean pe_eval_rules ( xmlNode *  ruleset,
pe_rule_eval_data_t rule_data,
crm_time_t next_change 
)

Definition at line 825 of file rules.c.

◆ pe_eval_subexpr()

gboolean pe_eval_subexpr ( xmlNode *  expr,
pe_rule_eval_data_t rule_data,
crm_time_t next_change 
)

Definition at line 891 of file rules.c.

◆ pe_evaluate_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.

Parameters
[in]xmlXML element to check for rules
[in]node_hashNode attributes to use when evaluating expressions
[in]nowTime to use when evaluating expressions
[out]next_changeIf not NULL, set to when evaluation will change
Returns
TRUE if no rules, or any of rules present is in effect, else FALSE

Definition at line 39 of file rules.c.

◆ pe_expand_re_matches()

char* pe_expand_re_matches ( const char *  string,
pe_re_match_data_t match_data 
)

Definition at line 743 of file rules.c.

◆ pe_test_expression()

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.

Parameters
[in]exprRule subelement XML
[in]node_hashNode attributes to use when evaluating expression
[in]roleResource role to use when evaluating expression
[in]nowTime to use when evaluating expression
[out]next_changeIf not NULL, set to when evaluation will change
[in]match_dataIf not NULL, resource back-references and params
Returns
TRUE if expression is in effect under given conditions, else FALSE

Definition at line 88 of file rules.c.

◆ pe_test_expression_full()

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 
)
Deprecated:
Use pe_test_expression() instead

Definition at line 1436 of file rules.c.

◆ pe_test_expression_re()

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 
)
Deprecated:
Use pe_test_expression() instead

Definition at line 1425 of file rules.c.

◆ pe_test_rule()

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 
)

Definition at line 55 of file rules.c.

◆ pe_test_rule_full()

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 
)
Deprecated:
Use pe_test_rule() instead

Definition at line 1412 of file rules.c.

◆ pe_test_rule_re()

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 
)
Deprecated:
Use pe_test_rule() instead

Definition at line 1401 of file rules.c.

◆ pe_unpack_nvpairs()

void pe_unpack_nvpairs ( xmlNode *  top,
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.

Parameters
[in]topXML document root (used to expand id-ref's)
[in]xml_objXML element containing blocks of nvpair elements
[in]set_nameElement name to identify nvpair blocks
[in]node_hashNode attributes to use when evaluating rules
[out]hashWhere to store extracted name/value pairs
[in]always_firstIf not NULL, process block with this ID first
[in]overwriteWhether to replace existing values with same name
[in]nowTime to use when evaluating rules
[out]next_changeIf not NULL, set to when rule evaluation will change

Definition at line 713 of file rules.c.

◆ test_expression()

gboolean test_expression ( xmlNode *  expr,
GHashTable *  node_hash,
enum rsc_role_e  role,
crm_time_t now 
)
Deprecated:
Use pe_test_expression() instead

Definition at line 1419 of file rules.c.

◆ test_rule()

gboolean test_rule ( xmlNode *  rule,
GHashTable *  node_hash,
enum rsc_role_e  role,
crm_time_t now 
)
Deprecated:
Use pe_test_rule() instead

Definition at line 1395 of file rules.c.

◆ test_ruleset()

gboolean test_ruleset ( xmlNode *  ruleset,
GHashTable *  node_hash,
crm_time_t now 
)
Deprecated:
Use pe_evaluate_rules() instead

Definition at line 1389 of file rules.c.

◆ unpack_instance_attributes()

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 
)
Deprecated:
Use pe_unpack_nvpairs() instead

Definition at line 1444 of file rules.c.