Configure resource execution sequences

To determine the order in which the resources run, you must configure an ordering constraint.

The following shows the format for the command to configure an ordering constraint.

# pcs constraint order [action] resource_id then [action] resource_id [options]

For example the following command configures an ordering constraint to ensure that the resource firstresource starts first, before the resource secondresource.

# pcs constraint order start firstresource then secondresource

The following table summarizes the properties and options for configuring ordering constraints.

Table 1. Properties of an Order Constraint
Field Description

resource_id

The name of a resource on which an action is performed.

action

The action to be ordered on the resource. Possible values of the action property are as follows:

* start - Order start actions of the resource.

* stop - Order stop actions of the resource.

* promote - Promote the resource from an unpromoted resource to a promoted resource.

* demote - Demote the resource from a promoted resource to an unpromoted resource.

If no action is specified, the default action is start.

kind option

How to enforce the constraint. The possible values of the kind option are as follows:

* Optional - Only applies if both resources are executing the specified action.

* Mandatory - Always enforce the constraint (default value). If the first resource you specified is stopping or cannot be started, the second resource you specified must be stopped.

* Serialize - Ensure that no two stop/start actions occur concurrently for the resources you specify. The first and second resource you specify can start in either order, but one must complete starting before the other can be started. A typical use case is when resource startup puts a high load on the host.

symmetrical option

If true, the reverse of the constraint applies for the opposite action (for example, if B starts after A starts, then B stops before A stops). Ordering constraints for which kind is Serialize cannot be symmetrical. The default value is true for Mandatory and Optional kinds, false for Serialize.

Displaying ordering constraints

The following command lists all current ordering constraints.

# pcs constraint order [config]

You can display all current location, order, and colocation constraints with the following command. To show the internal constraint IDS, specify the --full option.

# pcs constraint [config] [--full]

By default, listing resource constraints does not display expired constraints. To include expired constraints in the listing, use the --all option of the pcs constraint command. This will list expired constraints, noting the constraints and their associated rules as (expired) in the display.

The following command lists the constraints that reference specific resources.

# pcs constraint ref resource ...
Removing resources from an ordering constraint

Use the following command to remove resources from any ordering constraint.

# pcs constraint order remove resource1 [resourceN]...