Cause:
User creates a resource defaults set with a rule and uses node attribute expressions in the rule.
Consequence:
The rule does not work as expected, since node attribute expressions are not actually supported for resource defaults.
Fix:
Check that node attribute expressions are not used in resource defaults.
Result:
Pcs exits with an error when node attribute expressions are used in a rule for resource defaults.
DescriptionMichal Mazourek
2020-11-10 15:48:48 UTC
pcs needs to reflect this in resource defaults.
bz1891929 comment 8:
--- Additional comment from Ken Gaillot on 2020-11-06 22:24:49 UTC ---
After further investigation, we determined that it is correct but undocumented behavior that node attribute expressions are not supported for *meta-attributes*, except in the context of an operation or operation defaults. Node attribute expressions do not work with meta-attributes in a resource's configuration, resource defaults, or cluster properties.
Node attribute expressions should work for resource options (instance attributes), whether in the resource configuration or resource defaults, so it is correct that pcs allows node attribute expressions in resource defaults. (That can be used in testing the original bz.) It would probably be a good idea for pcs to reject the combination of meta and node attribute rules for resource defaults.
This makes sense when you consider that only an operation is directly associated with a single node. Most meta-attributes would make no sense being node-specific (target-role, allow-migrate, etc.). While some might (resource-stickiness, migration-threshold), that would be an unusual use case, and I'd rather wait until there is customer demand before formalizing that as an RFE.
I'm not sure whether this needs to be documented in RHEL. I believe rules are currently documented only in the context of location constraints (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_high_availability_clusters/assembly_determining-resource-location-with-rules-configuring-and-managing-high-availability-clusters) so there's no existing place for it. Possibly the pcs man page could be updated for "pcs resource defaults".
Pacemaker should enforce proper rule syntax usage more strictly via its XML schema, but for compatibility reasons that is not feasible in the RHEL 8 time frame.
Created attachment 1756379[details]
proposed fix + tests
Test:
# pcs resource defaults set create rule resource ocf:heartbeat:Dummy and defined test_attr
Error: Keywords 'defined', 'not_defined', 'eq', 'ne', 'gte', 'gt', 'lte' and 'lt' cannot be used in a rule in this command
Error: Errors have occurred, therefore pcs is unable to continue
Test:
[root@r8-node-01 ~]# rpm -q pcs
pcs-0.10.8-2.el8.x86_64
[root@r8-node-01 ~]# pcs resource defaults set create rule resource ocf:heartbeat:Dummy and defined test_attr
Error: Keywords 'defined', 'not_defined', 'eq', 'ne', 'gte', 'gt', 'lte' and 'lt' cannot be used in a rule in this command
Error: Errors have occurred, therefore pcs is unable to continue
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Low: pcs security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2021:4142