0
node $id="10" db10 \
    attributes standby="off"
node $id="9" db09 \
    attributes standby="off"
primitive drbd_jenkins ocf:linbit:drbd \
    params drbd_resource="r0" \
    op start interval="0s" timeout="60s" \
    op stop interval="0s" timeout="60s"
primitive jenkins lsb:jenkins \
    op monitor interval="15s" \
    op start interval="0s" timeout="90s"
primitive mount_jenkins ocf:heartbeat:Filesystem \
    params device="/dev/drbd0" directory="/var/lib/jenkins/" fstype="ext4" \
    op start timeout="20s" interval="0" \
    op stop timeout="20s" interval="0"
primitive vip-158 ocf:heartbeat:IPaddr2 \
    params ip="x.x.x.158" nic="eth0" cidr_netmask="28" \
    op start interval="0s" timeout="60s" \
    op monitor interval="5s" timeout="20s" \
    op stop interval="0s" timeout="60s" \
    meta target-role="Started"
group jenkins_group jenkins vip-158 mount_jenkins
ms ms_drbd_jenkins drbd_jenkins \
    meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true" globally-unique="false" target-role="Master"
colocation drbd_mount inf: ms_drbd_jenkins:Master jenkins_group
order mount_after_drbd inf: ms_drbd_jenkins:promote jenkins_group:start
property $id="cib-bootstrap-options" \
    dc-version="1.1.10-42f2063" \
    cluster-infrastructure="corosync" \
    stonith-enabled="false" \
    last-lrm-refresh="1489005751"
rsc_defaults $id="rsc-options" \
    resource-stickiness="0"

When pacemaker starts, it's all fine:

root@db09:~# crm status
Last updated: Wed Mar  8 21:20:33 2017
Last change: Wed Mar  8 21:15:15 2017 via crm_resource on db10
Stack: corosync
Current DC: db10 (10) - partition with quorum
Version: 1.1.10-42f2063
2 Nodes configured
5 Resources configured



Online: [ db09 db10 ]

Master/Slave Set: ms_drbd_jenkins [drbd_jenkins]
     Masters: [ db09 ]
     Slaves: [ db10 ]
Resource Group: jenkins_group
     jenkins    (lsb:jenkins):  Started db09 
     vip-158    (ocf::heartbeat:IPaddr2):   Started db09 
     mount_jenkins  (ocf::heartbeat:Filesystem):    Started db09

But I cant move master to db10, either with:

crm_resource --resource ms_drbd_jenkins --move --node db10

or

crm resource migrate ms_drbd_jenkins db10

The worst thing is if I set db09 node standby, both becomes slaves:

root@db09:~# crm node standby db09
root@db09:~# crm status
Last updated: Wed Mar  8 21:27:26 2017
Last change: Wed Mar  8 21:27:24 2017 via crm_attribute on db09
Stack: corosync
Current DC: db10 (10) - partition with quorum
Version: 1.1.10-42f2063
2 Nodes configured
5 Resources configured


Node db09 (9): standby
Online: [ db10 ]

 Master/Slave Set: ms_drbd_jenkins [drbd_jenkins]
     Slaves: [ db09 db10 ]

If db10 goes standby, it becomes stopped, which is expected:

root@db09:~# crm node standby db10
root@db09:~# crm status
Last updated: Wed Mar  8 21:28:45 2017
Last change: Wed Mar  8 21:28:44 2017 via crm_attribute on db09
Stack: corosync
Current DC: db10 (10) - partition with quorum
Version: 1.1.10-42f2063
2 Nodes configured
5 Resources configured


Node db10 (10): standby
Online: [ db09 ]

 Master/Slave Set: ms_drbd_jenkins [drbd_jenkins]
     Masters: [ db09 ]
     Stopped: [ db10 ]
 Resource Group: jenkins_group
     jenkins    (lsb:jenkins):  Started db09 
     vip-158    (ocf::heartbeat:IPaddr2):   Started db09 
     mount_jenkins  (ocf::heartbeat:Filesystem):    Started db09 

What am I doing wrong here?

1 Answer 1

2

Your colocation constraint is incorrect. You're telling the cluster that DRBD must be Master where jenkins_group is started.

Use the following constraints instead:

colocation cl_jenkins-with-drbd inf: jenkins_group ms_drbd_jenkins:Master
order o_drbd-before-jenkins inf: ms_drbd_jenkins:promote jenkins_group:start

Pro-tip: Notice the "language" in the constraint names: cl____-with-____, o____-before-____. That matches the resource names the follow the inf: scoring. If you follow the with and before naming conventions in your constraint names, they become much easier to read/manage/troubleshoot.

2
  • How colcocation constraint affects ordering, if I already make explicit order constraint? Colocation constraint sets condition that those resources have to be on the same node, it does not affect order of resource starting, which id defined in order constraint.
    – Boban P.
    Mar 12, 2017 at 9:55
  • colocation doesn't affect ordering, but your colocation constraint is not correct. Mar 13, 2017 at 21:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .