Product SiteDocumentation Site

Chapter 8. Rules

Table of Contents

8.1. Rule Properties
8.2. Node Attribute Expressions
8.3. Date/Time Expressions
8.3.1. Date Specifications
8.3.2. Durations
8.3.3. Example Time-Based Expressions
8.4. Resource Expressions
8.4.1. Example Resource-Based Expressions
8.5. Operation Expressions
8.5.1. Example Operation-Based Expressions
8.6. Using Rules to Determine Resource Location
8.6.1. Location Rules Based on Other Node Properties
8.6.2. Using score-attribute Instead of score
8.7. Using Rules to Define Options
8.7.1. Using Rules to Control Resource Options
8.7.2. Using Rules to Control Resource Defaults
8.7.3. Using Rules to Control Cluster Options
Rules can be used to make your configuration more dynamic, allowing values to change depending on the time or the value of a node attribute. Examples of things rules are useful for:
Each constraint type or property set that supports rules may contain one or more rule elements specifying conditions under which the constraint or properties take effect. Examples later in this section will make this clearer.

8.1. Rule Properties

Table 8.1. Attributes of a rule Element

AttributeDefaultDescription
id
A unique name for the rule (required)
role
Started
The rule is in effect only when the resource is in the specified role. Allowed values are Started, Slave, and Master. A rule with role="Master" cannot determine the initial location of a clone instance and will only affect which of the active instances will be promoted.
score
If this rule is used in a location constraint and evaluates to true, apply this score to the constraint. Only one of score and score-attribute may be used.
score-attribute
If this rule is used in a location constraint and evaluates to true, use the value of this node attribute as the score to apply to the constraint. Only one of score and score-attribute may be used.
boolean-op
and
If this rule contains more than one condition, a value of and specifies that the rule evaluates to true only if all conditions are true, and a value of or specifies that the rule evaluates to true if any condition is true.
A rule element must contain one or more conditions. A condition may be an expression element, a date_expression element, or another rule element.