Bug 2151164

Summary: 'pcs resource config' fails to print boolean attributes set to false
Product: Red Hat Enterprise Linux 9 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Ondrej Mular <omular>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: high Docs Contact:
Priority: high    
Version: 9.1CC: cfeist, cluster-maint, idevat, mlisik, mmazoure, mpospisi, nhostako, omular, svalasti, tojeline
Target Milestone: rcKeywords: Regression, Triaged, ZStream
Target Release: 9.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.11.4-2.el9 Doc Type: Bug Fix
Doc Text:
Cause: Values of bool and int type are handled incorrectly in `pcs resource|stonith config` command Consequence: Options with values `0` and `false` are not displayed at all as if they were not set. Fix: Correctly handle bool and int values. Result: All set options are correctly displayed.
Story Points: ---
Clone Of:
: 2151166 2151575 (view as bug list) Environment:
Last Closed: 2023-05-09 07:18:34 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: 2151166, 2151575    

Description Tomas Jelinek 2022-12-06 09:08:38 UTC
Description of problem:
'pcs resource config' doesn't print boolean attributes if their value is false. This was discovered for resource operation attributes. If '--output-format=json' is used, then the attributes are printed correctly.

We need to check other parts of 'pcs resource config' as well as 'pcs cluster config' command to make sure they are free of this bug.


Version-Release number of selected component (if applicable):
pcs-0.11.3-4.el9


How reproducible:
always, easily


Steps to Reproduce:
1. pcs resource create test ocf:pacemaker:Dummy
2. pcs resource update test op monitor interval=10s timeout=20s enabled=false
3. pcs resource config test


Actual results:
"enabled=false" is missing in the output for the monitor operation


Expected results:
"enabled=false" is present in the output for the monitor operation


Additional info:
reported upstream: https://github.com/ClusterLabs/pcs/issues/604

Comment 5 Ondrej Mular 2022-12-12 10:00:52 UTC
Upstream patch:
https://github.com/ClusterLabs/pcs/commit/6cd773443d48be1f3ad9f557033705f1a0656e6f

Test:
[root@rhel91-node1 pcs]# pcs resource create dummy ocf:pacemaker:Dummy op monitor enabled=false
[root@rhel91-node1 pcs]# pcs resource config dummy
Resource: dummy (class=ocf provider=pacemaker type=Dummy)
  Operations:
    migrate_from: dummy-migrate_from-interval-0s
      interval=0s
      timeout=20s
    migrate_to: dummy-migrate_to-interval-0s
      interval=0s
      timeout=20s
    monitor: dummy-monitor-interval-60s
      interval=60s
      enabled=0
    reload: dummy-reload-interval-0s
      interval=0s
      timeout=20s
    reload-agent: dummy-reload-agent-interval-0s
      interval=0s
      timeout=20s
    start: dummy-start-interval-0s
      interval=0s
      timeout=20s
    stop: dummy-stop-interval-0s
      interval=0s
      timeout=20s

Comment 6 Michal Pospisil 2022-12-15 14:14:23 UTC
DevTestResults:

[root@r09-02-a ~]# rpm -q pcs
pcs-0.11.4-2.el9.x86_64

[root@r09-02-a ~]# pcs resource create dummy1 ocf:pacemaker:Dummy op monitor enabled=false  

[root@r09-02-a pcs]# pcs resource config dummy1
Resource: dummy1 (class=ocf provider=pacemaker type=Dummy)
 Operations:
   migrate_from: dummy1-migrate_from-interval-0s
     interval=0s
     timeout=20s
   migrate_to: dummy1-migrate_to-interval-0s
     interval=0s
     timeout=20s
   monitor: dummy1-monitor-interval-60s
     interval=60s
     enabled=0
   reload: dummy1-reload-interval-0s
     interval=0s
     timeout=20s
   reload-agent: dummy1-reload-agent-interval-0s
     interval=0s
     timeout=20s
   start: dummy1-start-interval-0s
     interval=0s
     timeout=20s
   stop: dummy1-stop-interval-0s
     interval=0s
     timeout=20s

Comment 10 svalasti 2023-01-17 14:37:26 UTC
### BEFORE

[root@virt-264 ~]# rpm -q pcs
pcs-0.11.4-1.el9.x86_64

[root@virt-264 ~]# pcs resource create d1 ocf:pacemaker:Dummy

[root@virt-264 ~]# pcs resource update d1 op monitor enabled=false meta is_managed=false

