Bug 1443418
| Summary: | pcs should allow to specify id of resource operations and validate them | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Tomas Jelinek <tojeline> | ||||
| Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||
| Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 7.4 | CC: | cfeist, cluster-maint, idevat, omular, rsteiger, tojeline | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| 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
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2018-04-10 15:39:15 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: |
|
||||||
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
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 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 |
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.