[ClusterLabs] Q: start/stop/order/colocate resources based on an attribute value
kgaillot at redhat.com
Tue Nov 26 10:27:27 EST 2019
On Tue, 2019-11-26 at 08:40 +0100, Ulrich Windl wrote:
> I'm thinking about some mechanism that involves remote probing of
> some resource. As a result of such probing an attribute value would
> be set (like 0|1, maybe even multiple values).
> Is it possible to start a resource after the attribute is set to 1
> (and stop it when the attribute changes to 0)?
> Is it possible to wait for start until the attribute is 1?
Yes, rules support checking node attribute values for location
constraints. Whatever higher-level tool you use likely has simplified
syntax, but the XML is (under "Location Rules Based on Other Node
Basically you use attrd_updater or crm_attribute to set the node
attribute, and configure a location constraint containing a rule, which
has a score and contains a rule expression specifying the desired
condition. In this case you'd probably want a -INFINITY score where the
attribute is not 1.
> Is it possible to suspend monitoring (or to ignore the results of it)
> if the attribute is 0? (That would be to avoid "false" monitoring
Maaaaybe, but that sounds iffy. With the above rule, the cluster would
stop the resource, so it wouldn't matter.
But if you didn't want to stop the resource, just suspend monitoring,
rules might work inside an operation definition. It works for the
resource options themselves:
and I suspect the same approach would work inside an op. Usually
operation options (like on-fail and timeout) are specified directly in
the op tag, but it is allowed to specify them in an meta_attributes
block, where you could try a rule. In this case you would use the rule
to set enabled=true/false for the op.
I suspect timing concerns may come into play with either approach.
There will be some time between when the condition occurs and your
remote monitor detects it and sets the node attribute. In that time a
monitor could run on the resource.
> When on multiple nodes is it possible to colocate a resource where
> the attribute is 1?
The location rule mentioned above would apply to all nodes that meet
> Obviously such things have to be done using rules, but I haven't
> found any examples going in such direction.
Ken Gaillot <kgaillot at redhat.com>
More information about the Users