From 7e199a6a1419b9afa5825556f5c9c9d643ed2add Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Dec 12 2020 01:37:24 +0000 Subject: Doc: Pacemaker Explained: Add documentation for rsc_expr and op_expr. --- diff --git a/doc/Pacemaker_Explained/en-US/Ch-Rules.txt b/doc/Pacemaker_Explained/en-US/Ch-Rules.txt index 9d617f6..5df5f82 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Rules.txt +++ b/doc/Pacemaker_Explained/en-US/Ch-Rules.txt @@ -522,6 +522,124 @@ You may wish to write +end="2005-03-31T23:59:59"+ to avoid confusion. ------- ===== +== Resource Expressions == + +An +rsc_expression+ is a rule condition based on a resource agent's properties. +This rule is only valid within an +rsc_defaults+ or +op_defaults+ context. None +of the matching attributes of +class+, +provider+, and +type+ are required. If +one is omitted, all values of that attribute will match. For instance, omitting ++type+ means every type will match. + +.Attributes of an rsc_expression Element +[width="95%",cols="2m,<5",options="header",align="center"] +|========================================================= + +|Field +|Description + +|id +|A unique name for the expression (required) + indexterm:[XML attribute,id attribute,rsc_expression element] + indexterm:[XML element,rsc_expression element,id attribute] + +|class +|The standard name to be matched against resource agents + indexterm:[XML attribute,class attribute,rsc_expression element] + indexterm:[XML element,rsc_expression element,class attribute] + +|provider +|If given, the vendor to be matched against resource agents. This + only makes sense for agents using the OCF spec. + indexterm:[XML attribute,provider attribute,rsc_expression element] + indexterm:[XML element,rsc_expression element,provider attribute] + +|type +|The name of the resource agent to be matched + indexterm:[XML attribute,type attribute,rsc_expression element] + indexterm:[XML element,rsc_expression element,type attribute] + +|========================================================= + +=== Example Resource-Based Expressions === + +A small sample of how resource-based expressions can be used: + +.True for all ocf:heartbeat:IPaddr2 resources +==== +[source,XML] +---- + + + +---- +==== + +.Provider doesn't apply to non-OCF resources +==== +[source,XML] +---- + + + +---- +==== + +== Operation Expressions == + +An +op_expression+ is a rule condition based on an action of some resource +agent. This rule is only valid within an +op_defaults+ context. + +.Attributes of an op_expression Element +[width="95%",cols="2m,<5",options="header",align="center"] +|========================================================= + +|Field +|Description + +|id +|A unique name for the expression (required) + indexterm:[XML attribute,id attribute,op_expression element] + indexterm:[XML element,op_expression element,id attribute] + +|name +|The action name to match against. This can be any action supported by + the resource agent; common values include +monitor+, +start+, and +stop+ + (required). + indexterm:[XML attribute,name attribute,op_expression element] + indexterm:[XML element,op_expression element,name attribute] + +|interval +|The interval of the action to match against. If not given, only + the name attribute will be used to match. + indexterm:[XML attribute,interval attribute,op_expression element] + indexterm:[XML element,op_expression element,interval attribute] + +|========================================================= + +=== Example Operation-Based Expressions === + +A small sample of how operation-based expressions can be used: + +.True for all monitor actions +==== +[source,XML] +---- + + + +---- +==== + +.True for all monitor actions with a 10 second interval +==== +[source,XML] +---- + + + +---- +==== + == Using Rules to Determine Resource Location == indexterm:[Rule,Determine Resource Location] indexterm:[Resource,Location,Determine by Rules] @@ -710,6 +828,62 @@ Rules may be used similarly in +instance_attributes+ or +utilization+ blocks. Any single block may directly contain only a single rule, but that rule may itself contain any number of rules. ++rsc_expression+ and +op_expression+ blocks may additionally be used to set defaults +on either a single resource or across an entire class of resources with a single +rule. +rsc_expression+ may be used to select resource agents within both +rsc_defaults+ +and +op_defaults+, while +op_expression+ may only be used within +op_defaults+. If +multiple rules succeed for a given resource agent, the last one specified will be +the one that takes effect. As with any other rule, boolean operations may be used +to make more complicated expressions. + +.Set all IPaddr2 resources to stopped +===== +[source,XML] +------- + + + + + + + + +------- +===== + +.Set all monitor action timeouts to 7 seconds +===== +[source,XML] +------- + + + + + + + + +------- +===== + +.Set the monitor action timeout on all IPaddr2 resources with a given monitor interval to 8 seconds +===== +[source,XML] +------- + + + + + + + + + +------- +===== + === Using Rules to Control Cluster Options === indexterm:[Rule,Controlling Cluster Options] indexterm:[Cluster,Setting Options with Rules]