Cluster Constraints
From DHVLab
Ordering Constraints
Set up the constraints which services need to run on the same machine
#if node gets drbd master for sync, mount /sync there
pcs constraint order promote ClusterDataSyncS then start ClusterDataSyncFS kind=Mandatory
#start mounting /sync if drbd gets started
pcs constraint order start ClusterDataSyncFS then start openvpn-server kind=Mandatory
#start the oVirt manager VM on the node that is DRBD master of the virt device (VM root hd)
pcs constraint order promote ClusterDataVirtS then start vm-guest1 kind=Mandatory
#start OpenVPN if IPs get available
pcs constraint order start ClusterIP then start openvpn-server kind=Mandatory
#start the IP addresses on the node where the PostgreSQL server is master
pcs constraint order promote msPostgresql then start IP-Group score=INFINITY symmetrical=false
#stop IP resources if the PostgreSQL server migrates inside the cluster
pcs constraint order demote msPostgresql then stop IP-Group score=0 non-symmetrical=false
Colocation Constraints
#oVirt root hd has to be on the same node as the PostgreSQL master
pcs constraint colocation add ClusterDataVirtS with msPostgresql rsc-role=Started with-rsc-role=Master score=INFINITY
#/sync has to be on the same node as PostgreSQL master
pcs constraint colocation add ClusterDataSyncS with msPostgresql rsc-role=Started with-rsc-role=Master score=INFINITY
#/sync filesystem has to be on the same node as DRBD master
pcs constraint colocation add ClusterDataSyncFS with ClusterDataSyncS rsc-role=Started with-rsc-role=Master score=INFINITY
#IP addresses have to be on the same node as PostgreSQL
pcs constraint colocation add IP-Group with msPostgresql rsc-role=Started with-rsc-role=Master score=INFINITY
#OpenVPN needs to access the config on /sync
pcs constraint colocation add openvpn-server with ClusterDataSyncFS score=INFINITY
#oVirt VM has to be on the same node as its root disk
pcs constraint colocation add vm-guest1 with ClusterDataVirtS rsc-role=Started with-rsc-role=Master score=INFINITY