Skip to content

Commit bb8d7ae

Browse files
committed
Dev: corosync: Show corosync cpg status in crm corosync status cpg
1 parent 7fed1b8 commit bb8d7ae

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

crmsh/constants.py

+2
Original file line numberDiff line numberDiff line change
@@ -517,4 +517,6 @@
517517
If a nic name is provided, the first IP of that nic will be used.
518518
Use multiple -i for more links. Note: Only one link is allowed for the non knet transport type
519519
"""
520+
521+
COROSYNC_STATUS_TYPES = ("ring", "quorum", "qdevice", "qnetd", "cpg")
520522
# vim:ts=4:sw=4:et:

crmsh/corosync.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ def query_status(status_type):
8080
"""
8181
Query status of corosync
8282
83-
Possible types could be ring/quorum/qdevice/qnetd
83+
Possible types could be ring/quorum/qdevice/qnetd/cpg
8484
"""
8585
status_func_dict = {
8686
"ring": query_ring_status,
8787
"quorum": query_quorum_status,
8888
"qdevice": query_qdevice_status,
89-
"qnetd": query_qnetd_status
89+
"qnetd": query_qnetd_status,
90+
"cpg": query_cpg_status
9091
}
9192
if status_type in status_func_dict:
9293
out = sh.cluster_shell().get_stdout_or_raise_error("crm_node -l")
@@ -152,6 +153,14 @@ def query_qnetd_status():
152153
return utils.to_ascii(qnetd_result_stdout)
153154

154155

156+
def query_cpg_status():
157+
"""
158+
Query corosync cpg status
159+
"""
160+
cmd = "corosync-cpgtool -e"
161+
return sh.cluster_shell().get_stdout_or_raise_error(cmd)
162+
163+
155164
def push_configuration(nodes):
156165
'''
157166
Push the local configuration to the list of remote nodes

crmsh/ui_corosync.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from . import parallax
1010
from . import bootstrap
1111
from . import log
12+
from . import constants
1213
from .service_manager import ServiceManager
1314

1415
logger = log.setup_logger(__name__)
@@ -57,7 +58,7 @@ class Corosync(command.UI):
5758
def requires(self):
5859
return corosync.check_tools()
5960

60-
@command.completers(completers.choice(['ring', 'quorum', 'qdevice', 'qnetd']))
61+
@command.completers(completers.choice(constants.COROSYNC_STATUS_TYPES))
6162
def do_status(self, context, status_type="ring"):
6263
'''
6364
Quick cluster health status. Corosync status or QNetd status

doc/crm.8.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1372,11 +1372,11 @@ show
13721372
[[cmdhelp_corosync_status,Display the corosync status]]
13731373
==== `status`
13741374

1375-
Displays the corosync ring status(default), also can display quorum/qdevice/qnetd status.
1375+
Displays the corosync ring status(default), also can display quorum/qdevice/qnetd/cpg status.
13761376

13771377
Usage:
13781378
.........
1379-
status [ring|quorum|qdevice|qnetd]
1379+
status [ring|quorum|qdevice|qnetd|cpg]
13801380
.........
13811381

13821382
[[cmdhelp_cib,CIB shadow management]]

0 commit comments

Comments
 (0)