Bug 1382597 - "pcs resource create" produces invalid cib when the use of unknown op attribute is forced
Summary: "pcs resource create" produces invalid cib when the use of unknown op attribu...
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-07 06:49 UTC by Ivan Devat
Modified: 2017-08-01 18:24 UTC (History)
7 users (show)

Fixed In Version: pcs-0.9.156-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: Pcs allows the user to enforce invalid attribute of resource operation in "pcs resource create". Consequence: Pcs produces invalid cib ends with an error message. From the error message it is difficult to identify the cause. Fix: Pcs does not allow the user to enforce invalid attribute of resource operation in "pcs resource create". Result: It is not possible to enforce invalid attribute of resource operation in "pcs resource create".
Clone Of:
Environment:
Last Closed: 2017-08-01 18:24:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed fix (4.71 KB, patch)
2017-01-31 16:54 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
Red Hat Bugzilla 1469801 None NEW pcs does not allow configuring per-operation instance attributes (completing the environment for executing such an actio... 2019-10-18 11:03:54 UTC

Internal Links: 1469801

Description Ivan Devat 2016-10-07 06:49:38 UTC
Description of problem:
When unknown op-attribute is entered in the "pcs resource create", pcs suggests to use flag --force.
But the command with flag --force produces invalid cib.

How reproducible: always


Steps to Reproduce:
1.
[vm-rhel72-1 ~] $ pcs resource create dummy Dummy op monitor interval=1min a=b
Error: a is not a valid op option (use --force to override)
2.
[vm-rhel72-1 ~] $ pcs resource create dummy Dummy op monitor interval=1min a=b --force


Actual results:
Error: Unable to update cib
Call cib_replace failed (-203): Update does not conform to the configured schema
<cib...
[vm-rhel72-1 ~] $ echo $?
1


Expected results:
[vm-rhel72-1 ~] $ echo $?
0
[vm-rhel72-1 ~] $ pcs resource show dummy
 Resource: dummy (class=ocf provider=heartbeat type=Dummy)
  Operations: start interval=0s timeout=20 (dummy-start-interval-0s)
              stop interval=0s timeout=20 (dummy-stop-interval-0s)
              monitor interval=1min a=b (dummy-monitor-interval-1min)


Additional info:
The problem is that pcs put the attribute "a" to the "op" element as attribute. And it does not conform schema. Pcs could put the attribute "a" as instance attribute (in nvpair) of "op" element:

<op id="dummy-monitor-interval-1min" interval="1min" name="monitor">
  <instance_attributes id="params-dummy-monitor-interval-1min">
    <nvpair id="dummy-monitor-interval-1min-a" name="a" value="b"/>
  </instance_attributes>
</op>

Comment 1 Ivan Devat 2017-01-09 08:55:07 UTC
Putting invalid attributes into "instance_attributes" of "op" is not a good idea. Currently there is no syntax to distinguish between attributes of "op" and "instance_attributes" of "op".

Currently in "pcs resource create" it is not possible to specify "instance_attributes" of "op". The only exception is OCF_CHECK_LEVEL (alias "depth") which is always put in "instance_attributes" of "op".

Because of this we are not going to allow to specify "instance_attributes" of "op" for now.

Comment 3 Ivan Devat 2017-01-31 16:54:01 UTC
Created attachment 1246366 [details]
proposed fix

Tests are in the patch.

Comment 4 Ivan Devat 2017-02-20 08:08:54 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 interval=1min a=b
Error: invalid resource operation option 'a', allowed options are: OCF_CHECK_LEVEL, description, enabled, id, interval, interval-origin, name, on-fail, record-pending, requires, role, start-delay, timeout

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor interval=1min a=b --force
Error: invalid resource operation option 'a', allowed options are: OCF_CHECK_LEVEL, description, enabled, id, interval, interval-origin, name, on-fail, record-pending, requires, role, start-delay, timeout

Comment 8 Jan Pokorný [poki] 2017-07-11 21:11:03 UTC
re [comment ]:

> Putting invalid attributes into "instance_attributes" of "op" is not
> a good idea. Currently there is no syntax to distinguish between
> attributes of "op" and "instance_attributes" of "op".

Probably should have been discussed in wider circles :-/

See [bug 1469801].

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.