[Pacemaker] how to find on which node the resource is located

Andrew Beekhof andrew at beekhof.net
Thu Jun 30 00:04:10 EDT 2011


Don't you just want a colocation constraint?
Maybe you should back up and explain what you're trying to achieve.

On Wed, Jun 15, 2011 at 6:22 PM, Janec, Jozef <jozef.janec at hp.com> wrote:
> Hello All,
>
> I'm trying configure solution where one resource will be able know where is the second located.
> I have configured one easy resource
>
> <primitive id="rs_ip_s2s" class="ocf" type="IPaddr" provider="heartbeat">
>        <instance_attributes id="special-node1" score="5">
>                <rule id="node1-special-case" score="INFINITY" >
>                        <expression id="node1-special-case-expr" attribute="#uname" operation="eq" value="node1"/>
>                </rule>
>                <nvpair id="node1-special-case-rule_co" name="rule_co" value="1"/>
>        </instance_attributes>
>        <instance_attributes id="special-node2" score="4" >
>                <rule id="node2-special-case" score="INFINITY">
>                        <expression id="node2-special-case-expr" attribute="#uname" operation="eq" value="node2"/>
>                </rule>
>                <nvpair id="node2-special-case-rule_co" name="rule_co" value="2"/>
>        </instance_attributes>
>        <instance_attributes id="special-node3" score="3">
>                <rule id="node3-special-case" score="INFINITY" >
>                        <expression id="node3-special-case-expr" attribute="#uname" operation="eq" value="node3"/>
>                </rule>
>                <nvpair id="node3-special-case-rule_co" name="rule_co" value="3"/>
>        </instance_attributes>
>        <instance_attributes id="special-node4" score="2" >
>                <rule id="node4-special-case" score="INFINITY">
>                        <expression id="node4-special-case-expr" attribute="#uname" operation="eq" value="node4"/>
>                </rule>
>                <nvpair id="node4-special-case-rule_co" name="rule_co" value="4"/>
>        </instance_attributes>
>        <instance_attributes id="defaults" score="1" >
>                        <nvpair id="rs_ip_s2s-instance_attributes-ip" name="ip" value="10.226.130.48"/>
>             </instance_attributes>
> </primitive>
>
> But problem is that attribute rule_co isn't globally visible for another resources, I have location rule for second resource
>
> <rsc_location id="M_Master2" rsc="rs_ip_usr">
>                <rule id="M_Master2-rule"  boolean-op="and" score="-INFINITY">
>                <rule id="M_Master2-rule1"  boolean-op="or" score="1">
>                        <expression attribute="#uname" id="M_test2-1" operation="eq" value="node1"/>
>                        <expression attribute="#uname" id="M_test2-2" operation="eq" value="node2"/>
>                </rule>
>                <rule id="M_Master2-rule2"  boolean-op="or" score="2">
>                        <expression attribute="rule_co" id="test-31" operation="eq" value="3"/>
>                        <expression attribute="rule_co" id="test-32" operation="eq" value="4"/>
>                </rule>
>                </rule>
> </rsc_location>
>
> <rsc_location id="M_Master" rsc="rs_ip_usr">
>                <rule id="M_Master-rule"  boolean-op="and" score="-INFINITY">
>                <rule id="M_Master-rule1"  boolean-op="or" score="1">
>                        <expression attribute="#uname" id="M_test-1" operation="eq" value="node3"/>
>                        <expression attribute="#uname" id="M_test-2" operation="eq" value="node4"/>
>                </rule>
>                <rule id="M_Master-rule2"  boolean-op="or" score="2">
>                        <expression attribute="rule_co" id="test-21" operation="eq" value="2"/>
>                        <expression attribute="rule_co" id="test-22" operation="eq" value="1"/>
>                </rule>
>                </rule>
> </rsc_location>
>
> But it can't see attribute "rule_co". Is there way how to get the value from the rule_co like rs_ip_s2s.rule_co, or define some global attribute which will be visible for all ?
>
> I'm trying configure situation that the second resource will be able run only on two nodes which are in the same DC where is running resource1
>
> Thanks
>
> Jozef
>
> _______________________________________________
> 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://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
>




More information about the Pacemaker mailing list