Example 6.10. A chain of collocated resources
<constraints> <rsc_colocation id="coloc-1" rsc="B" with-rsc="A" score="INFINITY"/> <rsc_colocation id="coloc-2" rsc="C" with-rsc="B" score="INFINITY"/> <rsc_colocation id="coloc-3" rsc="D" with-rsc="C" score="INFINITY"/> </constraints>
resource_sets
. Just like the expanded version, a resource that can’t be active also prevents any resource that must be collocated with it from being active. For example, if B was
not able to run, then both C (+and by inference +D)
must also remain stopped.
Example 6.11. The equivalent colocation chain expressed using resource_sets
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="collocated-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
<group id="dummy"> <primitive id="A" .../> <primitive id="B" .../> <primitive id="C" .../> <primitive id="D" .../> </group>
B would
be allowed to remain active even if A or
C
(or both) were inactive.
Example 6.12. Using colocation sets to specify a common peer.
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="collocated-set-1" sequential="false"> <resource_ref id="A"/> <resource_ref id="B"/> <resource_ref id="C"/> </resource_set> <resource_set id="collocated-set-2" sequential="true"> <resource_ref id="D"/> </resource_set> </rsc_colocation> </constraints>
sequential="true"
, then in order for member M to be active, member M+1 must also be active. You can even specify the role in which the members of a set must be in using the set’s role attribute.
Example 6.13. A colocation chain where the members of the middle set have no inter-dependencies and the last has master status.
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="collocated-set-1" sequential="true"> <resource_ref id="A"/> <resource_ref id="B"/> </resource_set> <resource_set id="collocated-set-2" sequential="false"> <resource_ref id="C"/> <resource_ref id="D"/> <resource_ref id="E"/> </resource_set> <resource_set id="collocated-set-2" sequential="true" role="Master"> <resource_ref id="F"/> <resource_ref id="G"/> </resource_set> </rsc_colocation> </constraints>