Bug 1734361
Summary: | Provide a hint about the "set" option for cmds containing multiple "then" keywords in their constraint definitions | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Tomas Jelinek <tojeline> | ||||
Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||
Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 8.0 | CC: | cfeist, cluster-maint, cluster-qe, cmarthal, idevat, mlisik, mmazoure, nhostako, omular, tojeline | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | pcs-0.10.3-2.el8 | Doc Type: | Bug Fix | ||||
Doc Text: |
Cause:
The user specifies multiple resources in the 'pcs constraint colocation add' or 'pcs constraint order' commands.
Consequence:
A constraint for the first two resources is created, the other resources are silently ignored, no error is reported.
Fix:
Improve command line parsing and validation in the commands.
Result:
The user is informed that exactly two resources may be specified in the commands. They are advised to use set constraints instead to set constraints for multiple resources.
|
Story Points: | --- | ||||
Clone Of: | 1500012 | Environment: | |||||
Last Closed: | 2020-04-28 15:27:56 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
Tomas Jelinek
2019-07-30 11:00:56 UTC
Created attachment 1596893 [details]
proposed fix + tests
In order to fix the reported issue properly a few more fixes had to be implemented:
* 'pcs constraint colocation add': report an error when multiple "with"s are specified, provide a hint that 'pcs constraint colocation set' should be used instead
* 'pcs constraint colocation add': report an error when specified resource roles are not valid
* 'pcs constraint colocation add': missing 'name' or '=value' in name=value options is reported as an error
* 'pcs constraint order': report an error when multiple "then"s are used, provide a hint that 'pcs constraint order set' should be used instead
* 'pcs constraint order': missing 'name' or '=value' in name=value options is reported as an error
After fix: [root@r81-node-01 ~]# rpm -q pcs pcs-0.10.3-1.el8.x86_64 [root@r81-node-01 pcs]# pcs resource d-01 (ocf::pacemaker:Dummy): Started r81-node-01 d-02 (ocf::pacemaker:Dummy): Started r81-node-02 d-03 (ocf::pacemaker:Dummy): Started r81-node-01 ### order [root@r81-node-01 pcs]# pcs constraint order d-01 then d-02 then d-03 Usage: pcs constraint [constraints]... order [show] [--full] List all current ordering constraints (if --full is specified show the internal constraint id's as well). order [action] <resource id> then [action] <resource id> [options] Add an ordering constraint specifying actions (start, stop, promote, demote) and if no action is specified the default action will be start. Available options are kind=Optional/Mandatory/Serialize, symmetrical=true/false, require-all=true/false and id=<constraint-id>. order set <resource1> [resourceN]... [options] [set <resourceX> ... [options]] [setoptions [constraint_options]] Create an ordered set of resources. Available options are sequential=true/false, require-all=true/false and action=start/promote/demote/stop. Available constraint_options are id=<constraint-id>, kind=Optional/Mandatory/Serialize and symmetrical=true/false. order delete <resource1> [resourceN]... Remove resource from any ordering constraint order remove <resource1> [resourceN]... Remove resource from any ordering constraint Error: Multiple 'then's cannot be specified. Hint: Use the 'pcs constraint order set' command if you want to create a constraint for more than two resources. [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint order d-01 then d-02 true Error: missing value of 'true' option [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint order d-01 then d-02 =true Error: missing key in '=true' option [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint order d-01 then d-02 symetrical Error: missing value of 'symetrical' option [root@r81-node-01 pcs]# echo $? 1 ### colocation [root@r81-node-01 pcs]# pcs constraint colocation add d-01 with d-02 with d-03 Usage: pcs constraint [constraints]... colocation add [master|slave] <source resource id> with [master|slave] <target resource id> [score] [options] [id=constraint-id] Request <source resource> to run on the same node where pacemaker has determined <target resource> should run. Positive values of score mean the resources should be run on the same node, negative values mean the resources should not be run on the same node. Specifying 'INFINITY' (or '-INFINITY') for the score forces <source resource> to run (or not run) with <target resource> (score defaults to "INFINITY"). A role can be master or slave (if no role is specified, it defaults to 'started'). Error: Multiple 'with's cannot be specified. Hint: Use the 'pcs constraint colocation set' command if you want to create a constraint for more than two resources. [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint colocation add d-01 with d-02 value Error: invalid role value 'd-02', allowed values are: 'Master', 'Slave', 'Started', 'Stopped' [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint colocation add d-01 with d-02 =value Error: missing key in '=value' option [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint colocation add d-01 with d-02 name=value something Error: missing value of 'something' option [root@r81-node-01 pcs]# echo $? 1 [root@r81-node-01 pcs]# pcs constraint Location Constraints: Ordering Constraints: Colocation Constraints: Ticket Constraints: Additional upstream commits: https://github.com/ClusterLabs/pcs/commit/a04934bf9fd4bcd96eb9860a48b4d840fa7a158b https://github.com/ClusterLabs/pcs/commit/170b06cb89e419401480e59d824a7ad220e5c7b1 Test: [root@r81-node-01 ~]# rpm -q pcs pcs-0.10.3-2.el8.x86_64 [root@r81-node-01 ~]# pcs resource * dummy-01 (ocf::pacemaker:Dummy): Started r81-node-01 * dummy-02 (ocf::pacemaker:Dummy): Started r81-node-02 [root@r81-node-01 ~]# pcs constraint order dummy-01 then dummy-02 symetrical= Error: value of 'symetrical' option is empty [root@r81-node-01 ~]# echo $? 1 [root@r81-node-01 ~]# pcs constraint colocation add dummy-01 with dummy-02 name= Error: value of 'name' option is empty [root@r81-node-01 ~]# echo $? 1 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://access.redhat.com/errata/RHEA-2020:1568 |