Bug 1984130

Summary: Regressions in crm_attribute in upstream Pacemaker 2.1.0
Product: Red Hat Enterprise Linux 9 Reporter: Ken Gaillot <kgaillot>
Component: pacemakerAssignee: Ken Gaillot <kgaillot>
Status: CLOSED CURRENTRELEASE QA Contact: cluster-qe <cluster-qe>
Severity: high Docs Contact:
Priority: urgent    
Version: 9.0CC: cluster-maint, cluster-qe, msmazova
Target Milestone: betaKeywords: Triaged
Target Release: 9.0 Beta   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: pacemaker-2.1.0-6.el9 Doc Type: No Doc Update
Doc Text:
The issue will not be in beta or GA release
Story Points: ---
Clone Of: 1984120 Environment:
Last Closed: 2021-12-07 21:57:54 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: 1984120    
Bug Blocks:    

Description Ken Gaillot 2021-07-20 18:42:03 UTC
+++ This bug was initially created as a clone of Bug #1984120 +++

Description of problem: RHEL 8.5 and 9.0 beta rebased on upstream 2.1.0, which has been found to have regressions in the crm_attribute command (and its crm_master and crm_failcount wrappers).


Version-Release number of selected component (if applicable): upstream 2.1.0


How reproducible: trivially


Steps to Reproduce:
1. Configure and start a cluster.
2. Use crm_attribute to set a node attribute with a negative integer value.
3. Use crm_attribute's hidden --get-value option (a deprecated alias for --query) to check an attribute value.

Actual results: Setting a negative value fails with an option parsing error. Using --get-value wrongly requires (and ignores) an option argument.


Expected results: Setting a negative value succeeds. Using --get-value does not require an option argument.

--- Additional comment from Ken Gaillot on 2021-07-20 18:38:58 UTC ---

Fixed upstream by commits ea5510d and ef054d9

Comment 7 Markéta Smazová 2021-08-12 14:34:25 UTC
before fix:
-----------

>   [root@virt-494 ~]# rpm -q pacemaker
>   pacemaker-2.1.0-5.el9.x86_64

Setup a cluster:

>   [root@virt-494 ~]# pcs status
>   Cluster name: STSRHTS18167
>   Cluster Summary:
>     * Stack: corosync
>     * Current DC: virt-494 (version 2.1.0-5.el9-7c3f660707) - partition with quorum
>     * Last updated: Thu Aug 12 16:03:48 2021
>     * Last change:  Thu Aug 12 16:03:25 2021 by root via cibadmin on virt-494
>     * 2 nodes configured
>     * 2 resource instances configured

>   Node List:
>     * Online: [ virt-494 virt-495 ]

>   Full List of Resources:
>     * fence-virt-494	(stonith:fence_xvm):	 Started virt-494
>     * fence-virt-495	(stonith:fence_xvm):	 Started virt-495

>   Daemon Status:
>     corosync: active/disabled
>     pacemaker: active/disabled
>     pcsd: active/enabled

Set a node attribute with a negative integer value. Use crm_attribute's hidden `--get-value` option 
(a deprecated alias for `--query`) to check an attribute value:

>   [root@virt-494 ~]# crm_attribute --node virt-494 --name test1 --update -11
>   crm_attribute: Unknown option -1
>   [root@virt-494 ~]# echo $?
>   64
Setting a negative value failed with an option parsing error.

>   [root@virt-494 ~]# crm_attribute --node virt-494 --name test1 --get-value
>   crm_attribute: Missing argument for --get-value

Using `--get-value` wrongly requires (and ignores) an option argument.



after fix:
----------

>   [root@virt-050 ~]# rpm -q pacemaker
>   pacemaker-2.1.0-6.el9.x86_64

Setup a cluster:

>   [root@virt-050 ~]# pcs status
>   Cluster name: STSRHTS6381
>   Cluster Summary:
>     * Stack: corosync
>     * Current DC: virt-050 (version 2.1.0-6.el9-7c3f660707) - partition with quorum
>     * Last updated: Thu Aug 12 15:17:38 2021
>     * Last change:  Mon Aug  9 14:35:29 2021 by root via cibadmin on virt-049
>     * 2 nodes configured
>     * 2 resource instances configured

>   Node List:
>     * Online: [ virt-049 virt-050 ]

>   Full List of Resources:
>     * fence-virt-049	(stonith:fence_xvm):	 Started virt-049
>     * fence-virt-050	(stonith:fence_xvm):	 Started virt-050

>   Daemon Status:
>     corosync: active/disabled
>     pacemaker: active/disabled
>     pcsd: active/enabled

Set a node attribute with a negative integer value. Use crm_attribute's hidden `--get-value` option 
(a deprecated alias for `--query`) to check an attribute value:

>   [root@virt-050 ~]# crm_attribute --node virt-050 --name test1 --update -11
>   [root@virt-050 ~]# echo $?
>   0
Setting a negative value succeeded.

>   [root@virt-050 ~]# crm_attribute --node virt-050 --name test1 --get-value
>   scope=nodes  name=test1 value=-11

Using `--get-value` does not require an option argument.


Display cluster with Node Attributes:

>   [root@virt-050 ~]# crm_mon -1A
>   Cluster Summary:
>     * Stack: corosync
>     * Current DC: virt-050 (version 2.1.0-6.el9-7c3f660707) - partition with quorum
>     * Last updated: Thu Aug 12 15:26:54 2021
>     * Last change:  Thu Aug 12 15:25:56 2021 by root via crm_attribute on virt-050
>     * 2 nodes configured
>     * 2 resource instances configured

>   Node List:
>     * Online: [ virt-049 virt-050 ]

>   Active Resources:
>     * fence-virt-049	(stonith:fence_xvm):	 Started virt-049
>     * fence-virt-050	(stonith:fence_xvm):	 Started virt-050

>   Node Attributes:
>     * Node: virt-050:
>       * test1                           	: -11


marking verified in pacemaker-2.1.0-6.el9