[Pacemaker] Help with colocation and order of primitives

Jake Smith jsmith at argotec.com
Fri Feb 10 13:06:15 EST 2012

----- Original Message ----- 

> From: "Andrew Martin" <amartin at xes-inc.com>
> To: "The Pacemaker cluster resource manager"
> <pacemaker at oss.clusterlabs.org>
> Sent: Friday, February 10, 2012 10:33:44 AM
> Subject: [Pacemaker] Help with colocation and order of primitives

> Hello,

> I am working on configuring a 2-node cluster with 3 DRBD devices,
> their corresponding filesystem mounts, and a VirtualDomain resource
> agent. I want to add the appropriate constraints to pacemaker so
> that these resources only start together on the same node, and that
> they start in the proper order. I have added the DRBD devices to a
> Master/Slave object, as outlined in
> http://www.linbit.com/fileadmin/tech-guides/ha-nfs.pdf . I would
> like them to start in the following order (and stop in the reverse
> order):
> ms_drbd_r0
> ms_drbd_r1
> ms_drbd_r2
> p_filesystem_r0
> p_filesystem_r1
> p_filesystem_r2
> p_virtualdomain_vm0

> I added the 3 filesystem primitives to a group, g_filesystems, which
> simplifies this somewhat. Are primitives in a group started in the
> order they are listed in a group, and stopped in the opposite order?

Yes and colocated in reverse...

group test A B C
order is A B C
colocation is C B A
Starts A then B then C, Stops C, B, A.

> I read through the Pacemaker Explained documentation on colocation
> and order,
> http://www.clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/s-resource-sets-ordering.html

It shows XML but when adding via the CRM CLI the rules work the same.  The CRM CLI is just a(n easier) front-end for the XML (config is still written in XML)
Guide for CRM CLI is here:

> however it seems to mostly address the XML and not how to add
> constraints via the crm console (crm configure). It seems that I
> cannot add the Master/Slave objects to a group, so I will need to
> specify each of them individual in the constraints. Is it possible
> to include more than 2 resources to a constraint, e.g.
> colocation c_all_on_one inf: ms_drbd_r0:Master ms_drbd_r1:Master
> ms_drbd_r2:Master g_filesystems p_virtualdomain_vm0

Yes you can put more than one primitive in a colocation or order constraint - just be careful when adding multiples of different types of resource.  You may want to do "crm configure show xml" to verify the statement didn't create a resource set and change the outcome a little.
Also with order statements make sure you specify the action when combining different types otherwise the first action will apply to all resources i.e. ms_drbd_r0:promote g_filesystems:start

> Or, can a single colocation or order constraint only contain 2
> resources? If so would I need to chain several constraints together,
> like this:
> colocation c_r0-r1 inf: ms_drbd_r0:Master ms_drbd_r1:Master
> colocation c_r1-r2 inf: ms_drbd_r1:Master ms_drbd:r2:Master
> colocation c_r2-fs inf: ms_drbd_r2:Master g_filesystems
> colocation c_fs_vm0 inf: g_filesystems p_virtualdomain_vm0

> Which syntax is supported and how can I achieve these colocation and
> order constraints?

> Thanks,

> Andrew
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker

> Project Home: http://www.clusterlabs.org
> Getting started:
> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org

More information about the Pacemaker mailing list