Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > fd1445e4ec50ea0254985a386bb83a07 > files > 299

pacemaker-doc-1.1.1-1.fc13.i686.rpm

<?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>8.3. Using Rules to Determine Resource Location</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="ch-rules.html" title="Chapter 8. Rules" /><link rel="prev" href="s-expression-duration.html" title="8.2.2. Durations" /><link rel="next" href="s-rules-resource-options.html" title="8.4. Using Rules to Control Resource Options" /></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-expression-duration.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="s-rules-resource-options.html"><strong>Next</strong></a></li></ul><div class="section" title="8.3. Using Rules to Determine Resource Location"><div class="titlepage"><div><div><h2 class="title" id="s-rules-location">8.3. Using Rules to Determine Resource Location</h2></div></div></div><div class="toc"><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></div><div class="para">
			If the constraint's outer-most rule evaluates to false, the cluster treats the constraint as if it was not there. When the rule evaluates to true, the node's preference for running the resource is updated with the score associated with the rule.
		</div><div class="para">
			If this sounds familiar, its because you have been using a simplified syntax for location constraint rules already. Consider the following location constraint:
		</div><div class="example" id="id2718203"><div class="example-contents"><pre class="programlisting">
  &lt;rsc_location id="dont-run-apache-on-c001n03" rsc="myApacheRsc" score="-INFINITY" node="c001n03"/&gt;
</pre></div><h6>Example 8.8. Prevent myApacheRsc from running on c001n03</h6></div><br class="example-break" /><div class="para">
			This constraint can be more verbosely written as:
		</div><div class="example" id="id2718221"><div class="example-contents"><pre class="programlisting">

  &lt;rsc_location id="dont-run-apache-on-c001n03" rsc="myApacheRsc"&gt;
    &lt;rule id="dont-run-apache-rule" score="-INFINITY"&gt;
       &lt;expression id="dont-run-apache-expr" attribute="#uname" operation="eq" value="c00n03"/&gt;
    &lt;/rule&gt;
  &lt;/rsc_location&gt;
</pre></div><h6>Example 8.9. Prevent myApacheRsc from running on c001n03 - expanded version</h6></div><br class="example-break" /><div class="para">
			The advantage of using the expanded form is that one can then add extra clauses to the rule, such as limiting the rule such that it only applies during certain times of the day or days of the week (this is discussed in subsequent sections).
		</div><div class="para">
			It also allows us to match on node properties other than its name. If we rated each machine's CPU power such that the cluster had the following nodes section:
		</div><div class="example" id="id3938453"><div class="example-contents"><pre class="programlisting">

   &lt;nodes&gt;
     &lt;node id="uuid1" uname="c001n01" type="normal"&gt;
      &lt;instance_attributes id="uuid1-custom_attrs"&gt;
        &lt;nvpair id="uuid1-cpu_mips" name="cpu_mips" value="1234"/&gt;
      &lt;/instance_attributes&gt;
     &lt;/node&gt;
     &lt;node id="uuid2" uname="c001n02" type="normal"&gt;
      &lt;instance_attributes id="uuid2-custom_attrs"&gt;
        &lt;nvpair id="uuid2-cpu_mips" name="cpu_mips" value="5678"/&gt;
      &lt;/instance_attributes&gt;
     &lt;/node&gt;
    &lt;/nodes&gt;
</pre></div><h6>Example 8.10. A sample nodes section for use with score-attribute </h6></div><br class="example-break" /><div class="para">
			then we could prevent resources from running on underpowered machines with the rule
		</div><pre class="programlisting">

  &lt;rule id="need-more-power-rule" score="-INFINITY"&gt;
       &lt;expression id=" need-more-power-expr" attribute="cpu_mips" operation="lt" value="3000"/&gt;
  &lt;/rule&gt;
</pre><div class="section" title="8.3.1. Using score-attribute Instead of score"><div class="titlepage"><div><div><h3 class="title" id="id3938485">8.3.1. Using <code class="literal">score-attribute</code> Instead of <code class="literal">score</code></h3></div></div></div><div class="para">
				When using score-attribute instead of score, each node matched by the rule has its score adjusted differently, according to its value for the named node attribute. Thus in the previous example, if a rule used <code class="literal">score-attribute="cpu_mips"</code>, c001n01 would have its preference to run the resource increased by 1234 whereas c001n02 would have its preference increased by 5678.
			</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="s-expression-duration.html"><strong>Prev</strong>8.2.2. Durations</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-rules-resource-options.html"><strong>Next</strong>8.4. Using Rules to Control Resource Options</a></li></ul></body></html>