[root@virt-264 ~]# pcs resource config --output-format text d1
Resource: d1 (class=ocf provider=pacemaker type=Dummy)
  Meta Attributes: d1-meta_attributes
    is_managed=false
  Operations:
    migrate_from: d1-migrate_from-interval-0s
      interval=0s
      timeout=20s
    migrate_to: d1-migrate_to-interval-0s
      interval=0s
      timeout=20s
    monitor: d1-monitor-interval-60s
      interval=60s
    reload: d1-reload-interval-0s
      interval=0s
      timeout=20s
    reload-agent: d1-reload-agent-interval-0s
      interval=0s
      timeout=20s
    start: d1-start-interval-0s
      interval=0s
      timeout=20s
    stop: d1-stop-interval-0s
      interval=0s
      timeout=20s

> Meta attributes with 'false' value(s) are displayed correctly, but op attributes with 'false' value(s) are not displayed at all. 


[root@virt-264 ~]# pcs resource config --output-format cmd d1
pcs resource create --no-default-ops --force -- d1 ocf:pacemaker:Dummy \
  op \
    migrate_from interval=0s id=d1-migrate_from-interval-0s timeout=20s \
    migrate_to interval=0s id=d1-migrate_to-interval-0s timeout=20s \
    monitor interval=60s id=d1-monitor-interval-60s \
    reload interval=0s id=d1-reload-interval-0s timeout=20s \
    reload-agent interval=0s id=d1-reload-agent-interval-0s timeout=20s \
    start interval=0s id=d1-start-interval-0s timeout=20s \
    stop interval=0s id=d1-stop-interval-0s timeout=20s \
  meta is_managed=false

> Same results as for 'text' format above.


### AFTER

[root@virt-264 ~]# rpm -q pcs
pcs-0.11.4-2.el9.x86_64


## 1. Check if 'pcs resource config' is able to display boolean op attributes that are set to 'false'

[root@virt-264 ~]# pcs resource create d1 ocf:pacemaker:Dummy

[root@virt-264 ~]# echo $?
0

[root@virt-264 ~]# pcs resource update d1 op reload interval=10s enabled=false op monitor enabled=false

[root@virt-264 ~]# echo $?
0


## 1.A. 'Text' format ('pcs resource config --output-format text d1' is same as 'pcs resource config d1')

[root@virt-264 ~]# pcs resource config --output-format text d1
Resource: d1 (class=ocf provider=pacemaker type=Dummy)
  Operations:
    migrate_from: d1-migrate_from-interval-0s
      interval=0s
      timeout=20s
    migrate_to: d1-migrate_to-interval-0s
      interval=0s
      timeout=20s
    monitor: d1-monitor-interval-60s
      interval=60s
      enabled=0
    reload: d1-reload-interval-10s
      interval=10s
      enabled=0
    reload-agent: d1-reload-agent-interval-0s
      interval=0s
      timeout=20s
    start: d1-start-interval-0s
      interval=0s
      timeout=20s
    stop: d1-stop-interval-0s
      interval=0s
      timeout=20s

> Ok. 'Text' format displays boolean op attributes that are set to 'false'. ('false' is displayed as '0')


## 1.B. 'CMD' format

[root@virt-264 ~]# pcs resource config --output-format cmd d1
pcs resource create --no-default-ops --force -- d1 ocf:pacemaker:Dummy \
  op \
    migrate_from interval=0s id=d1-migrate_from-interval-0s timeout=20s \
    migrate_to interval=0s id=d1-migrate_to-interval-0s timeout=20s \
    monitor interval=60s id=d1-monitor-interval-60s enabled=0 \
    reload interval=10s id=d1-reload-interval-10s enabled=0 \
    reload-agent interval=0s id=d1-reload-agent-interval-0s timeout=20s \
    start interval=0s id=d1-start-interval-0s timeout=20s \
    stop interval=0s id=d1-stop-interval-0s timeout=20s

> Ok. 'CMD' format displays boolean op attributes that are set to 'false'.


## 1.C. 'JSON' format

