Product SiteDocumentation Site

Chapter 5. Resource Constraints

Table of Contents

5.1. Scores
5.1.1. Infinity Math
5.2. Deciding Which Nodes a Resource Can Run On
5.2.1. Location Properties
5.2.2. Asymmetrical "Opt-In" Clusters
5.2.3. Symmetrical "Opt-Out" Clusters
5.2.4. What if Two Nodes Have the Same Score
5.3. Specifying the Order in which Resources Should Start/Stop
5.3.1. Ordering Properties
5.3.2. Optional and mandatory ordering
5.4. Placing Resources Relative to other Resources
5.4.1. Colocation Properties
5.4.2. Mandatory Placement
5.4.3. Advisory Placement
5.4.4. Colocation by Node Attribute
5.5. Resource Sets
5.6. Ordering Sets of Resources
5.6.1. Ordered Set
5.6.2. Ordering Multiple Sets
5.6.3. Resource Set OR Logic
5.7. Colocating Sets of Resources

5.1. Scores

Scores of all kinds are integral to how the cluster works. Practically everything from moving a resource to deciding which resource to stop in a degraded cluster is achieved by manipulating scores in some way.
Scores are calculated per resource and node. Any node with a negative score for a resource can’t run that resource. The cluster places a resource on the node with the highest score for it.

5.1.1. Infinity Math

Pacemaker implements INFINITY (or equivalently, +INFINITY) internally as a score of 1,000,000. Addition and subtraction with it follow these three basic rules:
  • Any value + INFINITY = INFINITY
  • Any value - INFINITY = -INFINITY
  • INFINITY - INFINITY = -INFINITY

Note

What if you want to use a score higher than 1,000,000? Typically this possibility arises when someone wants to base the score on some external metric that might go above 1,000,000.
The short answer is you can’t.
The long answer is it is sometimes possible work around this limitation creatively. You may be able to set the score to some computed value based on the external metric rather than use the metric directly. For nodes, you can store the metric as a node attribute, and query the attribute when computing the score (possibly as part of a custom resource agent).