Having all the resources configured is only part of the job. Even if the cluster knows all needed resources, it might still not be able to handle them correctly. Resource constraints let you specify which cluster nodes resources can run on, what order resources will load, and what other resources a specific resource is dependent on.
There are three different kinds of constraints available:
Locational constraints that define on which nodes a resource may be run, may not be run or is preferred to be run.
Collocational constraints that tell the cluster which resources may or may not run together on a node.
Ordering constraints to define the sequence of actions.
When defining constraints, you also need to deal with scores. Scores of
all kinds are integral to how the cluster works. Practically everything
from migrating a resource to deciding which resource to stop in a
degraded cluster is achieved by manipulating scores in some way. Scores
are calculated on a per-resource basis and any node with a negative score
for a resource cannot run that resource. After calculating the scores for
a resource, the cluster then chooses the node with the highest one.
INFINITY is currently defined as
1,000,000. Additions or subtractions with it follows
the following 3 basic rules:
Any value + INFINITY = INFINITY
Any value - INFINITY = -INFINITY
INFINITY - INFINITY = -INFINITY
When defining resource constraints, you also specify a score for each constraint. The score indicates the value you are assigning to this resource constraint. Constraints with higher scores are applied before those with lower scores. By creating additional location constraints with different scores for a given resource, you can specify an order for the nodes that a resource will fail over to.
Procedure 4.4. Adding or Modifying Locational Constraints
Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.
In the Linux HA Management Client main window, click in the left pane to see the constraints already configured for the cluster.
In the left pane, select and click .
Select and click .
Enter a unique for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.
Select the for which to define the constraint. The list shows the IDs of all resources that have been configured for the cluster.
Set the for the constraint. Positive values
indicate the resource can run on the you
specify below. Negative values indicate the resource can not run on
this node. Values of +/- INFINITY change
“can” to must.
Select the for the constraint.
![]() |
If you leave the and the field empty, you can also add rules by clicking +. To add a lifetime, just click +.
If all parameters are set according to your wishes, click to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.
Procedure 4.5. Adding or Modifying Collocational Constraints
Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.
In the Linux HA Management Client main window, click in the left pane to see the constraints already configured for the cluster.
In the left pane, select and click .
Select and click .
Enter a unique for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.
Select the which is the collocation source. The list shows the IDs of all resources that have been configured for the cluster.
If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all.
If you leave both the and the field empty, you can also add a resource set by clicking +. To add a lifetime, just click +.
In , define the collocation target. The cluster will decide where to put this resource first and then decide where to put the resource in the field.
Define a to determine the location
relationship between both resources.
Positive values indicate the resources should run on the same node.
Negative values indicate the resources should not run on the same node.
Values of +/- INFINITY change
should to must. The score will be
combined with other factors to decide where to put the node.
If needed, specify further parameters, like .
Depending on the parameters and options you choose, a short explains the effect of the collocational constraint you are configuring.
If all parameters are set according to your wishes, click to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.
Procedure 4.6. Adding or Modifying Ordering Constraints
Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.
In the Linux HA Management Client main window, click in the left pane to see the constraints already configured for the cluster.
In the left pane, select and click .
Select and click .
Enter a unique for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.
With , define the resource that must be started before the resource is allowed to.
With define the resource that will start after the resource.
If needed, define further parameters, for example
(if greater than zero, the constraint is
mandatory; otherwise it is only a suggestion) or
(if true, stop the
resources in the reverse order).
Depending on the parameters and options you choose, a short explains the effect of the ordering constraint you are configuring.
If all parameters are set according to your wishes, click to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.
You can access and modify all constraints that you have configured in the view of the Linux HA Management Client.
For more information on configuring constraints and detailed background information about the basic concepts of ordering and collocation, refer to the following documents available at http://clusterlabs.org/wiki/Documentation:
Configuration 1.0 Explained , chapter Resource Constraints
Collocation Explained
Ordering Explained