Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1175400 - pcs resource op add creates duplicate op entires
pcs resource op add creates duplicate op entires
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs (Show other bugs)
7.1
Unspecified Unspecified
medium Severity low
: pre-dev-freeze
: ---
Assigned To: Tomas Jelinek
cluster-qe@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-17 11:15 EST by Frank Danapfel
Modified: 2015-11-19 04:33 EST (History)
4 users (show)

See Also:
Fixed In Version: pcs-0.9.141-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: User adds a duplicate resource operation. Consequence: Duplicate operations specified for a resource. Fix: Added check for duplicate operations. Result: User is informed that a duplicate operation already exists, new duplicate operation is not created unless --force flag is used.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 04:33:56 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed fix (18.78 KB, patch)
2015-06-18 09:20 EDT, Tomas Jelinek
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2290 normal SHIPPED_LIVE Moderate: pcs security, bug fix, and enhancement update 2015-11-19 04:43:53 EST

  None (edit)
Description Frank Danapfel 2014-12-17 11:15:51 EST
Description of problem:
If "pcs resource op add" is executed without checking if the op already exists a duplicate op entry will be created

Version-Release number of selected component (if applicable):
pcs-0.9.123-9.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. run pcs op add for an already existing op of a resource
2.
3.

Actual results:
# pcs config
...

Resource: rsc_ip_SAPHana_DSG_HDB00 (class=ocf provider=heartbeat type=IPaddr2)
  Attributes: ip=192.168.123.24 
  Operations: start interval=0s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-start-timeout-20s)
              stop interval=0s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-stop-timeout-20s)
              monitor interval=10s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-monitor-interval-10s)..
# pcs resource op add rsc_ip_SAPHana_DSG_HDB00 start timeout=3600
# pcs config
...
 Resource: rsc_ip_SAPHana_DSG_HDB00 (class=ocf provider=heartbeat type=IPaddr2)
  Attributes: ip=192.168.123.24 
  Operations: start interval=0s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-start-timeout-20s)
              stop interval=0s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-stop-timeout-20s)
              monitor interval=10s timeout=20s (rsc_ip_SAPHana_DSG_HDB00-monitor-interval-10s)
              start interval=0s timeout=3600 (rsc_ip_SAPHana_DSG_HDB00-name-start-timeout-3600)
...
Expected results:
pcs should give at leas a warning or offer the possibility to update the existing op entry for the resource instead of adding a new one.

Additional info:
Comment 2 Chris Feist 2014-12-22 16:22:00 EST
There are some cases when we want to allow multiple operations, but most of the time that isn't what a user wants.

I think we just need to add a warning if a operation already exists with that name, and specifically an error if we attempt to add a monitor operation with the same interval (since pacemaker does not support that).
Comment 3 Tomas Jelinek 2015-01-05 09:35:47 EST
There are patches in upstream for reporting an error when user attempts to add an operation with the same name and interval:
https://github.com/feist/pcs/commit/c97e96ab6361f15773bbd426babe7af192257999
https://github.com/feist/pcs/commit/40c0a774a453730c92600f4ece7c310e2d7dd2e7
https://github.com/feist/pcs/commit/abd1ecd1d1b24156a419257517c17a11a36152e5

They do not cover the case when user attempts to create more operations with the same name but different intervals.  We can add a check for that and print a warning.  It should be possible to create several monitor operations with different roles (or OCF_CHECK_LEVEL values) and different intervals though.
Comment 7 Tomas Jelinek 2015-06-18 09:20:20 EDT
Created attachment 1040492 [details]
proposed fix
Comment 8 Tomas Jelinek 2015-06-23 08:53:14 EDT
See also: bz1031141 comment 7

Before Fix:
[root@rh71-node1 ~]# rpm -q pcs
pcs-0.9.140-1.el7.x86_64
[root@rh71-node1:~]# pcs resource create dummy dummy
[root@rh71-node1:~]# 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=10 timeout=20 (dummy-monitor-interval-10)
[root@rh71-node1:~]# pcs resource op add dummy monitor interval=20 timeout=20
[root@rh71-node1:~]# echo $?
0
[root@rh71-node1:~]# 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=10 timeout=20 (dummy-monitor-interval-10)
              monitor interval=20 timeout=20 (dummy-monitor-interval-20)



After Fix:
[root@rh71-node1:~]# rpm -q pcs
pcs-0.9.141-1.el7.x86_64
[root@rh71-node1:~]# pcs resource create dummy dummy
[root@rh71-node1:~]# 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=10 timeout=20 (dummy-monitor-interval-10)
[root@rh71-node1:~]# pcs resource op add dummy monitor interval=20 timeout=20
Error: operation monitor already specified for dummy, use --force to override:
monitor interval=10 timeout=20 (dummy-monitor-interval-10)
[root@rh71-node1:~]# echo $?
1
[root@rh71-node1:~]# 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=10 timeout=20 (dummy-monitor-interval-10)
[root@rh71-node1:~]# pcs resource op add dummy monitor interval=20 timeout=20 --force
[root@rh71-node1:~]# echo $?
0
[root@rh71-node1:~]# 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=10 timeout=20 (dummy-monitor-interval-10)
              monitor interval=20 timeout=20 (dummy-monitor-interval-20)
Comment 12 errata-xmlrpc 2015-11-19 04:33:56 EST
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://rhn.redhat.com/errata/RHSA-2015-2290.html

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