Example 5.14. Colocation chain as individual constraints, where A is placed first, then B, then C, then D
<constraints> <rsc_colocation id="coloc-1" rsc="D" with-rsc="C" score="INFINITY"/> <rsc_colocation id="coloc-2" rsc="C" with-rsc="B" score="INFINITY"/> <rsc_colocation id="coloc-3" rsc="B" with-rsc="A" score="INFINITY"/> </constraints>
Example 5.15. Equivalent colocation chain expressed using resource_set
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-example" sequential="true"> <resource_ref id="A"/> <resource_ref id="B"/> <resource_ref id="C"/> <resource_ref id="D"/> </resource_set> </rsc_colocation> </constraints>
Note
resource_set
, the resources are listed in the order they are placed, which is the reverse of the order in which they are colocated. In the above example, resource A
is placed before resource B
, which is the same as saying resource B
is colocated with resource A
.
B
is unable to run, then both C
and by inference D
must remain stopped.
Important
A B
may be equivalent to A with B
, or B with A
.
sequential
property).
B
, C
, and D
will each be colocated with A
(which will be placed first). A
must be able to run in order for any of the resources to run, but any of B
, C
, or D
may be stopped without affecting any of the others.
Example 5.16. Using colocated sets to specify a shared dependency
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-2" sequential="false"> <resource_ref id="B"/> <resource_ref id="C"/> <resource_ref id="D"/> </resource_set> <resource_set id="colocated-set-1" sequential="true"> <resource_ref id="A"/> </resource_set> </rsc_colocation> </constraints>
Note
Important
sequential="false"
makes sense only if there is another set in the constraint. Otherwise, the constraint has no effect.
sequential="true"
, then in order for one member of that set to be active, all members listed before it must also be active.
role
property.
Example 5.17. Colocation in which the members of the middle set have no interdependencies, and the last set listed applies only to instances in the master role
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-1" sequential="true"> <resource_ref id="F"/> <resource_ref id="G"/> </resource_set> <resource_set id="colocated-set-2" sequential="false"> <resource_ref id="C"/> <resource_ref id="D"/> <resource_ref id="E"/> </resource_set> <resource_set id="colocated-set-3" sequential="true" role="Master"> <resource_ref id="A"/> <resource_ref id="B"/> </resource_set> </rsc_colocation> </constraints>
Note
require-all
option.