Product SiteDocumentation Site

8.2. Node Attribute Expressions

Expressions are rule conditions based on the values of node attributes.

Table 8.2. Attributes of an expression Element

FieldDefaultDescription
id
A unique name for the expression (required)
attribute
The node attribute to test (required)
type
The default type for lt, gt, lte, and gte operations is number if either value contains a decimal point character, or integer otherwise. The default type for all other operations is string. If a numeric parse fails for either value, then the values compared as type string.
How the node attributes should be compared. Allowed values are string, integer, number, and version. integer truncates floating-point values if necessary before performing an integer comparison. number performs a floating-point comparison.
operation
The comparison to perform (required). Allowed values:
  • lt: True if the node attribute value is less than the comparison value
  • gt: True if the node attribute value is greater than the comparison value
  • lte: True if the node attribute value is less than or equal to the comparison value
  • gte: True if the node attribute value is greater than or equal to the comparison value
  • eq: True if the node attribute value is equal to the comparison value
  • ne: True if the node attribute value is not equal to the comparison value
  • defined: True if the node has the named attribute
  • not_defined: True if the node does not have the named attribute
value
User-supplied value for comparison (required for operations other than defined and not_defined)
value-source
literal
How the value is derived. Allowed values:
  • literal: value is a literal string to compare against
  • param: value is the name of a resource parameter to compare against (only valid in location constraints)
  • meta: value is the name of a resource meta-attribute to compare against (only valid in location constraints)
In addition to custom node attributes defined by the administrator, the cluster defines special, built-in node attributes for each node that can also be used in rule expressions.

Table 8.3. Built-in Node Attributes

NameValue
#uname
Node name
#id
Node ID
#kind
Node type. Possible values are cluster, remote, and container. 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 promotable clone resource has on this node. Valid only within a rule for a location constraint for a promotable clone resource.