I am encountering an issue with colocation constraints.
I have created a 4 nodes cluster (3 "main" and 1 "spare") with 3 resources, each resource should run only on its own node or on the spare and never together on the spare.
When the resources are created with the adequate priorities they are indeed running on each "main" node as expected.
If I add one colocation constraint (resource3 cannot run with resource2), resources remain correctly on their node.
But as soon as I add a second colocation constraint (resource2 cannot run with resource1), resource1 switches to the spare node and I cannot understand why.
Can somebody explain this behavior ?
Resource setup :
pcs property set symmetric-cluster=false
pcs resource create TestResourceNode1 ocf:pacemaker:Dummy op monitor interval=120s
pcs constraint location TestResourceNode1 prefers node1=100
pcs constraint location TestResourceNode1 prefers nodespare=80
pcs resource create TestResourceNode2 ocf:pacemaker:Dummy op monitor interval=120s
pcs constraint location TestResourceNode2 prefers node2=50
pcs constraint location TestResourceNode2 prefers nodespare=30
pcs resource create TestResourceNode3 ocf:pacemaker:Dummy op monitor interval=120s
pcs constraint location TestResourceNode3 prefers node3=10
pcs constraint location TestResourceNode3 prefers nodespare=1
Constraint setup :
pcs constraint colocation add TestResourceNode3 with TestResourceNode2 score=-INFINITY
# OK, resources are still running on node1, node2, node3
pcs constraint colocation add TestResourceNode2 with TestResourceNode1 score=-INFINITY
# KO, resource TestResourceNode1 has moved to nodespare, why ???