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 1699978 - crm_mon: fix command line parser for the -m/--fence-history option
Summary: crm_mon: fix command line parser for the -m/--fence-history option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pacemaker
Version: 8.0
Hardware: All
OS: Linux
high
low
Target Milestone: pre-dev-freeze
: 8.2
Assignee: Chris Lumens
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On: 1752538
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-15 14:00 UTC by Patrik Hagara
Modified: 2023-04-29 10:31 UTC (History)
13 users (show)

Fixed In Version: pacemaker-2.0.3-1.el8
Doc Type: No Doc Update
Doc Text:
This is not significant enough for a release note
Clone Of: 1608369
Environment:
Last Closed: 2020-04-28 15:38:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-27373 0 None None None 2023-04-29 10:31:37 UTC
Red Hat Product Errata RHEA-2020:1609 0 None None None 2020-04-28 15:39:10 UTC

Description Patrik Hagara 2019-04-15 14:00:39 UTC
the help text for -m/--fence-history option of crm_mon states the following:

>  -m, --fence-history[=value]    Show fence history
>                                         0=off, 1=failures and pending (default without option),
>                                         2=add successes (default without value for option),
>                                         3=show full history without reduction to most recent of each flavor

however, neither "-m X" nor "-m=X" produce the expected output -- only "-mX" works as advertised.

affected version: pacemaker-2.0.1-4.el8

see bz#1608369, specifically comment https://bugzilla.redhat.com/show_bug.cgi?id=1608369#c8 for details.

Comment 2 Chris Lumens 2019-07-29 20:31:02 UTC
This should be fixed by https://github.com/ClusterLabs/pacemaker/pull/1847, which is just about ready to go in.

Comment 5 Markéta Smazová 2020-01-23 15:51:00 UTC
As previously stated in bz#1608369 and the description of this bug, the parser for the "crm_mon -m" option did not conform to the de-facto standard of allowing whitespace between short option and its argument (eg. "-m 0"). It only worked without any whitespace (eg. "-m0").

Using whitespace resulted in "non-option ARGV-elements: 0" warning and behaved as if only "crm_mon -m" (without value) was used.


After the fix:

>   [root@virt-137 ~]# rpm -q pacemaker
>   pacemaker-2.0.3-3.el8.x86_64

The usage of crm_mon -m is described in help:

>   [root@virt-137 ~]# crm_mon --help-display

>   Usage:
>     crm_mon [OPTION?]

>   Provides a summary of cluster's current state.
>   
>   [...]
>     -m, --fence-history=LEVEL         Show fence history:
>                                       0=off, 1=failures and pending (default without option),
>                                       2=add successes (default without value for option),
>                                       3=show full history without reduction to most recent of each flavor
>   [...]


Options "crm_mon -m 0" and "crm_mon -m0" and "crm_mon -m --fence-history=0" work as expected - they don't show fence history.

>   [root@virt-137 ~]# crm_mon -m 0

>   Cluster Summary:
>     * Stack: corosync
>     * Current DC:	virt-143 (version 2.0.3-3.el8-4b1f869f0f) - partition with quorum
>     * Last updated: Wed Jan 22 14:59:06 2020
>     * Last change:  Wed Jan 22 10:12:26 2020 by root via cibadmin on virt-137>   * 3 nodes configured
>     * 9 resource instances configured

>   Node List:
>     * Online: [ virt-137 virt-143 ]
>     * OFFLINE: [ virt-138 ]

>   Active Resources:
>     * fence-virt-137	(stonith:fence_xvm):     Started virt-137
>     * fence-virt-138	(stonith:fence_xvm):     Started virt-143
>     * fence-virt-143	(stonith:fence_xvm):     Started virt-143
>     * Clone Set: locking-clone [locking]:
>       * Started: [ virt-137 virt-143 ]


Options "crm_mon -m 1" and "crm_mon -m1" and "crm_mon -m --fence-history=1" correctly show only failed and pending fencing actions.
>   
>   [root@virt-137 ~]# crm_mon -m 1

>   Cluster Summary:
>     * Stack: corosync
>     * Current DC:	virt-143 (version 2.0.3-3.el8-4b1f869f0f) - partition with quorum
>     * Last updated: Wed Jan 22 15:19:36 2020
>     * Last change:  Wed Jan 22 15:18:41 2020 by root via cibadmin on virt-143
>     * 3 nodes configured
>     * 9 resource instances configured

>   Node List:
>     * Online: [ virt-137 virt-138 virt-143 ]

