Deprecate pcmk_evaluate_rule() and pcmk_rule_input_t, and minor location unpacking changes - #4163
Open
nrwahl2 wants to merge 17 commits into
Open
Deprecate pcmk_evaluate_rule() and pcmk_rule_input_t, and minor location unpacking changes#4163nrwahl2 wants to merge 17 commits into
nrwahl2 wants to merge 17 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.