<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Rules</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican 1.6" /><meta name="package" content="Pacemaker-Pacemaker_Explained-1.1-en-US-1-0" /><link rel="home" href="index.html" title="Configuration Explained" /><link rel="up" href="index.html" title="Configuration Explained" /><link rel="prev" href="s-notify-snmp.html" title="7.2. Configuring SNMP Notifications" /><link rel="next" href="s-expression-iso8601.html" title="8.2. Time/Date Based Expressions" /></head><body class=""><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="https://fedorahosted.org/publican"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="s-notify-snmp.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="s-expression-iso8601.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="chapter" title="Chapter 8. Rules" lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="ch-rules">Chapter 8. Rules</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch-rules.html#s-expression-attribute">8.1. Node Attribute Expressions</a></span></dt><dt><span class="section"><a href="s-expression-iso8601.html">8.2. Time/Date Based Expressions</a></span></dt><dd><dl><dt><span class="section"><a href="s-expression-iso8601.html#s-exprssion-date-spec">8.2.1. Date Specifications</a></span></dt><dt><span class="section"><a href="s-expression-duration.html">8.2.2. Durations</a></span></dt></dl></dd><dt><span class="section"><a href="s-rules-location.html">8.3. Using Rules to Determine Resource Location</a></span></dt><dd><dl><dt><span class="section"><a href="s-rules-location.html#id3938485">8.3.1. Using <code class="literal">score-attribute</code> Instead of <code class="literal">score</code></a></span></dt></dl></dd><dt><span class="section"><a href="s-rules-resource-options.html">8.4. Using Rules to Control Resource Options</a></span></dt><dt><span class="section"><a href="s-rules-cluster-options.html">8.5. Using Rules to Control Cluster Options</a></span></dt><dt><span class="section"><a href="s-rules-recheck.html">8.6. Ensuring Time Based Rules Take Effect</a></span></dt></dl></div><div class="para"> Rules can be used to make your configuration more dynamic. One common example is to set one value for resource-stickiness during working hours, to prevent resources from being moved back to their most preferred location, and another on weekends when no-one is around to notice an outage. </div><div class="para"> Another 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. </div><div class="para"> 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. </div><div class="table" id="id3952269"><div class="table-contents"><table summary="Properties of a Rule" border="1"><colgroup><col width="50%" /><col width="50%" /></colgroup><thead><tr><th> Field </th><th> Description </th></tr></thead><tbody><tr><td> role </td><td> Limits the rule to only apply when the resource is in that role. Allowed values: <span class="emphasis"><em>Started</em></span>, Slave, Master. NOTE: A rule with role="Master" can not determine the initial location of a clone instance. It will only affect which of the active instances will be promoted. </td></tr><tr><td> score </td><td> The score to apply if the rule evaluates to "true". Limited to use in rules that are part of location constraints. </td></tr><tr><td> score-attribute </td><td> The node attribute to look up and use as a score if the rule evaluates to "true". Limited to use in rules that are part of location constraints. </td></tr><tr><td> boolean-op </td><td> How to combine the result of multiple expression objects. Allowed values: <span class="emphasis"><em>and</em></span>, or </td></tr></tbody></table></div><h6>Table 8.1. Properties of a Rule</h6></div><br class="table-break" /><div class="section" title="8.1. Node Attribute Expressions"><div class="titlepage"><div><div><h2 class="title" id="s-expression-attribute">8.1. Node Attribute Expressions</h2></div></div></div><div class="para"> Expression objects are used to control a resource based on the attributes defined by a node or nodes. In addition to any attributes added by the administrator, each node has a built-in node attribute called <code class="literal">#uname</code> that can also be used. </div><div class="table" id="id2788741"><div class="table-contents"><table summary="Properties of an Expression" border="1"><colgroup><col width="50%" /><col width="50%" /></colgroup><thead><tr><th> Field </th><th> Description </th></tr></thead><tbody><tr><td> value </td><td> User supplied value for comparison </td></tr><tr><td> attribute </td><td> The node attribute to test </td></tr><tr><td> type </td><td> Determines how the value(s) should be tested. Allowed values: integer, <span class="emphasis"><em>string</em></span>, version </td></tr><tr><td> operation </td><td> <div class="para"> The comparison to perform. Allowed values: </div> <div class="itemizedlist"><ul><li class="listitem"><div class="para"> lt,- True if the node attribute's value is less than value </div></li><li class="listitem"><div class="para"> gt - True if the node attribute's value is greater than value </div></li><li class="listitem"><div class="para"> lte- True if the node attribute's value is less than or equal to value </div></li><li class="listitem"><div class="para"> gte- True if the node attribute's value is greater than or equal to value </div></li><li class="listitem"><div class="para"> eq- True if the node attribute's value is equal to value </div></li><li class="listitem"><div class="para"> ne - True if the node attribute's value is not equal to value </div></li><li class="listitem"><div class="para"> defined- True if the node has an the named attribute </div></li><li class="listitem"><div class="para"> not_defined- True if the node does not have the named attribute </div></li></ul></div> </td></tr></tbody></table></div><h6>Table 8.2. Properties of an Expression</h6></div><br class="table-break" /></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="s-notify-snmp.html"><strong>Prev</strong>7.2. Configuring SNMP Notifications</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="s-expression-iso8601.html"><strong>Next</strong>8.2. Time/Date Based Expressions</a></li></ul></body></html>