Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1102115

Summary: PCS doesn't provide way to cleanup all resources
Product: Red Hat Enterprise Linux 7 Reporter: Radek Steiger <rsteiger>
Component: pcsAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: cfeist, cluster-maint, mjuricek, slevine, tojeline
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.132-1.el7 Doc Type: Enhancement
Doc Text:
Feature: one command to clean-up all resources Reason: user don't have so much time to cleaning-up resources one by one Result: call "pcs resource cleanup" to do that
Story Points: ---
Clone Of:
: 1129854 (view as bug list) Environment:
Last Closed: 2015-03-05 09:19:42 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:    
Bug Blocks: 1129854    
Attachments:
Description Flags
clean-up_all_git_patch
none
map/help info none

Description Radek Steiger 2014-05-28 14:13:07 UTC
Description of problem:

'pcs resource cleanup' requires specific resource ID to be given, however the underlying crm_resource is able to cleanup all resources at once just by giving the -C switch. This is especially useful when many failed actions exist in the cluster history and removing them one by one would be too much of a hassle. Having resource ID optional should be an easy fix.


Version-Release number of selected component (if applicable):
pcs-0.9.115-32.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. run 'pcs resource cleanup'

Actual results:
Help is printed out.

Expected results:
Cleanup of all resources is performed.

Comment 2 Michal Cab 2014-09-01 14:43:49 UTC
Created attachment 933460 [details]
clean-up_all_git_patch

Comment 3 Michal Cab 2014-09-01 14:48:09 UTC
How to test it..

# pcs resource create dummy0 Dummy
# pcs resource create dummy1 Dummy
# pcs status|grep dummy0
 dummy0 (ocf::heartbeat:Dummy): Started virt-7.0-1
# pcs status|grep dummy1
 dummy1 (ocf::heartbeat:Dummy): Started virt-7.0-2
# crm_resource -F --resource dummy0 -H virt-7.0-1
Waiting for 1 replies from the CRMd. OK
# crm_resource -F --resource dummy1 -H virt-7.0-2
Waiting for 1 replies from the CRMd. OK
# pcs status|grep dummy0
 dummy0 (ocf::heartbeat:Dummy): Started virt-7.0-1
    dummy0_asyncmon_0 on virt-7.0-1 'unknown error' (1): call=2070, status=complete, last-rc-change='Fri Sep  6 14:17:44 2013', queued=0ms, exec=0ms
# pcs status|grep dummy1
 dummy0 (ocf::heartbeat:Dummy): Started virt-7.0-2
    dummy0_asyncmon_0 on virt-7.0-2 'unknown error' (1): call=2070, status=complete, last-rc-change='Fri Sep  6 14:17:44 2013', queued=0ms, exec=0ms
# pcs resource failcount show dummy0
Failcounts for dummy0
 virt-7.7-1: 1
# pcs resource failcount show dummy1
Failcounts for dummy1
 virt-7.7-2: 1

Now, let's cleanup the resources failures and re-check:

# pcs resource cleanup
Resource: dummy0 successfully cleaned up
Resource: dummy1 successfully cleaned up
# pcs status|grep dummy0
 dummy0 (ocf::heartbeat:Dummy): Started virt-7.0-1
# pcs status|grep dummy1
 dummy1 (ocf::heartbeat:Dummy): Started virt-7.0-2
# pcs resource failcount show dummy0
No failcounts for dummy0
# pcs resource failcount show dummy1
No failcounts for dummy1

Comment 4 Michal Cab 2014-09-15 16:40:03 UTC
Created attachment 937672 [details]
map/help info

Comment 5 Chris Feist 2014-10-01 22:00:45 UTC
Updated upstream patch:

https://github.com/feist/pcs/commit/391cc6e301e8170d93951f80c8960d097a6fc6a4

Comment 6 Tomas Jelinek 2014-10-14 11:12:24 UTC
Before Fix:
[root@rh70-node1 ~]# rpm -q pcs
pcs-0.9.115-32.el7.x86_64
[root@rh70-node1:~]# pcs resource cleanup

Usage: pcs resource [commands]...
Manage pacemaker resources
{output trimmed}


After Fix:
[root@rh70-node1:~]# rpm -q pcs
pcs-0.9.132-1.el7.x86_64
[root@rh70-node1:~]# pcs status | grep dummy
 dummy0 (ocf::heartbeat:Dummy): Started rh70-node1 
 dummy1 (ocf::heartbeat:Dummy): Started rh70-node2 
[root@rh70-node1:~]# crm_resource -F -r dummy0 -H rh70-node1
Waiting for 1 replies from the CRMd. OK
[root@rh70-node1:~]# crm_resource -F -r dummy1 -H rh70-node2
Waiting for 1 replies from the CRMd. OK
[root@rh70-node1:~]# pcs status | grep dummy
 dummy0 (ocf::heartbeat:Dummy): Started rh70-node1 
 dummy1 (ocf::heartbeat:Dummy): Started rh70-node2 
    dummy1_asyncmon_0 on rh70-node2 'unknown error' (1): call=70, status=complete, exit-reason='none', last-rc-change='Tue Oct 14 10:36:54 2014', queued=0ms, exec=0ms
    dummy0_asyncmon_0 on rh70-node1 'unknown error' (1): call=70, status=complete, exit-reason='none', last-rc-change='Tue Oct 14 10:36:49 2014', queued=0ms, exec=0ms
[root@rh70-node1:~]# pcs resource cleanup
All resources/stonith devices successfully cleaned up
[root@rh70-node1:~]# pcs status | grep dummy
 dummy0 (ocf::heartbeat:Dummy): Started rh70-node1 
 dummy1 (ocf::heartbeat:Dummy): Started rh70-node2

Comment 10 errata-xmlrpc 2015-03-05 09:19:42 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