Chapter 11. Pacemaker Rules
Rules can be used to make your configuration more dynamic. One use of rules might be to assign machines to different processing groups (using a node attribute) based on time and to then use that attribute when creating location constraints.
Each rule can contain a number of expressions, date-expressions and even other rules. The results of the expressions are combined based on the rule's
boolean-op
field to determine if the rule ultimately evaluates to true
or false
. What happens next depends on the context in which the rule is being used.
Field | Description |
---|---|
role
| |
score
| |
score-attribute
| |
boolean-op
|
11.1. Node Attribute Expressions
Node attribute expressions are used to control a resource based on the attributes defined by a node or nodes.
Field | Description |
---|---|
attribute
| |
type
| |
operation
|
The comparison to perform. Allowed values:
*
lt - True if the node attribute’s value is less than value
*
gt - True if the node attribute’s value is greater than value
*
lte - True if the node attribute’s value is less than or equal to value
*
gte - True if the node attribute’s value is greater than or equal to value
*
eq - True if the node attribute’s value is equal to value
*
ne - True if the node attribute’s value is not equal to value
*
defined - True if the node has the named attribute
|
value
|
In addition to any attributes added by the administrator, the cluster defines special, built-in node attributes for each node that can also be used, as described in Table 11.3, “Built-in Node Attributes”.
Name | Description |
---|---|
#uname
|
Node name
|
#id
|
Node ID
|
#kind
|
Node type. Possible values are
cluster , remote , and container . The value of kind is remote . for Pacemaker Remote nodes created with the ocf:pacemaker:remote resource, and container for Pacemaker Remote guest nodes and bundle nodes.
|
#is_dc
| true if this node is a Designated Controller (DC), false otherwise
|
#cluster_name
|
The value of the
cluster-name cluster property, if set
|
#site_name
|
The value of the
site-name node attribute, if set, otherwise identical to #cluster-name
|
#role
|
The role the relevant multistate resource has on this node. Valid only within a rule for a location constraint for a multistate resource.
|