>   Active Resources:
>     * fence-virt-137	(stonith:fence_xvm):     Started virt-137
>     * fence-virt-138	(stonith:fence_xvm):     Started virt-143
>     * fence-virt-143	(stonith:fence_xvm):     Started virt-138
>     * Clone Set: locking-clone [locking]:
>       * Started: [ virt-137 virt-138 virt-143 ]

>   Failed Fencing Actions:
>     * reboot of virt-138. failed: delegate=, client=stonith_admin.2536, origin=virt-143, last-failed='2020-01-22 15:16:12 +01:00 '

>   Pending Fencing Actions:
>     * reboot of virt-138 pending: client=stonith_admin.2959, origin=virt-143

Options "crm_mon -m 2" and "crm_mon -m2" and "crm_mon -m --fence-history=2" add last successful pending action.

>   [root@virt-137 ~]# crm_mon -m 2

>   Cluster Summary:
>     * Stack: corosync
>     * Current DC:	virt-143 (version 2.0.3-3.el8-4b1f869f0f) - partition with quorum
>     * Last updated: Wed Jan 22 15:22:03 2020
>     * Last change:  Wed Jan 22 15:18:41 2020 by root via cibadmin on virt-143
>     * 3 nodes configured
>     * 9 resource instances configured

>   Node List:
>     * Online: [ virt-137 virt-138 virt-143 ]

>   Active Resources:
>     * fence-virt-137	(stonith:fence_xvm):     Started virt-137
>     * fence-virt-138	(stonith:fence_xvm):     Started virt-143
>     * fence-virt-143	(stonith:fence_xvm):     Started virt-138
>     * Clone Set: locking-clone [locking]:
>       * Started: [ virt-137 virt-138 virt-143 ]

>   Failed Fencing Actions:
>     * reboot of virt-138. failed: delegate=, client=stonith_admin.2536, origin=virt-143, last-failed='2020-01-22 15:16:12 +01:00 '

>   Fencing History:
>     * reboot of virt-138 pending: client=stonith_admin.3290, origin=virt-143
>     * reboot of virt-138 successful: delegate=virt-143, client=stonith_admin.3290, origin=virt-143, last-successful='2020-01-22 15:22:17 +01:00'


Options "crm_mon -m 3" and "crm_mon -m3" and "crm_mon -m --fence-history=3" show failed and pending actions and all history of sucessful fencing actions.

>   [root@virt-137 ~]# crm_mon -m 3

>   Cluster Summary:
>     * Stack: corosync
>     * Current DC:	virt-143 (version 2.0.3-3.el8-4b1f869f0f) - partition with quorum
>     * Last updated: Wed Jan 22 15:31:52 2020
>     * Last change:  Wed Jan 22 15:18:41 2020 by root via cibadmin on virt-143
>     * 3 nodes configured
>     * 9 resource instances configured

>   Node List:
>     * Online: [ virt-137 virt-138 virt-143 ]

>   Active Resources:
>     * fence-virt-137	(stonith:fence_xvm):     Started virt-137
>     * fence-virt-138	(stonith:fence_xvm):     Started virt-143
>     * fence-virt-143	(stonith:fence_xvm):     Started virt-138
>     * Clone Set: locking-clone [locking]:
>       * Started: [ virt-137 virt-138 virt-143 ]

>   Failed Fencing Actions:
>     * reboot of virt-138. failed: delegate=, client=stonith_admin.2536, origin=virt-143, completed='2020-01-22 15:16:12 +01:00 '

>   Fencing History:
>     * reboot of virt-138 pending: client=stonith_admin.4984, origin=virt-143
>     * reboot of virt-138 successful: delegate=virt-143, client=stonith_admin.3290, origin=virt-143, completed='2020-01-22 15:22:17 +01:00'
>     * reboot of virt-138 successful: delegate=virt-143, client=stonith_admin.2959, origin=virt-143, completed='2020-01-22 15:19:48 +01:00'
>     * reboot of virt-138 successful: delegate=virt-137, client=stonith_admin.32651, origin=virt-143, completed='2020-01-22 14:59:03 +01:00'


Using "=" as option-value separator is not supported for short options and results in error:

>   [root@virt-137 ~]# crm_mon -m=0
>   crm_mon: Fence history must be 0-3
>   Usage:
>     crm_mon [OPTION…]
>   [...]

Long options do support using "=", eg. "crm_mon -m --fence-history=0".

Comment 7 errata-xmlrpc 2020-04-28 15:38:28 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/RHEA-2020:1609


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