RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1443418 - pcs should allow to specify id of resource operations and validate them
Summary: pcs should allow to specify id of resource operations and validate them
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-19 08:38 UTC by Tomas Jelinek
Modified: 2018-04-10 15:40 UTC (History)
6 users (show)

Fixed In Version: pcs-0.9.160-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: user enters an invalid resource operation id Consequence: pcs exits with an error and dumps an invalid CIB to the terminal Fix: pcs validates resource operation id Result: pcs gracefully exits with an error explaining the id is not valid
Clone Of:
Environment:
Last Closed: 2018-04-10 15:39:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix + test (16.69 KB, patch)
2017-06-21 08:51 UTC, Tomas Jelinek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0866 0 None None None 2018-04-10 15:40:17 UTC

Description Tomas Jelinek 2017-04-19 08:38:25 UTC
Description of problem:
Previously it was possible to specify ids of resource operations when creating a resource. This feature has been lost during the overhaul of the command.


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


How reproducible:
always, easily


Steps to Reproduce:
Old version:
[root@rh72-node1:~]# rpm -q pcs
pcs-0.9.143-15.el7.x86_64
[root@rh72-node1:~]# pcs resource create test ocf:pacemaker:Dummy op monitor id=abcd interval=30 timeout=10 --no-default-ops
[root@rh72-node1:~]# pcs resource show test
 Resource: test (class=ocf provider=pacemaker type=Dummy)
  Operations: monitor interval=30 timeout=10 (abcd)

New version:
[root@rh73-node1:~]# rpm -q pcs
pcs-0.9.157-1.el7.x86_64
[root@rh73-node1:~]# pcs resource create test ocf:pacemaker:Dummy op monitor id=abcd interval=30 timeout=10 --no-default-ops
[root@rh73-node1:~]# pcs resource show test
 Resource: test (class=ocf provider=pacemaker type=Dummy)
  Operations: monitor interval=30 timeout=10 (test-monitor-interval-30)


Actual results:
It is possible to specify the id but it is completely ignored.


Expected results:
It is possible to specify the id and it is honored.


Additional info:
I am not marking this a regression because setting the id was not properly supported in old versions either. The id was not checked in any way to ensure it is a valid and unique id:

[root@rh72-node1:~]# rpm -q pcs
pcs-0.9.143-15.el7.x86_64
[root@rh72-node1:~]# pcs resource create test ocf:pacemaker:Dummy op monitor id=abcd interval=30 timeout=10 --no-default-ops
[root@rh72-node1:~]# pcs resource create test2 ocf:pacemaker:Dummy op monitor id=abcd interval=30 timeout=10 --no-default-ops
Error: Unable to update cib
{snip}

This sequence of commands results in an invalid CIB error, because the id "abcd" is not unique. Pcs should have exited with an error saying the id is not unique.


Still we want the id to be possible to be specified to maintain backward compatibility. Some pieces of documentation may also have mentioned the possibility to set an operation id.

Comment 1 Tomas Jelinek 2017-06-21 08:51:04 UTC
Created attachment 1289976 [details]
proposed fix + test

pcs now validates resource operation id and its uniqueness.

affected commands:
* pcs resource create
* pcs resource update
* pcs resource op add

Comment 3 Ivan Devat 2017-10-11 07:58:51 UTC
After Fix:

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

> create

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor interval=30 id=X
[vm-rhel72-1 ~] $ pcs cluster cib --config | grep 'id="R"' -A4
    <primitive class="ocf" id="R" provider="heartbeat" type="Dummy">
      <operations>
        <op id="X" interval="30" name="monitor"/>
      </operations>
    </primitive>

[vm-rhel72-1 ~] $ pcs resource create R2 ocf:heartbeat:Dummy op monitor interval=30 id=X
Error: 'X' already exists

[vm-rhel72-1 ~] $ pcs resource create R2 ocf:heartbeat:Dummy op monitor interval=30 id=#X
Error: invalid operation id '#X', '#' is not a valid first character for a operation id

[vm-rhel72-1 ~] $ pcs resource create R2 ocf:heartbeat:Dummy op monitor interval=30 id=Y op monitor interval=60 id=Y
Error: 'Y' already exists

> op add

[vm-rhel72-1 ~] $ pcs resource op add R start timeout=30 id=Y
[vm-rhel72-1 ~] $ pcs cluster cib --config | grep 'id="R"' -A5
    <primitive class="ocf" id="R" provider="heartbeat" type="Dummy">
      <operations>
        <op id="X" interval="30" name="monitor"/>
        <op id="Y" interval="0s" name="start" timeout="30"/>
      </operations>
    </primitive>

[vm-rhel72-1 ~] $ pcs resource op add R start timeout=30 id=Y
Error: id 'Y' is already in use, please specify another one

[vm-rhel72-1 ~] $ pcs resource op add R start timeout=30 id=#Y
Error: invalid operation id '#Y', '#' is not a valid first character for a operation id

> update

[vm-rhel72-1 ~] $ pcs resource update R op start timeout=40 id=R
Error: id 'R' is already in use, please specify another one

[vm-rhel72-1 ~] $ pcs resource update R op start timeout=40 id=#Y
Error: invalid operation id '#Y', '#' is not a valid first character for a operation id

Comment 9 errata-xmlrpc 2018-04-10 15:39:15 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-2018:0866


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