Skip to content

Dev: ui_node: Enable standby and maintenance on pacemaker remote node #1855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

liangxin1300
Copy link
Collaborator

@liangxin1300 liangxin1300 commented Jul 3, 2025

Problems

/cib/status/node_state[@remote_node="true"]/@uname

Might have problem:

>>> xmlutil.listnodes()
['rm', 'alp-2']
# if the pacemaker remote RA's name changed from `rm` to `rm_node`, then got two remote nodes
>>> xmlutil.listnodes()
['rm', 'rm_node', 'alp-2']

Changes:

  • Drop xmlutil.listnodes function; And refactor xmlutil.CrmMonXmlParser.get_node_list function, get pacemaker remote node from crm_mon --output-as=xml looks more accurately
  • Enable standby/online pacemaker remote node
  • Enable maintenance/ready pacemaker remote node

@liangxin1300 liangxin1300 force-pushed the 20250703_standby_remote branch 2 times, most recently from 72969e2 to fd88dd3 Compare July 4, 2025 02:14
@liangxin1300 liangxin1300 force-pushed the 20250703_standby_remote branch 3 times, most recently from d2f4985 to 0563566 Compare July 7, 2025 03:35
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.

Project coverage is 70.80%. Comparing base (5ebd6a2) to head (6667f6d).

Files with missing lines Patch % Lines
crmsh/ui_node.py 59.25% 11 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
integration 55.26% <84.21%> (+0.19%) ⬆️
unit 52.98% <55.26%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
crmsh/bootstrap.py 88.13% <100.00%> (ø)
crmsh/cibquery.py 88.23% <100.00%> (+7.67%) ⬆️
crmsh/completers.py 56.81% <100.00%> (ø)
crmsh/idmgmt.py 83.06% <100.00%> (+0.27%) ⬆️
crmsh/utils.py 68.09% <100.00%> (+0.04%) ⬆️
crmsh/xmlutil.py 70.56% <100.00%> (+0.47%) ⬆️
crmsh/ui_node.py 63.61% <59.25%> (+10.45%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 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.

@liangxin1300 liangxin1300 changed the title Dev: ui_node: Enable standby pacemaker remote node Dev: ui_node: Enable standby and maintenance on pacemaker remote node Jul 7, 2025
@liangxin1300 liangxin1300 marked this pull request as ready for review July 7, 2025 06:13
It's enough to check the node type is remote, since the remote node's id
and uname might be different with the value of RA parameter "server".
It's enough to get the online list of pacemaker remote nodes
@liangxin1300 liangxin1300 force-pushed the 20250703_standby_remote branch from a7770f6 to 6667f6d Compare July 7, 2025 10:55
"""
instance = cls(peer)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you change this to a classmethod and create new instance in the method? This does not make sense.

crmsh/xmlutil.py Outdated
conditions.append(f'@online="{online_value}"')
if standby is not None:
standby_value = 'true' if standby else 'false'
conditions.append(f'@standby="{standby_value}"')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is to complex. online vs standby, and only_member vs only_remote is mutually exclusive. Please use enum or str instead of bool.

@@ -3249,7 +3250,8 @@ def __bool__(self):

def validate_and_get_reachable_nodes(
nodes: typing.List[str] = [],
all_nodes: bool = False
all_nodes: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not test all_nodes at the very beginning in this function? If all_node is true, you don't need to do the other complex logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants