Skip to content

Dev: xmlutil: Improve for completer of pacemaker remote node #1767

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

liangxin1300
Copy link
Collaborator

@liangxin1300 liangxin1300 commented Apr 28, 2025

Problem

  • Some commands don't need to complete pacemaker remote node, like:
crm node standby
crm cluster remove
  • While some commands need to include pacemaker remote node, like:
crm resource failcount
crm resource move

See #1727

  • The way to get remote node's name
/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']

Instead, get pacemaker remote node from crm_mon -1 --output-as=xml looks more accurately

  <nodes>
    <node name="alp-2" id="2" online="true" standby="false" standby_onfail="false" maintenance="false" pending="false" unclean="false" health="green" feature_set="3.20.0" shutdown="false" expected_up="true" is_dc="true" resources_running="1" type="member"/>
    <node name="rm_node" id="rm_node" online="true" standby="false" standby_onfail="false" maintenance="false" pending="false" unclean="false" health="green" shutdown="false" expected_up="false" is_dc="false" resources_running="0" type="remote"/>
  </nodes>

Solution

  • Drop xmlutil.listnodes function, use utils.list_cluster_nodes instead
  • Rename xmlutil.CrmMonXmlParser.get_node_list to xmlutil.CrmMonXmlParser.get_node_list_with_attr
  • Add a new function xmlutil.CrmMonXmlParser.get_node_list to get node list including pacemaker remote node; Thus add a new completer completers.nodes_with_remote

@liangxin1300 liangxin1300 force-pushed the 20250428_node_completer branch 3 times, most recently from b1caa52 to 7568484 Compare April 29, 2025 01:39
@liangxin1300 liangxin1300 changed the title Dev: xmlutil: Don't complete pacemaker remote node name Dev: xmlutil: Improve for completer of pacemaker remote node Apr 29, 2025
@liangxin1300 liangxin1300 force-pushed the 20250428_node_completer branch 2 times, most recently from 1049b7f to 1422788 Compare May 3, 2025 14:51
@liangxin1300 liangxin1300 force-pushed the 20250428_node_completer branch from c4b2d02 to 1422788 Compare May 15, 2025 00:57
- Drop xmlutil.listnodes function, use utils.list_cluster_nodes instead
- Rename xmlutil.CrmMonXmlParser.get_node_list to
  xmlutil.CrmMonXmlParser.get_node_list_with_attr
- Add a new function xmlutil.CrmMonXmlParser.get_node_list to
  get node list including pacemaker remote node; Thus add a new completer
  completers.nodes_with_remote
@liangxin1300 liangxin1300 force-pushed the 20250428_node_completer branch from dc28a34 to 7e376f0 Compare May 16, 2025 06:36
Copy link

codecov bot commented May 16, 2025

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.21%. Comparing base (bb49ed3) to head (7e376f0).

Files with missing lines Patch % Lines
crmsh/xmlutil.py 90.00% 1 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
integration 54.46% <85.00%> (-0.01%) ⬇️
unit 52.80% <75.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
crmsh/bootstrap.py 86.56% <100.00%> (ø)
crmsh/completers.py 58.69% <100.00%> (+1.87%) ⬆️
crmsh/ui_resource.py 72.62% <100.00%> (ø)
crmsh/xmlutil.py 70.00% <90.00%> (-0.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 force-pushed the 20250428_node_completer branch from 4f3014c to 7e376f0 Compare May 20, 2025 14:45
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.

1 participant