Hi Felix,
 
basically you have three option to provide information to the resource agent.
- Resource parameters
- Resource meta attributes
- Node attributes
 
Let me assume some information for an example.
Your nodes are named nodeA and nodeB.
The hardware address for nodeA shall be 0x30000 and for nodeB 0x60000.
 
Resource parameter should be defined in the meta information part of the resource agent. As long as you have always a defined number of nodes, this can work as follows.
crm configure ... param node1name=nodeA node1addr=0x30000 node2name=nodeB node2addr=0x60000
The resource agent can go through all nodeXname parameter and pick the number out with its own hostname and read the address with the same number.
Be aware, that all those parameters have to be defined in the mta-data.
 
Resource meta attributes are more relaxed, as you can assign every name and every value without defining them in the meta-data.
crm configure ... meta node1name=nodeA node1addr=0x30000 node2name=nodeB node2addr=0x60000
Read the meta data with crm_resource inside the resource agent.
 
Node attributes are set and read with crm_attribute and can be persistent.
Set the attribute with
crm_attribute -n hwaddr -N nodeA -l forever -v 0x30000
crm_attribute -n hwaddr -N nodeB -l forever -v 0x60000
Inside the resource agent read the value with
crm_attribute -n hwaddr -N $HOSTNAME -l forever -G -q
and you get the value for the current host.
 
I had a similar approach to do and used resource meta attributes mainly for two reasons.
- Resource configuration is bound to the resource and does not influence anybody else.
- Using "crm configure show" also shows the configuration of the resource, using crm_attribute would not.
 
Rainer
Gesendet: Montag, 08. April 2013 um 09:34 Uhr
Von: "Felix Zachlod" <fz.li...@sis-gmbh.info>
An: Pacemaker@oss.clusterlabs.org
Betreff: [Pacemaker] Clone Resources Individual Configuration per Node
Hello List,

I am up to writing a resource agent for Pacemaker which shall be used in a
Master/Slave manner. So the cluster shall always run two instances and one
of them shall be Master. My clone instances need a different configuration
depending on the node that they are running on. I know I could accomplish
this by having some kind of configuration file on each node but I want to
manage as much as possible through the cluster manager. So what I want is a
Master / Slave (or clone) resource running with instance attributes tied to
the cluster node which they are running on.

Let me explain what the purpose is:

The resource is dependent on specific hardware on the cluster node, which
has different hardware addresses on each node. So resource instance A DOES
deliver the same service as resource instance B at least when being in the
master state each but anyways has to be started with a different parameter.

I understood that I can configure a location constraint for a resource so
that it can be run only on one node Lets say my RA expects a param
hwaddr={string}. I can set up a resource for Node a with hwaddr="a" and one
for node b with hwaddr="b" but how can I tell pacemaker that these two
resources now shall be treated as a Master Slave set? Or am I thinking about
this too complicated?

Thank you for any hint in advance,
Felix


_______________________________________________
Pacemaker mailing list: Pacemaker@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
_______________________________________________
Pacemaker mailing list: Pacemaker@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

Reply via email to