Bug 1909901

Summary: [RFE] Add --quiet flag to pcs resource disable --safe to only show error messages instead of full output
Product: Red Hat Enterprise Linux 8 Reporter: Chris Feist <cfeist>
Component: pcsAssignee: Michal Pospisil <mpospisi>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact: Steven J. Levine <slevine>
Priority: medium    
Version: ---CC: bfrank, cfeist, cluster-maint, idevat, mlisik, mpospisi, nhostako, omular, slevine, tojeline
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.10.8-3.el8 Doc Type: Enhancement
Doc Text:
.New reduced output display option for `pcs resource safe-disable` command The `pcs resource safe-disable` and `pcs resource disable --safe` commands print a lengthy simulation result after an error report. You can now specify the `--brief` option for those commands to print errors only. The error report now always contains resource IDs of affected resources.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 17:33:51 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:

Description Chris Feist 2020-12-22 00:53:30 UTC
Add --quiet flag to pcs resource disable --safe to only show error messages instead of full output

Comment 1 Tomas Jelinek 2021-01-04 16:06:05 UTC
The full output can be seen in bz1631519

In bz1833114 a new flag, --brief, has been introduced to 'pcs resource disable --simulate' and 'pcs resource safe-disable --simulate' commands. The purpose of the flag is to print a short and simple info instead a full output from crm_simulate. It would make sense to use the same flag here.

What is the expected error message? Will this do:
Error: Disabling specified resources would have an effect on other resources: 'resource_a', 'resource_b', 'resource_c'

Comment 5 Michal Pospisil 2021-07-07 12:04:31 UTC
Feature merged into upstream master: https://github.com/ClusterLabs/pcs/commit/b9922dffaafd0745ce57428963b9f6f5f5091a14

Instead of the proposed '--quiet' option, this was implemented as a '--brief' option that is already supported by other pcs commands.
 
The 'pcs resource safe-disable' and 'pcs resource disable --safe' have a revised error format that always specifies resources affected by the disable operation. The new '--brief' option disables printing of crm_simulate output that follows this error.

ENVIRONMENT PREPARATION:
- any cluster
- at least 3 dummy resources
  pcs resource create dummy1 ocf:pacemaker:Dummy
  pcs resource create dummy2 ocf:pacemaker:Dummy
  pcs resource create dummy3 ocf:pacemaker:Dummy

To test this fix, run commands:
# pcs constraint colocation add dummy1 with dummy2
# pcs constraint colocation add dummy2 with dummy3
# pcs resource safe-disable --brief dummy3
Error: Disabling specified resource would have an effect on these resources: 'dummy1', 'dummy2'
Error: Errors have occurred, therefore pcs is unable to continue
# pcs resource disable --safe --brief dummy3 dummy1
Error: Disabling specified resources would have an effect on this resource: 'dummy2'
Error: Errors have occurred, therefore pcs is unable to continue

Comment 6 Miroslav Lisik 2021-07-09 07:22:43 UTC
Test:

[root@r8-node-01 ~]# rpm -q pcs
pcs-0.10.8-3.el8.x86_64

[root@r8-node-01 ~]# for i in $(seq -w 01 03); do pcs resource create d-$i ocf:pacemaker:Dummy; done
[root@r8-node-01 ~]# pcs constraint colocation add d-01 with d-02
[root@r8-node-01 ~]# pcs constraint colocation add d-02 with d-03

[root@r8-node-01 ~]# pcs resource safe-disable --brief d-03
Error: Disabling specified resource would have an effect on these resources: 'd-01', 'd-02'
Error: Errors have occurred, therefore pcs is unable to continue
[root@r8-node-01 ~]# pcs resource disable --safe --brief d-03 d-01
Error: Disabling specified resources would have an effect on this resource: 'd-02'
Error: Errors have occurred, therefore pcs is unable to continue

Comment 15 errata-xmlrpc 2021-11-09 17:33:51 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 (Low: pcs security, bug fix, and enhancement update), 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/RHSA-2021:4142