Sophie

Sophie

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

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.4. Using Rules to Control Resource Options</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-rules-location.html" title="8.3. Using Rules to Determine Resource Location" /><link rel="next" href="s-rules-cluster-options.html" title="8.5. Using Rules to Control Cluster 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-rules-location.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="s-rules-cluster-options.html"><strong>Next</strong></a></li></ul><div class="section" title="8.4. Using Rules to Control Resource Options"><div class="titlepage"><div><div><h2 class="title" id="s-rules-resource-options">8.4. Using Rules to Control Resource Options</h2></div></div></div><div class="para">
			Often some cluster nodes will be different from their peers, sometimes these differences (the location of a binary or the names of network interfaces) require resources be configured differently depending on the machine they're hosted on.
		</div><div class="para">
			By defining multiple <code class="literal">instance_attributes</code> objects for the resource and adding a rule to each, we can easily handle these special cases.
		</div><div class="para">
			In the example below, mySpecialRsc will use eth1 and port 9999 when run on node1, eth2 and port 8888 on node2 and default to eth0 and port 9999 for all other nodes.
		</div><div class="example" id="id3992145"><div class="example-contents"><pre class="programlisting">

  &lt;primitive id="mySpecialRsc" class="ocf" type="Special" provider="me"&gt;
   &lt;instance_attributes id="special-node1" score="3"&gt;
    &lt;rule id="node1-special-case" score="INFINITY" &gt;
     &lt;expression id="node1-special-case-expr" attribute="#uname" operation="eq" value="node1"/&gt;
    &lt;/rule&gt;
    &lt;nvpair id="node1-interface" name="interface" value="eth1"/&gt;
   &lt;/instance_attributes&gt;
   &lt;instance_attributes id="special-node2" score="2" &gt;
    &lt;rule id="node2-special-case" score="INFINITY"&gt;
     &lt;expression id="node2-special-case-expr" attribute="#uname" operation="eq" value="node2"/&gt;
    &lt;/rule&gt;
    &lt;nvpair id="node2-interface" name="interface" value="eth2"/&gt;
    &lt;nvpair id="node2-port" name="port" value="8888"/&gt;
   &lt;/instance_attributes&gt;
   &lt;instance_attributes id="defaults" score="1" &gt;
    &lt;nvpair id="default-interface" name="interface" value="eth0"/&gt;
    &lt;nvpair id="default-port" name="port" value="9999"/&gt;
   &lt;/instance_attributes&gt;
  &lt;/primitive&gt;
</pre></div><h6>Example 8.11. Defining different resource options based on the node name</h6></div><br class="example-break" /><div class="para">
			The order in which <code class="literal">instance_attributes</code> objects are evaluated is determined by their score (highest to lowest). If not supplied, score defaults to zero and objects with an equal score are processed in listed order. If the <code class="literal">instance_attributes</code> object does not have a <code class="literal">rule</code> or has a <code class="literal">rule</code> that evaluates to <code class="literal">true</code>, then for any parameter the resource does not yet have a value for, the resource will use the parameter values defined by the <code class="literal">instance_attributes</code> object.
		</div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="s-rules-location.html"><strong>Prev</strong>8.3. Using Rules to Determine Resource Location</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-cluster-options.html"><strong>Next</strong>8.5. Using Rules to Control Cluster Options</a></li></ul></body></html>