Skip to content

Commit

Permalink
Dev: scripts: Filter out unreachable nodes in cluster health
Browse files Browse the repository at this point in the history
So that the cluster health check can be continued even if some nodes are
unreachable.
  • Loading branch information
liangxin1300 committed Sep 29, 2024
1 parent 113b211 commit c6f8273
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions crmsh/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,10 +1257,17 @@ def _filter_nodes(nodes, user, port):
nodes = nodes.replace(',', ' ').split()
else:
nodes = utils.list_cluster_nodes()
if not nodes:
raise ValueError("No hosts")
nodes = [(node, port or None, user or None) for node in nodes]
return nodes

reachable_nodes = []
for node in nodes:
try:
utils.node_reachable_check(node)
reachable_nodes.append((node, port or None, user or None))
except ValueError:
logger.warning("Node %s is unreachable", node)
if not reachable_nodes:
raise ValueError("No reachable hosts")
return reachable_nodes


def _scoped_param(context, name):
Expand Down

0 comments on commit c6f8273

Please sign in to comment.