0

So my current environment is centos7 on a pair of identical bare metal servers. I've installed drbd and carved up 3 x 100G block devices for DRBD to mirror. Then I installed a Centos7 image on one of those block devices.

I wanted Pacemaker to manage DRBD as well as the xen virtual images, so I followed the directions specified in clusterlabs.org's "Clusters From Scratch" doc:

pcs cluster cib drbd_cfg

pcs -f drbd_cfg resource create XenHost01_Storage ocf:linbit:drbd drbd_resource=XenHost01 op monitor interval=60s

pcs -f drbd_cfg resource master XenHost01_StorageClone XenHost01_Storage master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true

pcs cluster cib-push drbd_cfg

Then I added in the Xen vm to be managed as well.

pcs cluster cib vmstate_cfg
pcs -f vmstate_cfg resource create XenHosts --group vminit systemd:vmstate op monitor interval=10s

pcs cluster cib-push vmstate_cfg

So my cluster resources would look like this:


Full list of resources:

 Master/Slave Set: XenHost01_StorageClone [XenHost01_Storage]
     Masters: [ ha1 ]
     Slaves: [ ha2 ]
 Resource Group: vminit
     XenHosts   (systemd:vmstate):  Started ha1

PCSD Status:
  ha1: Online
  ha2: Online

What I'm trying to figure out, and the reason for my post, is how to stick that DRBD master/slave pair under the vminit group, so that the Xen virtual machines only get started on the primary DRBD host. Without them in a group, if the other host shows up as primary in DRBD, the cluster doesn't care and still tries to start up the virtual images and will fail.

Anybody know how to get that master/slave drbd resource under a group? I've been tearing my hair out.

0

You need to use ordering a colocation constraints to tell the cluster that it can only start the vminit group where XenHost01_StorageClone is master.

The following should do it for you:

# pcs cluster cib cib_constraints.xml
# pcs -f cib_constraints.xml constraint order promote XenHost01_StorageClone then start vminit
# pcs -f cib_constraints.xml constraint colocation add vminit with master XenHost01_StorageClone
# pcs cluster verify cib_constraints.xml
# pcs cluster cib-push cib_constraints.xml
| improve this answer | |
  • So that will stack? Ie, if I have multiple drbd Master/Slave pairs, I can add a constraint so the vminit group won't start up unless every Master/Slave is properly promoted? – MeatLips Jun 9 '16 at 19:15
  • If all the primaries are going to be on the same node you might want to look into DRBD's multi-volume resource configuration: drbd.org/en/doc/users-guide-84/… That will let you configure a single DRBD primitive and master/slave set in Pacemaker that controls many DRBD volumes. Otherwise, you will need constraints that say "only promote to master, where $drbd_res is master", creating more of a chain... if that makes sense. Hope that's helpful :) – Matt Kereczman Jun 10 '16 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.