-
Notifications
You must be signed in to change notification settings - Fork 96
Dev: bootstrap: Reject to remove qdevice when it will cause quorum lost #2041
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
liangxin1300
wants to merge
2
commits into
ClusterLabs:master
Choose a base branch
from
liangxin1300:20260303_remove_qdevice_quorum_issue
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ class QdevicePolicy(Enum): | |||||||||||||||||||||||
| QDEVICE_RELOAD = 0 | ||||||||||||||||||||||||
| QDEVICE_RESTART = 1 | ||||||||||||||||||||||||
| QDEVICE_RESTART_LATER = 2 | ||||||||||||||||||||||||
| QDEVICE_REMOVE_REJECT = 3 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def evaluate_qdevice_quorum_effect(mode): | ||||||||||||||||||||||||
|
|
@@ -44,10 +45,16 @@ def evaluate_qdevice_quorum_effect(mode): | |||||||||||||||||||||||
| if mode == QDEVICE_ADD: | ||||||||||||||||||||||||
| expected_votes += 1 | ||||||||||||||||||||||||
| elif mode == QDEVICE_REMOVE: | ||||||||||||||||||||||||
| actual_votes -= 1 | ||||||||||||||||||||||||
| vote = corosync.get_value("quorum.device.votes") or 1 | ||||||||||||||||||||||||
| actual_votes -= int(vote) | ||||||||||||||||||||||||
| diskless_sbd = sbd.SBDUtils.is_using_diskless_sbd() | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if utils.calculate_quorate_status(expected_votes, actual_votes) and not diskless_sbd: | ||||||||||||||||||||||||
| quorate = utils.calculate_quorate_status(expected_votes, actual_votes) | ||||||||||||||||||||||||
| if not quorate and diskless_sbd and mode == QDEVICE_REMOVE: | ||||||||||||||||||||||||
| # Reject to remove qdevice, as it will lose quorum | ||||||||||||||||||||||||
| # then diskless SBD will self-fence the node | ||||||||||||||||||||||||
| return QdevicePolicy.QDEVICE_REMOVE_REJECT | ||||||||||||||||||||||||
|
Comment on lines
+52
to
+56
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||
| elif quorate and not diskless_sbd: | ||||||||||||||||||||||||
| # safe to use reload | ||||||||||||||||||||||||
| return QdevicePolicy.QDEVICE_RELOAD | ||||||||||||||||||||||||
| elif xmlutil.CrmMonXmlParser().is_non_stonith_resource_running() and not utils.is_cluster_in_maintenance_mode(): | ||||||||||||||||||||||||
|
|
@@ -60,7 +67,6 @@ def evaluate_qdevice_quorum_effect(mode): | |||||||||||||||||||||||
| # safe to restart cluster service | ||||||||||||||||||||||||
| return QdevicePolicy.QDEVICE_RESTART | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def qnetd_lock_for_same_cluster_name(func): | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| Decorator to claim lock on qnetd, to avoid the same cluster name added in qnetd | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't necessarily become "malfunctioning" purely based on the logic here :-) It's just that the next cluster startup will require an actual majority or "wait_for_all" to become first quorate.
What I can tell about the case in here is, an user may want to remove qdevice when not all cluster nodes are online, right? But actually it's technically feasible no matter what the quorum status is like, as long as the offline nodes are still reachable through ssh.
The actual problem is, after removal of qdevice, if they/we still want to only bring up the same subset of nodes and expect them to reach the status as before the removal of qdevice right away, it won't be in the same condition any more though. But it's actually about how quorum is first granted on cluster startup, which either requires an actual majority or "wait_for_all" (automatically enabled when "two_node" is enabled). But that's reasonable, even if qdevice is not in place.
So to me, this could be a case where we'd rather tell user "I can remove the on-disk configuration of qdevice for you, but you'll either want to restart cluster later manually by yourself, otherwise I can restart the cluster for you now but bring up all the nodes".
BTW, it's really confusing to still call it QDEVICE_RESTART_LATER when it's leveraging maintenance mode and actually restarting the cluster. The name QDEVICE_RESTART_LATER should probably be preserved for the situation where it really requires users to manually restart their cluster by themselves.
After all, as said, to determine whether a cluster would become malfunctioning, the logic in "warn_diskless_sbd()" and the warning there tell the key:
"Diskless SBD requires cluster with three or more nodes. If you want to use diskless SBD for 2-node cluster, should be combined with QDevice."