Skip to content
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

Dev: refine change detection for crm configure (#1466) #1486

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

nicholasyang2022
Copy link
Collaborator

#1300 tried to remove unnecessary dependencies on a running pacemaker service when crmsh is not actually going to call the service. However, it removed the call to end_game() from up() and quit() incorrectly. This made sublevel configure not to have a chance to check uncommitted changes anymore, leading to a regression described in #1466.

#1481 tried to fix this regression by adding the call to end_game() back to up(), and check if pacemaker service is running before calling end_game(). This is not optimal as up() is a common method used for all sublevels and the status of pacemaker service is only related sublevel configure. Checking the status of pacemaker service when using other sublevels does not make sense.

This pull request uses a more straightforward method to fix the problem: improve how to detect uncommitted changes in has_cib_changes().

The original implementation is to check if there is any elements in change queue. This requires the in memory representation of cib to be populated, leading to an indirect dependency to pacemaker service. However, we can take advantage of a property: the in memory cib needs to be populated before doing any changes. So in the implementation can be optimized: if the in memory cib is not populated, we will know there is not any change.

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 73.07692% with 7 lines in your changes missing coverage. Please review.

Project coverage is 69.30%. Comparing base (d7a72a0) to head (ac812f1).

Additional details and impacted files
Flag Coverage Δ
integration 53.96% <69.23%> (+0.01%) ⬆️
unit 52.33% <23.07%> (-0.02%) ⬇️

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

Files Coverage Δ
crmsh/constants.py 100.00% <ø> (ø)
crmsh/ui_configure.py 43.34% <100.00%> (+0.11%) ⬆️
crmsh/xmlutil.py 69.21% <100.00%> (+0.24%) ⬆️
crmsh/cibconfig.py 63.57% <90.90%> (+0.02%) ⬆️
crmsh/ui_assist.py 24.70% <0.00%> (-0.30%) ⬇️
crmsh/ui_context.py 58.46% <71.42%> (+0.28%) ⬆️
crmsh/ui_maintenance.py 40.67% <0.00%> (-0.71%) ⬇️

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

@nicholasyang2022 nicholasyang2022 marked this pull request as ready for review July 10, 2024 05:16
or it will prevent the interactive cli entering a sublevel
@nicholasyang2022 nicholasyang2022 marked this pull request as draft July 10, 2024 07:23
@nicholasyang2022 nicholasyang2022 marked this pull request as ready for review July 10, 2024 08:06
Copy link
Collaborator

@liangxin1300 liangxin1300 left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks!

@liangxin1300
Copy link
Collaborator

Please backport to crmsh-4.6

@liangxin1300 liangxin1300 merged commit bda8e3d into ClusterLabs:master Jul 11, 2024
31 checks passed
@nicholasyang2022 nicholasyang2022 deleted the fix-1466 branch July 12, 2024 03:35
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