[Linux-HA] BUG: Lifetime rule?
Max Hofer
max.hofer at apus.co.at
Mon Feb 26 08:52:02 MST 2007
On Monday 26 February 2007 15:59, Andrew Beekhof wrote:
> On 2/26/07, Max Hofer <max.hofer at apus.co.at> wrote:
> > On Monday 26 February 2007 10:11, Andrew Beekhof wrote:
> > > On 2/25/07, Max Hofer <max.hofer at apus.co.at> wrote:
> > > > I played around with the lifetime attribute in constraints and i found
> > > > following behaviour strange (or maybe i don't understand the meaning
> > > > of the lifetime attribute).
> > > >
> > > > Attached a cib which implements the same expression twice, once
> > > > in a rule of a lifetime attribute and once in a normal rule.
> > > >
> > > > The expression just checks the value of a variable in the status section
> > > > (which i added manually with attrd_updater).
> > > >
> > > > The same expression fails in 'dummy-restart-hysteresis-lifetime-rule' but
> > > > evaluates correctly in 'dummy-location-rule2'. (evaluated with ptest)
> > > >
> > > > I think this is not correct - or am I wrong?
> > >
> > > constraint lifetimes can/should only contain time-related conditions
> > >
> > > >
> > > > Attached the CIB and ptest output.
> > > >
> > > > General question: the reason to use the lifetime rule comes from by
> > > > desired functionality to not restart a failed resource for a certain amount
> > > > of time.
> > > >
> > > > My implementation is the following:
> > > > * the stop operation of the resource agent maps an attribute in the CIB
> > > > with a dampen delete operation, something like
> > > > restart_hysteresis() {
> > > > local hysteresis=${1:="30s"} # set default restart hysteresis to 30 seconds
> > > > attrd_updater -d 0 -n resource-stopped -v true
> > > > sleep 0.5 # this is needed or no attribute is set (!!! a bug IMHO)
> > >
> > > even though I don't see the point of having those two lines, it should
> > The point is I need a hysteresis variable which is set to a specific value
> > (in my case true) and which is AUTOMATICALLY cleaned after
> > a certain time (i remove the attribute from the CIB - i could just set
> > to to false - which would work too)
> >
> > How else could i prevent the restart of a failed resource for a defined
> > time period? I found no other way.
>
> I meant that your next line
> > > > attrd_updater -d "$hysteresis" -n resource-stopped -v true
> should achieve the right result making the first two redundant
I do not think so. Let me explain - a rule which prevents the start when the
attribute is set
<rule id="iresource-hysteresis" score="-INFINITY">
<expression id="resource-stopped-expr1" attribute="resource-stopped" operation="defined"/>
<expression id="resource-stopped-expr2" attribute="resource-stopped" operation="eq" value="true"/>
</rule>
* normal operation: no attribute 'resource-stopped' set --> rule does not apply
* stop action:
- add attribute 'resource-stopped'='true' (first line) --> rule applies,
resource is not restarted on this node
- add remove attribute 'resource-attribute' with a dampen value of hysteresis
period (second line)
- after hysteresis time attribute is removed ---> rule does not apply --->
resource starts again
How can I save the first entry?
More information about the Linux-HA
mailing list