+INFINITY
or -INFINITY
. In such cases, if the constraint can’t be satisfied, then the rsc
resource is not permitted to run. For score=INFINITY
, this includes cases where the with-rsc
resource is not active.
A
to always run on the same machine as resource B
, you would add the following constraint:
Example 6.5. Mandatory colocation constraint for two resources
<rsc_colocation id="colocate" rsc="A" with-rsc="B" score="INFINITY"/>
INFINITY
was used, if B
can’t run on any of the cluster nodes (for whatever reason) then A
will not be allowed to run. Whether A
is running or not has no effect on B
.
A
cannot run on the same machine as B
. In this case, use score="-INFINITY"
.
Example 6.6. Mandatory anti-colocation constraint for two resources
<rsc_colocation id="anti-colocate" rsc="A" with-rsc="B" score="-INFINITY"/>
-INFINITY
, the constraint is binding. So if the only place left to run is where B
already is, then A
may not run anywhere.
INFINITY
, B
can run even if A
is stopped. However, in this case A
also can run if B
is stopped, because it still meets the constraint of A
and B
not running on the same node.