Hide Forgot
Description of problem: Let us have a resource agent containing an action with the attribute "depth" != 0. Command "pcs resource create" produces invalid cib when such agent is used. Steps to Reproduce: > Prepare resource the agent containing an action with the attribute "depth" != 0. For example edit /usr/lib/ocf/resource.d/heartbeat/Dummy: Put line <action name="monitor" timeout="20" interval="10" depth="0" /> after line <action name="monitor" timeout="20" interval="15" depth="10" /> in metadata section. > Try create resource with this agent [vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy Actual results: Error: Unable to update cib Call cib_replace failed (-203): Update does not conform to the configured schema <cib ... <primitive class="ocf" id="R" provider="heartbeat" type="Dummy"> <instance_attributes id="R-instance_attributes"/> <operations> <op id="R-start-interval-0s" interval="0s" name="start" timeout="20"/> <op id="R-stop-interval-0s" interval="0s" name="stop" timeout="20"/> <op id="R-monitor-interval-10" interval="10" name="monitor" timeout="20"/> <op depth="10" id="R-monitor-interval-15" interval="15" name="monitor" timeout="20"/> </operations> </primitive> ... Expected results: Success with cib including something like this: <primitive class="ocf" id="R" provider="heartbeat" type="Dummy"> <instance_attributes id="R-instance_attributes"/> <operations> <op id="R-start-interval-0s" interval="0s" name="start" timeout="20"/> <op id="R-stop-interval-0s" interval="0s" name="stop" timeout="20"/> <op id="R-monitor-interval-10" interval="10" name="monitor"/> <op id="R-monitor-interval-15" interval="15" name="monitor"> <instance_attributes id="params-R-monitor-interval-15"> <nvpair id="R-monitor-interval-15-OCF_CHECK_LEVEL-10" name="OCF_CHECK_LEVEL" value="10"/> </instance_attributes> </op> </operations> </primitive> Additional info: > Different behavior in current upstream version. In the current upstream version this problem is partially corrected - pcs does not produce invalid cib. However the attribute "depth" is ommitted. So in cib there is: ... <primitive class="ocf" id="R" provider="heartbeat" type="Dummy"> <instance_attributes id="R-instance_attributes"/> <operations> <op id="R-start-interval-0s" interval="0s" name="start" timeout="20"/> <op id="R-stop-interval-0s" interval="0s" name="stop" timeout="20"/> <op id="R-monitor-interval-10" interval="10" name="monitor" timeout="20"/> <op id="R-monitor-interval-15" interval="15" name="monitor" timeout="20"/> </operations> </primitive> ... > There is not possible use attribute "depth" in "pcs resource create" command: [vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor depth=1 Error: depth is not a valid op option (use --force to override) [vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy op monitor depth=1 --force Error: Unable to update cib Call cib_replace failed (-203): Update does not conform to the configured schema <cib... Similar behavior is described in rhbz#1382597. However attribute "depth" should take an extra care. Its use should result to operation instance attribute OCF_CHECK_LEVEL (see above).
If we allow the "depth" attribute to be used, we need to handle a situation where both "depth" and "OCF_CHECK_LEVEL" is specified.
Created attachment 1246568 [details] proposed fix Test: > attribute "depth" in the resource agent is transformed into "OCF_CHECK_LEVEL" 1) Put the attribute "depth" != 0 into a resource agent Edit /usr/lib/ocf/resource.d/heartbeat/Dummy: Put line <action name="monitor" timeout="20" interval="15" depth="10" /> after line <action name="monitor" timeout="20" interval="10" depth="0" /> in metadata section. 2) Try to create a resource with this agent [vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy Warning: changing a monitor operation interval from 10 to 11 to make the operation unique [vm-rhel72-1 ~] $ pcs cluster cib scope=resources | grep 'id="R"' -A11 <primitive class="ocf" id="R" provider="heartbeat" type="Dummy"> <operations> <op id="R-monitor-interval-10" interval="10" name="monitor" timeout="20"/> <op id="R-monitor-interval-11" interval="11" name="monitor" timeout="20"> <instance_attributes id="R-monitor-interval-11-instance_attributes"> <nvpair id="R-monitor-interval-11-instance_attributes-OCF_CHECK_LEVEL" name="OCF_CHECK_LEVEL" value="10"/> </instance_attributes> </op> <op id="R-start-interval-0s" interval="0s" name="start" timeout="20"/> <op id="R-stop-interval-0s" interval="0s" name="stop" timeout="20"/> </operations> </primitive> > limited support of attribute "depth" Attribute depth is not supported on the command line. For the backward compatibility we keep support for "OCF_CHECK_LEVEL" on the command line. The attribute "depth" could be confusing beside "OCF_CHECK_LEVEL".
After Fix: [vm-rhel72-1 ~] $ rpm -q pcs pcs-0.9.156-1.el7.x86_64 [vm-rhel72-1 ~] $ cp /usr/lib/ocf/resource.d/heartbeat/Dummy /usr/lib/ocf/resource.d/heartbeat/Dummy.backup [vm-rhel72-1 ~] $ sed -i 's/\(<action name="monitor".*\)$/\1\n<action name="monitor" timeout="20" interval="15" depth="10"\/>/' /usr/lib/ocf/resource.d/heartbeat/Dummy [vm-rhel72-1 ~] $ cat /usr/lib/ocf/resource.d/heartbeat/Dummy | grep '<action name="monitor"' <action name="monitor" timeout="20" interval="10" depth="0" /> <action name="monitor" timeout="20" interval="15" depth="10"/> [vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy [vm-rhel72-1 ~] $ pcs cluster cib|grep 'id="R-monitor-interval-15"' -A4 <op id="R-monitor-interval-15" interval="15" name="monitor" timeout="20"> <instance_attributes id="R-monitor-interval-15-instance_attributes"> <nvpair id="R-monitor-interval-15-instance_attributes-OCF_CHECK_LEVEL" name="OCF_CHECK_LEVEL" value="10"/> </instance_attributes> </op> [vm-rhel72-1 ~] $ mv /usr/lib/ocf/resource.d/heartbeat/Dummy.backup /usr/lib/ocf/resource.d/heartbeat/Dummy
*** Bug 1473356 has been marked as a duplicate of this bug. ***
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