Bug 1190168

Summary: [RFE] 'pcs cluster cib': implement --scope as cibadmin does
Product: Red Hat Enterprise Linux 6 Reporter: michal novacek <mnovacek>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact: Steven J. Levine <slevine>
Priority: medium    
Version: 6.6CC: cfeist, cluster-maint, cluster-qe, rsteiger, slevine, tojeline
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.138-1.el6 Doc Type: Enhancement
Doc Text:
Feature: Provide a way to edit/view part of the CIB. Reason: User wants to view/edit only part of the CIB. Result: User is able to view/edit part of the CIB.
Story Points: ---
Clone Of: 1115537 Environment:
Last Closed: 2015-07-22 06:16:13 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:
Bug Depends On: 1115537    
Bug Blocks: 1129871    

Comment 2 Tomas Jelinek 2015-02-10 10:26:50 UTC
upstream patches:
https://github.com/feist/pcs/commit/4a13e8dad6b58c257151dfdf297d8529373d05a0
https://github.com/feist/pcs/commit/03b38736eef95a430e74298642cec3701cabc8d7


Before Fix:
[root@rh66-node1 ~]# rpm -q pcs
pcs-0.9.123-9.el6.x86_64

[root@rh66-node1:~]# ls scope=nodes
ls: cannot access scope=nodes: No such file or directory
[root@rh66-node1:~]# pcs cluster cib scope=nodes
[root@rh66-node1:~]# ls scope=nodes
scope=nodes
[root@rh66-node1:~]# head scope\=nodes
<cib admin_epoch="0" cib-last-written="Tue Feb 10 09:54:59 2015" crm_feature_set="3.0.9" epoch="325" have-quorum="1" num_updates="2" validate-with="pacemaker-2.0" dc-uuid="rh66-node2">
  <configuration>
    <crm_config>
      <cluster_property_set id="cib-bootstrap-options">
        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.11-97629de"/>
        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="cman"/>
        <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1423557153"/>
      </cluster_property_set>
    </crm_config>
    <nodes>

[root@rh66-node1:~]# EDITOR=head pcs cluster edit scope=nodes
<cib admin_epoch="0" cib-last-written="Tue Feb 10 09:54:59 2015" crm_feature_set="3.0.9" epoch="325" have-quorum="1" num_updates="2" validate-with="pacemaker-2.0" dc-uuid="rh66-node2">
  <configuration>
    <crm_config>
      <cluster_property_set id="cib-bootstrap-options">
        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.11-97629de"/>
        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="cman"/>
        <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1423557153"/>
      </cluster_property_set>
    </crm_config>
    <nodes>
CIB not updated, no changes detected

[root@rh66-node1:~]# pcs cluster cib cib.xml
[root@rh66-node1:~]# pcs cluster cib-push cib.xml scope=nodes

Usage: pcs cluster [commands]...
Configure cluster for use with pacemaker
...



After Fix:
[root@rh66-node1:~]# rpm -q pcs
pcs-0.9.138-1.el6.x86_64

[root@rh66-node1:~]# pcs cluster cib scope=nodes
<nodes>
  <node id="rh66-node2" uname="rh66-node2">
    <instance_attributes id="nodes-rh66-node2"/>
  </node>
  <node id="rh66-node1" uname="rh66-node1"/>
</nodes>

[root@rh66-node1:~]# EDITOR=head pcs cluster edit scope=nodes
<nodes>
  <node id="rh66-node2" uname="rh66-node2">
    <instance_attributes id="nodes-rh66-node2"/>
  </node>
  <node id="rh66-node1" uname="rh66-node1"/>
</nodes>
CIB not updated, no changes detected

[root@rh66-node1:~]# pcs resource create dummy Dummy
[root@rh66-node1:~]# pcs constraint location dummy prefers rh66-node1
[root@rh66-node1:~]# pcs constraint
Location Constraints:
  Resource: dummy
    Enabled on: rh66-node1 (score:INFINITY)
Ordering Constraints:
Colocation Constraints:
[root@rh66-node1:~]# echo "<cib><configuration><resources/><constraints/></configuration></cib>" > cib.xml
[root@rh66-node1:~]# pcs cluster cib-push cib.xml scope=constraints
CIB updated
[root@rh66-node1:~]# pcs constraint
Location Constraints:
Ordering Constraints:
Colocation Constraints:
[root@rh66-node1:~]# pcs resource
 dummy  (ocf::heartbeat:Dummy): Started rh66-node1

Comment 7 errata-xmlrpc 2015-07-22 06:16:13 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://rhn.redhat.com/errata/RHBA-2015-1446.html