pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
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/rules_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.
 

Macro Definition Documentation

◆ ADD_COMPONENT

#define ADD_COMPONENT ( component)
Value:
do { \
int rc = pcmk__add_time_from_xml(*end, component, duration); \
if (rc != pcmk_rc_ok) { \
pcmk__config_err("Treating " PCMK_XE_DATE_EXPRESSION " %s " \
"as not passing because " PCMK_XE_DURATION \
" %s attribute %s is invalid: %s", \
parent_id, id, \
pcmk_rc_str(rc)); \
crm_time_free(*end); \
*end = NULL; \
return rc; \
} \
} while (0)
G_GNUC_INTERNAL int pcmk__add_time_from_xml(crm_time_t *t, enum pcmk__time_component component, const xmlNode *xml)
Definition iso8601.c:1615
G_GNUC_INTERNAL const char * pcmk__time_component_attr(enum pcmk__time_component component)
Definition iso8601.c:1534
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
Definition results.c:617
@ pcmk_rc_ok
Definition results.h:159
#define PCMK_XE_DATE_EXPRESSION
Definition xml_names.h:96
#define PCMK_XE_DURATION
Definition xml_names.h:104

Definition at line 218 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 743 of file rules.c.

◆ pcmk__condition_type()

enum expression_type pcmk__condition_type ( const xmlNode * condition)

Definition at line 38 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 958 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 1252 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 470 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 155 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 1179 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 1110 of file rules.c.

◆ pcmk__parse_combine()

enum pcmk__combine pcmk__parse_combine ( const char * combine)

Definition at line 831 of file rules.c.

◆ pcmk__parse_comparison()

enum pcmk__comparison pcmk__parse_comparison ( const char * op)

Definition at line 652 of file rules.c.

◆ pcmk__parse_source()

enum pcmk__reference_source pcmk__parse_source ( const char * source)

Definition at line 805 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 694 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 614 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 246 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 1304 of file rules.c.