Bug 1390071 - "pcs resource create" produces invalid cib on disallowed value of operation attribute
Summary: "pcs resource create" produces invalid cib on disallowed value of operation a...
Keywords:
Status: CLOSED ERRATA
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: Ivan Devat
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-31 07:43 UTC by Ivan Devat
Modified: 2017-08-01 18:24 UTC (History)
6 users (show)

Fixed In Version: pcs-0.9.156-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: Command "pcs resource create" does not validate attributes of operation correctly. Consequence: Pcs produces invalid cib and ends with an error message. From the error message it is difficult to identify the cause. Fix: Command "pcs resource create" validate attributes of operation correctly. Result: Pcs ends with an error message that is helpful for the user.
Clone Of:
Environment:
Last Closed: 2017-08-01 18:24:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed fix (20.06 KB, patch)
2017-02-01 08:53 UTC, Ivan Devat
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1958 normal SHIPPED_LIVE pcs bug fix and enhancement update 2017-08-01 18:09:47 UTC

Description Ivan Devat 2016-10-31 07:43:07 UTC
Description of problem:
When disallowed role of resource operation is entered in the "pcs resource create" command, pcs suggests to use flag --force. But the command with flag --force produces invalid cib.


Steps to Reproduce:

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc             
Error: role must be: Stopped, Started, Slave or Master (use --force to override)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc --force


Actual results:
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc             
Error: role must be: Stopped, Started, Slave or Master (use --force to override)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc --force
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib 

     
Expected results:
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc             
Error: role must be: Stopped, Started, Slave or Master
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc --force
Error: role must be: Stopped, Started, Slave or Master

Comment 1 Ivan Devat 2016-10-31 08:53:23 UTC
Note that there are more op-attributes that suffers with a similar problem:

> requires (should be one of: nothing quorum fencing unfencing)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor requires=abc
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib....

> on-fail (should be one of: ignore block stop restart standby fence)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor on-fail=abc
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib...

> record-pending (should be boolean true or false)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor record-pending=abc
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib...

> enabled (should be boolean true or false)
[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor enabled=abc
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib

Comment 2 Ivan Devat 2017-01-09 09:04:27 UTC
> start-delay and interval-origin can not appear together
[vm-rhel72-1 ~] $  pcs resource create R ocf:heartbeat:Dummy op monitor start-delay=10 interval-origin=20
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib...

Comment 4 Ivan Devat 2017-02-01 08:53:07 UTC
Created attachment 1246588 [details]
proposed fix

Tests are in the patch.

Comment 5 Ivan Devat 2017-02-20 08:14:14 UTC
After Fix:

[vm-rhel72-1 ~] $ rpm -q pcs
pcs-0.9.156-1.el7.x86_64


[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc
Error: 'abc' is not a valid role value, use Master, Slave, Started, Stopped

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor role=abc --force
Error: 'abc' is not a valid role value, use Master, Slave, Started, Stopped


[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor requires=abc
Error: 'abc' is not a valid requires value, use fencing, nothing, quorum, unfencing

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor requires=abc --force
Error: 'abc' is not a valid requires value, use fencing, nothing, quorum, unfencing


[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor on-fail=abc
Error: 'abc' is not a valid on-fail value, use block, fence, ignore, restart, restart-container, standby, stop

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor on-fail=abc --force
Error: 'abc' is not a valid on-fail value, use block, fence, ignore, restart, restart-container, standby, stop


[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor record-pending=abc
Error: 'abc' is not a valid record-pending value, use 0, 1, false, true

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor record-pending=abc --force
Error: 'abc' is not a valid record-pending value, use 0, 1, false, true


[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor enabled=abc
Error: 'abc' is not a valid enabled value, use 0, 1, false, true

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor enabled=abc --force
Error: 'abc' is not a valid enabled value, use 0, 1, false, true

Comment 9 errata-xmlrpc 2017-08-01 18:24:40 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, 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/RHBA-2017:1958


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