RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1115537 - [RFE] 'pcs cluster cib': implement --scope as cibadmin does
Summary: [RFE] 'pcs cluster cib': implement --scope as cibadmin does
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1129871 1190168
TreeView+ depends on / blocked
 
Reported: 2014-07-02 14:46 UTC by michal novacek
Modified: 2015-03-05 09:20 UTC (History)
5 users (show)

Fixed In Version: pcs-0.9.137-2.el7
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.
Clone Of:
: 1129871 1190168 (view as bug list)
Environment:
Last Closed: 2015-03-05 09:20:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix (9.03 KB, patch)
2014-10-02 08:51 UTC, Tomas Jelinek
no flags Details | Diff
proposed fix - error messages (1.77 KB, patch)
2014-12-08 15:48 UTC, Tomas Jelinek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1126835 0 medium CLOSED cibadmin --scope resources: Update does not conform to the configured schema 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2015:0415 0 normal SHIPPED_LIVE pcs bug fix and enhancement update 2015-03-05 14:16:41 UTC

Internal Links: 1126835

Description michal novacek 2014-07-02 14:46:01 UTC
Description of problem:
I have a cluster with a lot of resources which I wanted to frequently remove
and add again. To speed thing up I decided to use a cib, delete the resources
there and push it back. The usual workflow 'pcs cluster cib file.xml', modify
file.xml, 'pcs cluster cib-push file.xml' will fail most of the time an more
complex cluster configurations with "Application of an update diff failed
(-206)". This I believe is the correct behaviour but it is quite inconvenient.

Looking for the way on how to achieve this I found out that cibadmin is able to
check out only <resources> element from the cluster configuration using
'--scope resources' parameter. Using the following:

$ cibadmin -Q --scope resources > file.xml
edit file.xml
$ cibadmin --replace --scope resources --xml-file file.xml

I was able to update (remove) resources and add them back again easily. Also,
no version in such file. 

Request: Implement --scope {resources,constraints} to 'pcs cluster cib' and
'pcs clustert cib-push' to allow user easily modify and push back only
resources/constraints parts of the cluster configuration.

version: pcs-0.9.115-32.el7.x86_64

Comment 3 Tomas Jelinek 2014-10-02 08:51:26 UTC
Created attachment 943334 [details]
proposed fix

Test:

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


[root@rh70-node1:~]# pcs cluster edit scope=resources
{only the resources configuration is shown in an editor}


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

Comment 4 Tomas Jelinek 2014-10-14 11:14:23 UTC
Before Fix:
[root@rh70-node1 ~]# rpm -q pcs
pcs-0.9.115-32.el7.x86_64
[root@rh70-node1:~]# ls scope=nodes
ls: cannot access scope=nodes: No such file or directory
[root@rh70-node1:~]# pcs cluster cib scope=nodes
[root@rh70-node1:~]# ls scope=nodes
scope=nodes
[root@rh70-node1:~]# EDITOR=`which cat` pcs cluster edit scope=nodes
<cib admin_epoch="0" cib-last-written="Tue Oct 14 11:04:25 2014" crm_feature_set="3.0.9" epoch="7362" have-quorum="1" num_updates="2" update-client="cibadmin" update-origin="rh70-node1" validate-with="pacemaker-1.2" dc-uuid="2">
{whole cib gets printed, output trimmed}
[root@rh70-node1:~]#  pcs cluster cib-push cib.xml scope=constraints

Usage: pcs cluster [commands]...
Configure cluster for use with pacemaker
{output trimmed}


After Fix:
[root@rh70-node1:~]# rpm -q pcs
pcs-0.9.132-1.el7.x86_64
[root@rh70-node1:~]# pcs cluster cib scope=nodes
<nodes>
  <node id="1" uname="rh70-node1"/>
  <node id="2" uname="rh70-node2"/>
</nodes>
[root@rh70-node1:~]# EDITOR=`which cat` pcs cluster edit scope=nodes
<nodes>
  <node id="1" uname="rh70-node1"/>
  <node id="2" uname="rh70-node2"/>
</nodes>
CIB not updated, no changes detected
[root@rh70-node1:~]# pcs resource create dummy Dummy
[root@rh70-node1:~]# pcs constraint location dummy prefers rh70-node1
[root@rh70-node1:~]# echo "<cib><configuration><resources/><constraints/></configuration></cib>" > cib.xml
[root@rh70-node1:~]# pcs cluster cib-push cib.xml scope=constraints
CIB updated
[root@rh70-node1:~]# pcs constraint
Location Constraints:
Ordering Constraints:
Colocation Constraints:
[root@rh70-node1:~]# pcs resource
 dummy  (ocf::heartbeat:Dummy): Started

Comment 11 Tomas Jelinek 2014-12-08 15:48:54 UTC
Created attachment 965905 [details]
proposed fix - error messages

Before Fix:
[root@rh70-node1:~]# rpm -q pcs
pcs-0.9.137-1.el7.x86_64
[root@rh70-node1:~]# pcs cluster cib scope=rsc_defaults
Error: unable to get cib
[root@rh70-node1:~]# EDITOR=cat pcs cluster edit scope=rsc_defaults
Error: unable to get cib
[root@rh70-node1:~]# pcs cluster cib /tmp/cib.xml
[root@rh70-node1:~]# pcs cluster cib-push /tmp/cib.xml scope=rsc_defaults
Error: unable to push cib
Call cib_replace failed (-22): Invalid argument


After Fix:
[root@rh70-node1:~]# rpm -q pcs
pcs-0.9.137-2.el7.x86_64
[root@rh70-node1:~]# pcs cluster cib scope=rsc_defaults
Error: unable to get cib, scope 'rsc_defaults' not present in cib
[root@rh70-node1:~]# EDITOR=cat pcs cluster edit scope=rsc_defaults
Error: unable to get cib, scope 'rsc_defaults' not present in cib
[root@rh70-node1:~]# pcs cluster cib /tmp/cib.xml
[root@rh70-node1:~]# pcs cluster cib-push /tmp/cib.xml scope=rsc_defaults
Error: unable to push cib, scope 'rsc_defaults' not present in new cib

Comment 13 Jiri Herrmann 2014-12-12 15:31:49 UTC
If this Feature should be included in the 7.1 Release Notes, could you please change the Doc Type from Enhancement to "Release Note"?

Note that the Release Notes are intended to list the most prominent and customer-relevant new features rather than every single enhancement.

Cheers,
Jirka

Comment 14 Tomas Jelinek 2014-12-15 14:16:25 UTC
Jiri,
I think this feature is not important enough to be included in the Release Notes, it is a minor enhancement.

Comment 15 Steven J. Levine 2014-12-15 14:47:29 UTC
Just to follow up on what Tomas says here: The feature is minor enough in scope (and pretty much for testers rather than users) that we decided not to document it in the pcs reference manual either, as noted in BZ#1129871.

Comment 17 errata-xmlrpc 2015-03-05 09:20:11 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-0415.html


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