Skip to content

Dev: corosync: Default 'crm corosync status' to all components (#2038)#2122

Open
nicholasyang2022 wants to merge 1 commit into
ClusterLabs:masterfrom
nicholasyang2022:issue-2038-corosync-status
Open

Dev: corosync: Default 'crm corosync status' to all components (#2038)#2122
nicholasyang2022 wants to merge 1 commit into
ClusterLabs:masterfrom
nicholasyang2022:issue-2038-corosync-status

Conversation

@nicholasyang2022

Copy link
Copy Markdown
Collaborator
  • Update 'crm corosync status' to show all components by default
  • Refactor COROSYNC_STATUS_TYPES from constants.py to corosync.py
  • Optimize crm_node -l to use subprocess.run directly
  • Ensure ValueError is raised on status query failures for 'fail fast' behavior

Fixes: #2038

@nicholasyang2022

Copy link
Copy Markdown
Collaborator Author
Node Status
===================
1 ha-3-1 member
2 ha-3-2 member


Ring Status
===================
Local node ID 1, transport knet
LINK ID 0 udp
	addr	= 192.168.122.73
	status:
		nodeid:          1:	localhost
		nodeid:          2:	connected


Quorum Status
=====================
Quorum information
------------------
Date:             Mon Jun  1 12:42:23 2026
Quorum provider:  corosync_votequorum
Nodes:            2
Node ID:          1
Ring ID:          1.9
Quorate:          Yes

Votequorum information
----------------------
Expected votes:   3
Highest expected: 3
Total votes:      3
Quorum:           2  
Flags:            Quorate Qdevice 

Membership information
----------------------
    Nodeid      Votes    Qdevice Name
         1          1    A,V,NMW ha-3-1 (local)
         2          1    A,V,NMW ha-3-2
         0          1            Qdevice


Qdevice Status
======================
Qdevice information
-------------------
Model:			Net
Node ID:		1
HB interval:		10000ms
Sync HB interval:	30000ms
Configured node list:
    0	Node ID = 1
    1	Node ID = 2
Heuristics:		Disabled
Ring ID:		1.9
Membership node list:	1, 2
Quorate:		Yes
Quorum node list:
    0	Node ID = 2, State = member
    1	Node ID = 1, State = member
Expected votes:		3
Last poll call:		2026-06-01T12:42:20 (cast vote)

Qdevice-net information
----------------------
Cluster name:		hacluster
QNetd host:		ha-3-3:5403
Connect timeout:	8000ms
HB interval:		8000ms
VQ vote timer interval:	5000ms
TLS:			Supported
Algorithm:		Fifty-Fifty split
Tie-breaker:		Node with lowest node ID
KAP Tie-breaker:	Enabled
Poll timer running:	Yes (cast vote)
State:			Connected
TLS active:		Yes (client certificate sent)
Connected since:	2026-06-01T11:55:40
Echo reply received:	2026-06-01T12:42:21


Cpg Status
==================
Group Name	       PID	   Node ID
crmd
		      2406	         1 (192.168.122.73)
		      2746	         2 (192.168.122.74)
attrd
		      2404	         1 (192.168.122.73)
		      2744	         2 (192.168.122.74)
stonith-ng
		      2402	         1 (192.168.122.73)
		      2742	         2 (192.168.122.74)
cib
		      2401	         1 (192.168.122.73)
		      2741	         2 (192.168.122.74)


Qnetd Status
====================
Cluster "hacluster":
    Algorithm:		Fifty-Fifty split (KAP Tie-breaker)
    Tie-breaker:	Node with lowest node ID
    Node ID 1:
        Client address:		::ffff:192.168.122.73:43968
        HB interval:		8000ms
        Configured node list:	1, 2
        Ring ID:		1.9
        Membership node list:	1, 2
        Heuristics:		Undefined (membership: Undefined, regular: Undefined)
        TLS active:		Yes (client certificate verified)
        Vote:			ACK (ACK)
    Node ID 2:
        Client address:		::ffff:192.168.122.74:58668
        HB interval:		8000ms
        Configured node list:	1, 2
        Ring ID:		1.9
        Membership node list:	1, 2
        Heuristics:		Undefined (membership: Undefined, regular: Undefined)
        TLS active:		Yes (client certificate verified)
        Vote:			No change (ACK)

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.39%. Comparing base (e4dd350) to head (f6571cf).
⚠️ Report is 60 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
integration 55.38% <93.33%> (+0.07%) ⬆️
unit 52.27% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crmsh/constants.py 100.00% <ø> (ø)
crmsh/corosync.py 88.77% <100.00%> (+0.42%) ⬆️
crmsh/ui_corosync.py 78.12% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the crm corosync status command to display health information for all corosync-related components by default (instead of only ring), aligning behavior with the expectation in #2038.

Changes:

  • Default crm corosync status to query and print status for all supported components.
  • Move COROSYNC_STATUS_TYPES into crmsh/corosync.py and introduce a STATUS_FUNC_DICT dispatch table.
  • Replace crm_node -l execution via cluster_shell() with a direct subprocess.run() call, and add fail-fast behavior when node status query fails.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/unittests/test_corosync.py Updates/extends unit tests for the new default “all components” behavior and new error handling paths.
crmsh/ui_corosync.py Changes corosync status default argument to query all components and updates completer source.
crmsh/corosync.py Refactors status querying to support “all by default”, adds dispatch dict/constants, and switches crm_node -l to subprocess.run.
crmsh/constants.py Removes COROSYNC_STATUS_TYPES constant after moving it to corosync.py.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crmsh/corosync.py
Comment on lines +200 to +209
STATUS_FUNC_DICT = {
"ring": query_ring_status,
"quorum": query_quorum_status,
"qdevice": query_qdevice_status,
"cpg": query_cpg_status,
"qnetd": query_qnetd_status,
}

COROSYNC_STATUS_TYPES = tuple(STATUS_FUNC_DICT.keys())

Comment thread crmsh/corosync.py Outdated
Comment thread test/unittests/test_corosync.py Outdated
…erLabs#2038)

- Update 'crm corosync status' to show all components by default
- Refactor COROSYNC_STATUS_TYPES from constants.py to corosync.py
- Optimize crm_node -l to use subprocess.run directly
- Ensure ValueError is raised on status query failures for 'fail fast' behavior

Fixes: ClusterLabs#2038
@nicholasyang2022

Copy link
Copy Markdown
Collaborator Author

This PR targets to v5.2.

@nicholasyang2022
nicholasyang2022 marked this pull request as ready for review June 1, 2026 05:59
@zzhou1

zzhou1 commented Jun 3, 2026

Copy link
Copy Markdown
Member

I'd prefer the output to be a little more self-explained to its usage. Something as below,

7c7
< Ring Status
---
> INFO: crm corosync status ring
17c17
< Quorum Status
---
> INFO: crm corosync status quorum
44c44
< Qdevice Status
---
> INFO: crm corosync status qdevice
83c83
< Cpg Status
---
> INFO: crm corosync status cpg
100c100
< Qnetd Status
---
> INFO: crm corosync status qnetd

@nicholasyang2022

Copy link
Copy Markdown
Collaborator Author

I'd prefer the output to be a little more self-explained to its usage. Something as below,

7c7
< Ring Status
---
> INFO: crm corosync status ring
17c17
< Quorum Status
---
> INFO: crm corosync status quorum
44c44
< Qdevice Status
---
> INFO: crm corosync status qdevice
83c83
< Cpg Status
---
> INFO: crm corosync status cpg
100c100
< Qnetd Status
---
> INFO: crm corosync status qnetd

I tried this and it is not quite readable. Currently, subcommands like crm corosync status quorum use dashes for headers and blank lines as separators. To improve readability, we need a clearer visual hierarchy. Higher-level sections should use stronger header emphasis and separators."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default crm corosync status to all components: 'ring/quorum/qdevice/qnetd/cpg'

3 participants