[ClusterLabs] Coming in 2.0.2: check whether a date-based rule is expired

Ken Gaillot kgaillot at redhat.com
Tue Apr 16 13:38:38 EDT 2019


Hi all,

I wanted to point out an experimental feature that will be part of the
next release.

We are adding a "crm_rule" command that has the ability to check
whether a particular date-based rule is currently in effect.

The motivation is a perennial user complaint: expired constraints
remain in the configuration, which can be confusing.

We don't automatically remove such constraints, for several reasons: we
try to avoid modifying any user-specified configuration; expired
constraints are useful context when investigating an issue after it
happened; and crm_simulate can be run for any configuration for an
arbitrary past date to see what would have happened at that time.

The new command gives users (and high-level tools) a way to determine
whether a rule is in effect, so they can remove it themselves, whether
manually or in an automated way such as a cron.

You can use it like:

    crm_rule -r <rule-id> [-d <date>] [-X <rule-xml>]

With just -r, it will tell you whether the specified rule from the
configuration is currently in effect. If you give -d, it will check as
of that date and time (ISO 8601 format). If you give it -X, it will
look for the rule in the given XML rather than the CIB (you can also
use "-X -" to read the XML from standard input).

Example output:

    % crm_rule -r my-current-rule
    Rule my-current-role is still in effect

    % crm_rule -r some-long-ago-rule
    Rule some-long-ago-rule is expired

    % crm_rule -r some-future-rule
    Rule some-future-rule has not yet taken effect

    % crm_rule -r some-recurring-rule
    Could not determine whether rule some-recurring-rule is expired

Scripts can use the exit status to distinguish the various cases.

The command will be considered experimental for the 2.0.2 release; its
interface and behavior may change in future versions. The current
implementation has a limitation: the rule may contain only a single
date_expression, and the expression's operation must not be date_spec.

Other capabilities may eventually be added to crm_rule, for example the
ability to evaluate the current value of any cluster or resource
property.
-- 
Ken Gaillot <kgaillot at redhat.com>



More information about the Users mailing list