Bug 1325094 - fix parsing of 'constraint colocation add' parameters
Summary: fix parsing of 'constraint colocation add' parameters
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-08 08:24 UTC by Ivan Devat
Modified: 2020-09-16 14:29 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-16 14:29:29 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Ivan Devat 2016-04-08 08:24:50 UTC
Description of problem:
An invalid cib report is produced when a user tries to create a colocation constraint with an invalid role (valid roles are started, master, slave)

Version-Release number of selected component (if applicable):
pcs-0.9.149-2.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. Create two resources
[vm-rhel72-1 /] $ pcs resource create r1 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create r2 ocf:pacemaker:Dummy

2. Try create colocation for created resources with invalid role specification
[vm-rhel72-1 /] $ pcs constraint colocation add invalid-role r1 with r2

Actual results:
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib ...


Expected results:
Error: Invalid value 'invalid-role' for role, allowed values are started, master, slave

Comment 2 Ivan Devat 2016-04-08 09:07:07 UTC
There are more problems in this command:

Steps to Reproduce:
1. Create resources with ids "r1", "r2" and "master"
[vm-rhel72-1 /] $ pcs resource create r1 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create r2 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create master ocf:pacemaker:Dummy

2. Try create colocation for resources r1 and r2 with role specification, but forget keyword "with"
[vm-rhel72-1 /] $ pcs constraint colocation add master r1 slave r2

Actual results:
Colocation for resources master and r2 created.

Expected results:
No colocation created and usage for constraint colocation add listed.

Comment 3 Ivan Devat 2016-04-08 10:58:58 UTC
Steps to Reproduce:
1. Create resources with ids "r1" and "r2"
[vm-rhel72-1 /] $ pcs resource create r1 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create r2 ocf:pacemaker:Dummy

2. Try create colocation for resources r1 and r2 but forget keyword r2
[vm-rhel72-1 /] $ pcs add master r1 with

Actual results:
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 219, in <module>
    main(sys.argv[1:])
  File "/usr/sbin/pcs", line 159, in main
    cmd_map[command](argv)
  File "/usr/lib/python2.7/site-packages/pcs/constraint.py", line 67, in constraint_cmd
    colocation_add(argv)
  File "/usr/lib/python2.7/site-packages/pcs/constraint.py", line 194, in colocation_add
    if utils.is_score_or_opt(argv[1]):
IndexError: list index out of range

Expected results:
Usage for constraint colocation add listed.

Comment 4 Ivan Devat 2016-04-08 11:01:04 UTC
Steps to Reproduce:
1. Create resources with ids "r1" and "r2"
[vm-rhel72-1 /] $ pcs resource create r1 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create r2 ocf:pacemaker:Dummy

2. Try create colocation for resources r1 and r2 but forget keyword r2
[vm-rhel72-1 /] $ pcs add r1 with

Actual results:
Error: Resource 'with' does not exist

Expected results:
Usage for constraint colocation add listed.

Comment 5 Ivan Devat 2016-04-08 11:03:03 UTC
Steps to Reproduce:
1. Create resources with ids "r1", "r2" and "with"
[vm-rhel72-1 /] $ pcs resource create r1 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create r2 ocf:pacemaker:Dummy
[vm-rhel72-1 /] $ pcs resource create with ocf:pacemaker:Dummy

2. Try create colocation for resources r1 and r2 but forget keyword r2
[vm-rhel72-1 /] $ pcs add r1 with

Actual results:
Colocation for resources r1 and with created.

Expected results:
Usage for constraint colocation add listed.

Comment 7 Tomas Jelinek 2018-10-22 14:36:48 UTC
This has been partially fixed in pcs-0.10 branch by removing support for deprecated syntax in https://github.com/ClusterLabs/pcs/commit/dcab313b1ed8948642a3efcd29c1bb0c33745a88

Comment 8 Tomas Jelinek 2019-08-19 13:26:57 UTC
The issues described in comment 0 and comment 2 have been fixed in:
https://github.com/ClusterLabs/pcs/commit/2c259f6604cbcef07bab4e76d4ff0f2a345c5c8a for pcs-0.9 branch
https://github.com/ClusterLabs/pcs/commit/4afc322c39ccb0953de35951913721edddd44cfc for pcs-0.10 branch

Comment 3 issue has not been fixed yet in pcs-0.9 branch. It has been already fixed in pcs-0.10 branch.

Comment 4 and comment 5 cannot be really fixed due to the command supporting two syntaxes in pcs-0.9 branch. They have been fixed in pcs-0.10 branch.

Comment 9 Tomas Jelinek 2020-09-16 14:29:29 UTC
This has been already fixed in RHEL 8, see comment 8.
Considering the current RHEL 7 life cycle stage, there will be no further fixes for this bz in RHEL 7.


Note You need to log in before you can comment on or make changes to this bug.