I have'nt checked your location constraint but what you want to achieve you 
can't do with environment variables. You have to use CIB attributes.

So instead of changing the environment variable you change the CIB attribute.

Using attributes instead environment variables seems more logical if you think 
about the fact that attributes are propagated to all cluster nodes. Whereas 
environment variables are not.

What you have to decide is if you are using "global (or rather static) 
attribute" (i.e. it shows up in the <nodes> section) or if you use an 
attribute of temporary nature (i.e. in the <status> section).

What kind of attribite you use, depends what you want to achieve.

Somthing like: run a resource on the node with more RAM are definietyl of 
static nature (add a "RAM" attribute to each node and write a rule which 
creates a score based on this value).

If you have something like: run the resource on the node where a shell 
script "X_Y_Z" returns the highest value, you need a resource agent which 
calls X_Y_Z periodically (if it changes over time) and maps its return value 
into the CIB in the <status> section.

Naturally you have to write a rule which adpats the score based on the 
attribute.

Mapping the attribute can be achieved with two tools: attrd_updater or 
crm_attribite.

The first tool provides a hysteresis functionality. You can dampen the value 
for a certain time period (i.e. the value is propagated to the other nodes 
after the dampen time - this may be handy if your value may change with a 
high frequency and you want avoid a resource failover when the system has a 
small "hickup").

On Sunday 25 November 2007, Atanas Dyulgerov wrote:
> Hi all,
>
> I need to control a resource with an environment variable. When I set the
> variable with value "true" to increase the score for a resource.
>
> I did the following constraint:
> <rsc_location id="rloc_unique_id" rsc="service_ip">
>     <rule score="INFINITY" boolean_op="or" id="rcloc_rule_unique_id">
>        <expression id="expr:hfc:defined" attribute="my_variable"
> operation="defined"/> <expression id="expr:hfc:true"
> attribute="my_variable" operation="eq" value="true"/> </rule>
> </rsc_location>
>
> Then I export the variable my_variable on the node where I want to move the
> resource service_ip. # export my_variable=true
>
> Nothing happens.
>
> # export OCF_RESKEY_my_variable=true
>
> Again nothing happens.
>
> So, how can I control the resource from an env variable? How to export the
> variable?
>
> One more question. How to display all the OCF_RESKEY variable set by the
> instant resource attributes? # export -p
> or
> # set
> do not display any OCF_RESKEY_* variables.
>
> Thank you in advance.
>
> Atanas Dyulgerov
>
>
>
> -----------------------------------------------------------------
> Оцеляваш ли? Сподели свое видео или снимки! http://robinson.btv.bg/isurvive
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems



-- 
Max Hofer
APUS Software G.m.b.H.
A-8074 Raaba, Bahnhofstraße 1/1
T| +43 316 401629 11
F| +43 316 401629 9
W| www.apus.co.at
E| [EMAIL PROTECTED]
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to