Bug 1896458

Summary: Default rules with node attributes expressions can be created but are not in effect
Product: Red Hat Enterprise Linux 8 Reporter: Michal Mazourek <mmazoure>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: cfeist, cluster-maint, idevat, mlisik, mpospisi, omular, tojeline
Target Milestone: rcKeywords: Triaged
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.10.8-2.el8 Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 17:33:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed fix + tests none

Description Michal 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.

Comment 2 Tomas Jelinek 2021-02-11 15:04:20 UTC
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

Comment 5 Miroslav Lisik 2021-06-14 14:20:12 UTC
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

Comment 11 errata-xmlrpc 2021-11-09 17:33:51 UTC
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