pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
Macros | Functions
rules.c File Reference
#include <crm_internal.h>
#include <stdio.h>
#include <stdbool.h>
#include <ctype.h>
#include <regex.h>
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
#include <libxml/tree.h>
#include <crm/common/scheduler.h>
#include <crm/common/iso8601_internal.h>
#include <crm/common/nvpair_internal.h>
#include <crm/common/scheduler_internal.h>
#include "crmcommon_private.h"
Include dependency graph for rules.c:

Go to the source code of this file.

Macros

#define ADD_COMPONENT(component)
 

Functions

enum expression_type pcmk__condition_type (const xmlNode *condition)
 
int pcmk__evaluate_date_spec (const xmlNode *date_spec, const crm_time_t *now)
 
int pcmk__unpack_duration (const xmlNode *duration, const crm_time_t *start, crm_time_t **end)
 
int pcmk__evaluate_date_expression (const xmlNode *date_expression, const crm_time_t *now, crm_time_t *next_change)
 
char * pcmk__replace_submatches (const char *string, const char *match, const regmatch_t submatches[], int nmatches)
 
enum pcmk__comparison pcmk__parse_comparison (const char *op)
 
enum pcmk__type pcmk__parse_type (const char *type, enum pcmk__comparison op, const char *value1, const char *value2)
 
int pcmk__cmp_by_type (const char *value1, const char *value2, enum pcmk__type type)
 
enum pcmk__reference_source pcmk__parse_source (const char *source)
 
enum pcmk__combine pcmk__parse_combine (const char *combine)
 
int pcmk__evaluate_attr_expression (const xmlNode *expression, const pcmk_rule_input_t *rule_input)
 
int pcmk__evaluate_rsc_expression (const xmlNode *rsc_expression, const pcmk_rule_input_t *rule_input)
 
int pcmk__evaluate_op_expression (const xmlNode *op_expression, const pcmk_rule_input_t *rule_input)
 
int pcmk__evaluate_condition (xmlNode *condition, const pcmk_rule_input_t *rule_input, crm_time_t *next_change)
 
int pcmk_evaluate_rule (xmlNode *rule, const pcmk_rule_input_t *rule_input, crm_time_t *next_change)
 Evaluate a single rule, including all its conditions. More...
 
int pcmk__evaluate_rules (xmlNode *xml, const pcmk_rule_input_t *rule_input, crm_time_t *next_change)
 

Macro Definition Documentation

◆ ADD_COMPONENT

#define ADD_COMPONENT (   component)
Value:
do { \
int sub_rc = pcmk__add_time_from_xml(*end, component, duration); \
if (sub_rc != pcmk_rc_ok) { \
/* @COMPAT return sub_rc when we can break compatibility */ \
pcmk__config_warn("Ignoring %s in " PCMK_XE_DURATION " %s " \
"because it is invalid", \
pcmk__time_component_attr(component), id); \
rc = sub_rc; \
} \
} while (0)
#define PCMK_XE_DURATION
Definition: xml_names.h:103
G_GNUC_INTERNAL const char * pcmk__time_component_attr(enum pcmk__time_component component)
Definition: iso8601.c:1487
G_GNUC_INTERNAL int pcmk__add_time_from_xml(crm_time_t *t, enum pcmk__time_component component, const xmlNode *xml)
Definition: iso8601.c:1568

Definition at line 268 of file rules.c.

Function Documentation

◆ pcmk__cmp_by_type()

int pcmk__cmp_by_type ( const char *  value1,
const char *  value2,
enum pcmk__type  type 
)

Definition at line 814 of file rules.c.

◆ pcmk__condition_type()

enum expression_type pcmk__condition_type ( const xmlNode *  condition)

Definition at line 37 of file rules.c.

◆ pcmk__evaluate_attr_expression()

int pcmk__evaluate_attr_expression ( const xmlNode *  expression,
const pcmk_rule_input_t rule_input 
)

Definition at line 1038 of file rules.c.

◆ pcmk__evaluate_condition()

int pcmk__evaluate_condition ( xmlNode *  condition,
const pcmk_rule_input_t rule_input,
crm_time_t next_change 
)

Definition at line 1333 of file rules.c.

◆ pcmk__evaluate_date_expression()

int pcmk__evaluate_date_expression ( const xmlNode *  date_expression,
const crm_time_t now,
crm_time_t next_change 
)

Definition at line 534 of file rules.c.

◆ pcmk__evaluate_date_spec()

int pcmk__evaluate_date_spec ( const xmlNode *  date_spec,
const crm_time_t now 
)

Definition at line 193 of file rules.c.

◆ pcmk__evaluate_op_expression()

int pcmk__evaluate_op_expression ( const xmlNode *  op_expression,
const pcmk_rule_input_t rule_input 
)

Definition at line 1259 of file rules.c.

◆ pcmk__evaluate_rsc_expression()

int pcmk__evaluate_rsc_expression ( const xmlNode *  rsc_expression,
const pcmk_rule_input_t rule_input 
)

Definition at line 1188 of file rules.c.

◆ pcmk__evaluate_rules()

int pcmk__evaluate_rules ( xmlNode *  xml,
const pcmk_rule_input_t rule_input,
crm_time_t next_change 
)

Definition at line 1486 of file rules.c.

◆ pcmk__parse_combine()

enum pcmk__combine pcmk__parse_combine ( const char *  combine)

Definition at line 902 of file rules.c.

◆ pcmk__parse_comparison()

enum pcmk__comparison pcmk__parse_comparison ( const char *  op)

Definition at line 723 of file rules.c.

◆ pcmk__parse_source()

enum pcmk__reference_source pcmk__parse_source ( const char *  source)

Definition at line 876 of file rules.c.

◆ pcmk__parse_type()

enum pcmk__type pcmk__parse_type ( const char *  type,
enum pcmk__comparison  op,
const char *  value1,
const char *  value2 
)

Definition at line 765 of file rules.c.

◆ pcmk__replace_submatches()

char* pcmk__replace_submatches ( const char *  string,
const char *  match,
const regmatch_t  submatches[],
int  nmatches 
)

Definition at line 685 of file rules.c.

◆ pcmk__unpack_duration()

int pcmk__unpack_duration ( const xmlNode *  duration,
const crm_time_t start,
crm_time_t **  end 
)

Definition at line 292 of file rules.c.

◆ pcmk_evaluate_rule()

int pcmk_evaluate_rule ( xmlNode *  rule,
const pcmk_rule_input_t rule_input,
crm_time_t next_change 
)

Evaluate a single rule, including all its conditions.

Parameters
[in,out]ruleXML containing a rule definition or its id-ref
[in]rule_inputValues used to evaluate rule criteria
[out]next_changeIf not NULL, set to when evaluation will change
Returns
Standard Pacemaker return code (pcmk_rc_ok if the rule is satisfied, some other value if it is not)

Definition at line 1385 of file rules.c.