Skip to content

Deprecate pcmk_evaluate_rule() and pcmk_rule_input_t, and minor location unpacking changes - #4163

Open
nrwahl2 wants to merge 17 commits into
ClusterLabs:mainfrom
nrwahl2:nrwahl2-time_first
Open

Deprecate pcmk_evaluate_rule() and pcmk_rule_input_t, and minor location unpacking changes#4163
nrwahl2 wants to merge 17 commits into
ClusterLabs:mainfrom
nrwahl2:nrwahl2-time_first

Conversation

@nrwahl2

@nrwahl2 nrwahl2 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

nrwahl2 added 17 commits August 11, 2026 16:07
To replace pcmk_evaluate_rule().

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
There doesn't seem to be much use case for this. We could come up with a
contrived use case: a user wants to find out whether a rule will
evaluate to true or false under some combination of current date/time,
node attributes, resource parameters, etc. The user might want to test
a rule that's already in the configuration or one that they're
considering adding.

However, we have pcmk_check_rule() and pcmk_check_rules(), which serve a
similar but more limited purpose. Given an input CIB, a date/time
object, and one or more rule IDs (for rules in the input CIB), those
functions determine whether the rules woudl evaluate to true or false at
the given date/time.

Those functions can replace arbitrary calls to pcmk_evaluate_rule().
Instead of setting up your own pcmk_rule_input_t object for
pcmk_evaluate_rule(), create the input CIB so that it contains the
desired node attributes, resource parameters, etc. Then pass that input
CIB and a date/time object to pcmk_check_rule(s)().

Some of the documentation for the pcmk_rule_input_t struct is a bit
vague for external users. More importantly, it will be nice to be able
to change the implementation without affecting any external users.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace pcmk_rule_input_t. Also add a conversion function, so that we
can change the internal pcmk__rule_input_t definition later.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This requires changing the helper functions too, some of which are
non-static. However, doing this for pcmk__evaluate_rule() and all its
helpers at the same time, turned out to be cleaner than doing them one
by one.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Instead of pcmk_rule_input_t.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Instead of pcmk_rule_input_t.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Instead of pcmk_rule_input_t.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It's only used by deprecated functions now.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Replace it with an internal enum pcmk__condition.

These members were added by commit 24137b1 and were already deprecated.
They were exposed as part of the public API as a compatibility
workaround, but this was not actually necessary. No public API function
accepts or returns an enum expression_type value.

For this reason, the particular values of enum pcmk__condition don't
matter and don't need to be kept aligned with the deprecated public enum
expression_type.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
rules.h is now empty except for the conditional include of
rules_compat.h.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It's potentially convenient, but nothing uses it.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It uses '%', not '\'.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And a couple other best practices.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@ptrotonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...in a location constraint. With schema validation enabled, it's not
possible to have both attributes set within a single location
constraint. Prior to this commit, we would apply the constraint both to
the resource named by rsc and to any resources matched by rsc-pattern.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant