Bug 2166289

Summary: [RFE] Provide means to export configured cluster properties as pcs commands
Product: Red Hat Enterprise Linux 8 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Miroslav Lisik <mlisik>
Status: VERIFIED --- QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.9CC: cluster-maint, idevat, mlisik, mmazoure, mpospisi, nhostako, omular, rmeggins, tojeline
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.10.17-1.el8 Doc Type: Enhancement
Doc Text:
Feature: Pcs command `pcs property` is now able to export cluster properties configuration in form of text, json and pcs command(s) by using option '--output-format'. New command `pcs property defaults` for displaying default values of cluster properites was added. Another new command `pcs property describe` for describing meaning of cluster properties was added. Text format output of `pcs resource describe` command was extended and unified with `pcs property describe` text output. Reason: Pcs was able only to export configuration of cluster properties in text format. Ability to export configuration of cluster properties in format of pcs command is very useful feature that contributes to more portable form of re-creation of current cluster configuration. In order to add feature, the `pcs property [config]` command needed to be rewritten to the new architecture. Result: Pcs command `pcs property` now support '--output-format' option. There are 3 formats of output available: 'cmd', 'json', 'text', default is 'text'. The 'text' format has not changed from previous `pcs property` command plaintext only format. Another two commands were added: `pcs property defaults` and `pcs property describe`. Text output format of `pcs resource describe` command was extended.
Story Points: ---
Clone Of: 2163914 Environment:
Last Closed: 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: 2163914    
Bug Blocks:    

Description Tomas Jelinek 2023-02-01 12:43:21 UTC
+++ This bug was initially created as a clone of Bug #2163914 +++

This is a part of a long term goal to export the whole cluster configuration in form of pcs commands which, when run, recreate the same configuration.

This particular BZ is focused on cluster properties configuration.

Comment 1 Tomas Jelinek 2023-05-19 15:41:13 UTC
Upstream patch: https://github.com/ClusterLabs/pcs/commit/d5642c2ede0d6555603bc385dc35e581d2f0fddd

Updated commands:
* pcs property [config]

Added commands:
* pcs property defaults
* pcs property describe

Environment: A running cluster with some configured properties.

Test:

# pcs property set placement-strategy=minimal
# pcs property config --output-format=cmd
pcs property set --force -- \
  placement-strategy=minimal
# pcs property defaults placement-strategy
placement-strategy=default
# pcs property describe placement-strategy
placement-strategy
  Description: How the cluster should allocate resources to nodes
  Allowed values: 'balanced', 'default', 'minimal', 'utilization'
  Default: default

Comment 3 Michal Pospisil 2023-05-29 10:09:53 UTC
DevTestResults:

[root@r08-09-a ~]# rpm -q pcs
pcs-0.10.16-1.el8.x86_64

[root@r08-09-a ~]# pcs property set placement-strategy=minimal

[root@r08-09-a ~]# pcs property config --output-format=cmd
pcs property set --force -- \
  placement-strategy=minimal

Comment 7 Michal Mazourek 2023-06-13 09:32:00 UTC
As discussed, 'pcs property config' text output should not change in late RHEL8 release.

Comment 9 Miroslav Lisik 2023-06-19 12:17:51 UTC
Upstream patch: https://github.com/ClusterLabs/pcs/commit/88f57a99be1abba795c0b95f88f2f9930d26ec15

Updated commands:
* pcs property [config]
* pcs config

Environment: A running cluster with some configured properties.

Test:
# pcs property
Cluster Properties:
 cluster-infrastructure: corosync
 cluster-name: HACluster
 dc-version: 2.1.6-1.el8-6fdc9deea29
 have-watchdog: false

# pcs config | sed "/Cluster Properties:/,/^$/p" -n
Cluster Properties:
 cluster-infrastructure: corosync
 cluster-name: HACluster
 dc-version: 2.1.6-1.el8-6fdc9deea29
 have-watchdog: false

Comment 10 Michal Pospisil 2023-06-20 09:19:33 UTC
DevTestResults:

[root@r08-09-b ~]# rpm -q pcs
pcs-0.10.17-1.el8.x86_64

[root@r08-09-b ~]# pcs property config --output-format=cmd
pcs property set --force -- \
 maintenance-mode=false \
 placement-strategy=minimal

[root@r08-09-b ~]# pcs property config
Cluster Properties:
cluster-infrastructure: corosync
cluster-name: pre1
dc-version: 2.1.6-1.el8-6fdc9deea29
have-watchdog: false
maintenance-mode: false
placement-strategy: minimal