Bug 1104656
Summary: | support for complex rules and better handling of invalid rules | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Tomas Jelinek <tojeline> | ||||
Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||
Status: | CLOSED ERRATA | QA Contact: | Martin Juricek <mjuricek> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 7.0 | CC: | cfeist, cluster-maint, mjuricek, rsteiger, slevine, tojeline | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | pcs-0.9.126-1.el7 | Doc Type: | Bug Fix | ||||
Doc Text: |
Cause:
User enters invalid or complex rule in 'pcs constraint location' command.
Consequence:
Depending on the rule pcs crashes, produces invalid rule or invalid CIB.
Fix:
Implement new rule parser supporting complex rules and providing explanatory error messages when the rule is invalid.
Result:
For valid rules pcs saves the rule into CIB correctly. For invalid rules pcs provides an explanatory error message and exits gracefully.
|
Story Points: | --- | ||||
Clone Of: | |||||||
: | 1129869 (view as bug list) | Environment: | |||||
Last Closed: | 2015-03-05 09:19:50 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: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1129869 | ||||||
Attachments: |
|
Description
Tomas Jelinek
2014-06-04 12:51:28 UTC
Created attachment 919059 [details]
proposed fix
Before Fix: [root@rh70-node1 ~]# rpm -q pcs pcs-0.9.115-32.el7.x86_64 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne Traceback (most recent call last): File "/usr/sbin/pcs", line 135, in <module> main(sys.argv[1:]) File "/usr/sbin/pcs", line 122, in main constraint.constraint_cmd(argv) File "/usr/lib/python2.7/site-packages/pcs/constraint.py", line 32, in constraint_cmd location_rule([sub_cmd2] + argv) File "/usr/lib/python2.7/site-packages/pcs/constraint.py", line 838, in location_rule utils.rule_add(lc, argv) File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 935, in rule_add if args[-1] == "or" or args[-1] == "and": IndexError: list index out of range [root@rh70-node1 ~]# echo $? 1 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and Error: Unable to update cib Call cib_replace failed (-203): Update does not conform to the configured schema <cib admin_epoch="0" cib-last-written="Wed Sep 10 16:41:52 2014" crm_feature_set="3.0.7" epoch="6504" have-quorum="1" num_updates="1" update-client="cibadmin" update-origin="rh70-node1" validate-with="pacemaker-1.2" dc-uuid="1"> {output trimmed} [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and '#uname' ne Error: Unable to update cib Call cib_replace failed (-203): Update does not conform to the configured schema <cib admin_epoch="0" cib-last-written="Wed Sep 10 16:42:55 2014" crm_feature_set="3.0.7" epoch="6504" have-quorum="1" num_updates="1" update-client="cibadmin" update-origin="rh70-node1" validate-with="pacemaker-1.2" dc-uuid="1"> {output trimmed} [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and '#uname' ne rh70-node2 or '#uname' ne rh70-node3 [root@rh70-node1 ~]# pcs constraint Location Constraints: Resource: dummy Constraint: location-dummy Rule: score=INFINITY Expression: #uname ne rh70-node3 Ordering Constraints: Colocation Constraints: After Fix: [root@rh70-node1 ~]# rpm -q pcs pcs-0.9.126-1.el7.x86_64 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne Error: '#uname ne' is not a valid rule expression: unexpected end of rule [root@rh70-node1 ~]# echo $? 1 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and Error: '#uname ne rh70-node1 and' is not a valid rule expression: unexpected end of rule [root@rh70-node1 ~]# echo $? 1 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and '#uname' ne Error: '#uname ne rh70-node1 and #uname ne' is not a valid rule expression: unexpected end of rule [root@rh70-node1 ~]# echo $? 1 [root@rh70-node1 ~]# pcs constraint location dummy rule '#uname' ne rh70-node1 and '#uname' ne rh70-node2 or '#uname' ne rh70-node3 [root@rh70-node1 ~]# echo $? 0 [root@rh70-node1 ~]# pcs constraint Location Constraints: Resource: dummy Constraint: location-dummy Rule: score=INFINITY boolean-op=or Rule: score=0 boolean-op=and Expression: #uname ne rh70-node1 Expression: #uname ne rh70-node2 Expression: #uname ne rh70-node3 Ordering Constraints: Colocation Constraints: 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, 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://rhn.redhat.com/errata/RHBA-2015-0415.html |