Bug 1402475 - "resource create" with flags "--clone" and "--disable" puts metadata for disabling inappropriately
Summary: "resource create" with flags "--clone" and "--disable" puts metadata for disa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.2
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: rc
: ---
Assignee: Ivan Devat
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-07 15:55 UTC by Ivan Devat
Modified: 2017-08-01 18:24 UTC (History)
6 users (show)

Fixed In Version: pcs-0.9.156-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: Pcs incorrectly puts metadata for disabling the resource when the user runs "pcs resource create" with flags "--clone" and "--disabled". Consequence: Pcs puts into the cib a different contents than the user expected. Fix: Correct the placement of metadata for disabling resource. Result: Pcs puts a correct contents into the cib.
Clone Of:
Environment:
Last Closed: 2017-08-01 18:24:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed fix (11.97 KB, patch)
2017-01-31 16:33 UTC, Ivan Devat
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1958 normal SHIPPED_LIVE pcs bug fix and enhancement update 2017-08-01 18:09:47 UTC

Description Ivan Devat 2016-12-07 15:55:39 UTC
Description of problem:
"resource create" with flags --clone and --disable puts metadata for disabling inappropriately. It puts it as primitive meta_attributes.


How reproducible:
always


Steps to Reproduce:

[vm-rhel72-1 ~] $ pcs resource create R1 ocf:heartbeat:Dummy --clone --disabled --no-default-ops

Actual results:
In cib, there is:
...
<clone id="R1-clone">
  <primitive class="ocf" id="R1" provider="heartbeat" type="Dummy">
    <instance_attributes id="R1-instance_attributes"/>
    <meta_attributes id="R1-meta_attributes">
      <nvpair id="R1-meta_attributes-target-role" name="target-role" value="Stopped"/>
    </meta_attributes>
    <operations>
      <op id="R1-monitor-interval-60s" interval="60s" name="monitor"/>
    </operations>
  </primitive>
  <meta_attributes id="R1-clone-meta_attributes"/>
</clone>
...


Expected results:
in cib:
...
<clone id="R1-clone">
  <primitive class="ocf" id="R1" provider="heartbeat" type="Dummy">
    <instance_attributes id="R1-instance_attributes"/>
    <operations>
      <op id="R1-monitor-interval-60s" interval="60s" name="monitor"/>
    </operations>
  </primitive>
  <meta_attributes id="R1-clone-meta_attributes">
    <nvpair id="R1-clone-meta_attributes-target-role" name="target-role" value="Stopped"/>
  </meta_attributes>
</clone>
...


Additional info:
Metadata are placed appropriately when is used --master instead of --clone:

[vm-rhel72-1 ~] $ pcs resource create R2 ocf:heartbeat:Dummy --master --disabled --no-default-ops
in cib:
...
<master id="R2-master">
  <primitive class="ocf" id="R2" provider="heartbeat" type="Dummy">
    <instance_attributes id="R2-instance_attributes"/>
    <operations>
      <op id="R2-monitor-interval-60s" interval="60s" name="monitor"/>
    </operations>
  </primitive>
  <meta_attributes id="R2-master-meta_attributes">
    <nvpair id="R2-master-meta_attributes-target-role" name="target-role" value="Stopped"/>
  </meta_attributes>
</master>
...


Metadata are placed appropriately when clone is created as enabled and then disabled:

[vm-rhel72-1 ~] $ pcs resource create R3 ocf:heartbeat:Dummy --clone --no-default-ops
[vm-rhel72-1 ~] $ pcs resource disable R3
in cib:
...
<clone id="R3-clone">
  <primitive class="ocf" id="R3" provider="heartbeat" type="Dummy">
    <instance_attributes id="R3-instance_attributes"/>
    <operations>
      <op id="R3-monitor-interval-60s" interval="60s" name="monitor"/>
    </operations>
  </primitive>
  <meta_attributes id="R3-clone-meta_attributes">
    <nvpair id="R3-clone-meta_attributes-target-role" name="target-role" value="Stopped"/>
  </meta_attributes>
</clone>
...

Comment 2 Ivan Devat 2017-01-31 16:33:43 UTC
Created attachment 1246362 [details]
proposed fix

Tests are in the patch.

Comment 3 Ivan Devat 2017-02-20 08:07:12 UTC
After Fix:

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

[vm-rhel72-1 ~] $ pcs resource create R ocf:heartbeat:Dummy --clone --disabled
[vm-rhel72-1 ~] $ pcs cluster cib|grep 'id="R-clone"' -A11
      <clone id="R-clone">
        <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-start-interval-0s" interval="0s" name="start" timeout="20"/>
            <op id="R-stop-interval-0s" interval="0s" name="stop" timeout="20"/>
          </operations>
        </primitive>
        <meta_attributes id="R-clone-meta_attributes">
          <nvpair id="R-clone-meta_attributes-target-role" name="target-role" value="Stopped"/>
        </meta_attributes>
      </clone>

Comment 7 errata-xmlrpc 2017-08-01 18:24:40 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-2017:1958


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