Red Hat Bugzilla – Bug 1175400
pcs resource op add creates duplicate op entires
Last modified: 2015-11-19 04:33:56 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:
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).
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.
Created attachment 1040492 [details] proposed fix
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)
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