8000
Skip to content

Rebalance when there are too many voters or standby nodes and clean up nodeRefreshTask() (from Incus)#17171

Merged
tomponline merged 2 commits intocanonical:mainfrom
kadinsayani:fix/rebalance-cluster-online-nodes
Dec 8, 2025
Merged

Rebalance when there are too many voters or standby nodes and clean up nodeRefreshTask() (from Incus)#17171
tomponline merged 2 commits intocanonical:mainfrom
kadinsayani:fix/rebalance-cluster-online-nodes

Conversation

@kadinsayani
Copy link
Copy Markdown
Member

Checklist

Signed-off-by: Piotr Resztak <piotr.resztak@futurfusion.io>
(cherry picked from commit 45ae831ba62b87a69ad952844000250c1486df4d)
Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
License: Apache-2.0
- Use a single mutex lock/unlock, both operations happen under the same
lock when needed
- Add a clear needsRebalance variable for readability
- Reword, move comments, and fix typo

Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
@kadinsayani kadinsayani changed the title lxd: Rebalance when there are too many voters or standby nodes (from Incus) Rebalance when there are too many voters or standby nodes and cleanup nodeRefreshTask() (from Incus) Dec 5, 2025
@kadinsayani kadinsayani changed the title Rebalance when there are too many voters or standby nodes and cleanup nodeRefreshTask() (from Incus) Rebalance when there are too many voters or standby nodes and clean up nodeRefreshTask() (from Incus) Dec 5, 2025
Copy link
Copy Markdown
Member
@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

ta

@tomponline tomponline merged commit 0d78329 into canonical:main Dec 8, 2025
72 checks passed
@kadinsayani kadinsayani deleted the fix/rebalance-cluster-online-nodes branch December 8, 2025 17:13
tomponline added a commit that referenced this pull request Dec 10, 2025
#17171 included a bad merge from
baaad8a
to
ff0f7dc,
changing `onlineStandbys != maxStandBy` to `onlineStandbys <
maxStandBy`. This fixes the logic that determines `needsBalance` to
match the intended behavior.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md)
and attest that all commits in this PR are [signed
off](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#including-a-signed-off-by-line-in-your-commits),
[cryptographically
signed](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#commit-signature-verification),
and follow this project's [commit
structure](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#commit-structure).
- [x] I have checked and added or updated relevant documentation.
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.

3 participants

0