[root@virt-264 ~]# pcs resource config --output-format json d1 | fmt -w 80
{"primitives": [{"id": "d1", "agent_name": {"standard": "ocf", "provider":
"pacemaker", "type": "Dummy"}, "description": null, "operations": [{"id":
"d1-migrate_from-interval-0s", "name": "migrate_from", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []},
{"id": "d1-migrate_to-interval-0s", "name": "migrate_to", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes":
[]}, {"id": "d1-monitor-interval-60s", "name": "monitor", "interval":
"60s", "description": null, "start_delay": null, "interval_origin":
null, "timeout": null, "enabled": false, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes":
[]}, {"id": "d1-reload-interval-10s", "name": "reload", "interval":
"10s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": null, "enabled": false, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []},
{"id": "d1-reload-agent-interval-0s", "name": "reload-agent", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []}, {"id":
"d1-start-interval-0s", "name": "start", "interval": "0s", "description": null,
"start_delay": null, "interval_origin": null, "timeout": "20s", "enabled":
null, "record_pending": null, "role": null, "on_fail": null, "meta_attributes":
[], "instance_attributes": []}, {"id": "d1-stop-interval-0s", "name": "stop",
"interval": "0s", "description": null, "start_delay": null, "interval_origin":
null, "timeout": "20s", "enabled": null, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes": []}],
"meta_attributes": [], "instance_attributes": [], "utilization": []}],
"clones": [], "groups": [], "bundles": []}

> Ok. 'CMD' format displays boolean op attributes that are set to 'false'. (same as for previous versions)


## 2. Check if 'pcs resource config' is able to display boolean meta attributes that are set to 'false'.

[root@virt-264 ~]# pcs resource create d2 ocf:pacemaker:Dummy

[root@virt-264 ~]# echo $?
0

[root@virt-264 ~]# pcs resource update d2 meta is_managed=false allow-unhealthy-nodes=false

[root@virt-264 ~]# echo $?
0


## 2.A. 'Text' format

[root@virt-264 ~]# pcs resource config --output-format text d2
Resource: d2 (class=ocf provider=pacemaker type=Dummy)
  Meta Attributes: d2-meta_attributes
    allow-unhealthy-nodes=false
    is_managed=false
  Operations:
    migrate_from: d2-migrate_from-interval-0s
      interval=0s
      timeout=20s
    migrate_to: d2-migrate_to-interval-0s
      interval=0s
      timeout=20s
    monitor: d2-monitor-interval-10s
      interval=10s
      timeout=20s
    reload: d2-reload-interval-0s
      interval=0s
      timeout=20s
    reload-agent: d2-reload-agent-interval-0s
      interval=0s
      timeout=20s
    start: d2-start-interval-0s
      interval=0s
      timeout=20s
    stop: d2-stop-interval-0s
      interval=0s
      timeout=20s

> Ok. 'Text' format displays boolean meta attributes that are set to 'false'.


## 2.B. 'CMD' format

[root@virt-264 ~]# pcs resource config --output-format cmd d2
pcs resource create --no-default-ops --force -- d2 ocf:pacemaker:Dummy \
  op \
    migrate_from interval=0s id=d2-migrate_from-interval-0s timeout=20s \
    migrate_to interval=0s id=d2-migrate_to-interval-0s timeout=20s \
    monitor interval=10s id=d2-monitor-interval-10s timeout=20s \
    reload interval=0s id=d2-reload-interval-0s timeout=20s \
    reload-agent interval=0s id=d2-reload-agent-interval-0s timeout=20s \
    start interval=0s id=d2-start-interval-0s timeout=20s \
    stop interval=0s id=d2-stop-interval-0s timeout=20s \
  meta allow-unhealthy-nodes=false is_managed=false

> Ok. 'CMD' format displays boolean meta attributes that are set to 'false'.


## 2.C. 'JSON' format

[root@virt-264 ~]# pcs resource config --output-format json d2 | fmt -w 80
{"primitives": [{"id": "d2", "agent_name": {"standard": "ocf", "provider":
"pacemaker", "type": "Dummy"}, "description": null, "operations": [{"id":
"d2-migrate_from-interval-0s", "name": "migrate_from", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []},
{"id": "d2-migrate_to-interval-0s", "name": "migrate_to", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes":
[]}, {"id": "d2-monitor-interval-10s", "name": "monitor", "interval":
"10s", "description": null, "start_delay": null, "interval_origin":
null, "timeout": "20s", "enabled": null, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes":
[]}, {"id": "d2-reload-interval-0s", "name": "reload", "interval":
"0s", "description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []}, {"id":
"d2-reload-agent-interval-0s", "name": "reload-agent", "interval": "0s",
"description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role":
null, "on_fail": null, "meta_attributes": [], "instance_attributes":
[]}, {"id": "d2-start-interval-0s", "name": "start", "interval": "0s",
"description": null, "start_delay": null, "interval_origin": null,
"timeout": "20s", "enabled": null, "record_pending": null, "role": null,
"on_fail": null, "meta_attributes": [], "instance_attributes": []}, {"id":
"d2-stop-interval-0s", "name": "stop", "interval": "0s", "description":
null, "start_delay": null, "interval_origin": null, "timeout": "20s",
"enabled": null, "record_pending": null, "role": null, "on_fail": null,
"meta_attributes": [], "instance_attributes": []}], "meta_attributes":
[{"id": "d2-meta_attributes", "options": {}, "rule": null, "nvpairs": [{"id":
"d2-meta_attributes-allow-unhealthy-nodes", "name": "allow-unhealthy-nodes",
"value": "false"}, {"id": "d2-meta_attributes-is_managed", "name":
"is_managed", "value": "false"}]}], "instance_attributes": [], "utilization":
[]}], "clones": [], "groups": [], "bundles": []}

> OK.

> Marking as VERIFIED for pcs-0.11.4-2.el9.x86_64

Comment 12 errata-xmlrpc 2023-05-09 07:18:34 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 (pcs 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/RHBA-2023:2151