Hi Max, I haven't received such complete answer before. Thank you very much for the useful information.
I understood how attributes work. A shell script performing some operations/monitoring sets attributes by using attrd_updater or crm_attribite. The score for a resource can be changed with constraint matching these attributes. What I don't understand is the difference between -t node attribute and -t status attribute. Could you explain? They are set and read the same way. Why they are called static and dynamic since they can be set any time by some script for e.g.? Instance attributes are attributes which you pass to the OCF script? I'm I right? How can I print the score for my resources? I greatly appreciate your help. Regards, Atanas >-------- Оригинално писмо -------- >От: Max Hofer <[EMAIL PROTECTED]> >Относно: Re: [Linux-HA] How to control a resource with an environment >variable? >До: [email protected] >Изпратено на: Понеделник, 2007, Ноември 26 16:03:40 EET >---------------------------------- > >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] > ----------------------------------------------------------------- Оцеляваш ли? Сподели свое видео или снимки! 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
