Skip to content

fix(scheduler): correct disk-level storage double counting during replica scheduling#4533

Open
davidcheng0922 wants to merge 1 commit intolonghorn:masterfrom
davidcheng0922:issue-12653-storage-dobule-counting-scheduling-fail
Open

fix(scheduler): correct disk-level storage double counting during replica scheduling#4533
davidcheng0922 wants to merge 1 commit intolonghorn:masterfrom
davidcheng0922:issue-12653-storage-dobule-counting-scheduling-fail

Conversation

@davidcheng0922
Copy link
Contributor

Which issue(s) this PR fixes:

longhorn/longhorn#12653

What this PR does / why we need it:

Fixes incorrect disk-level storage accounting during replica scheduling.

Previously, when scheduling multiple replicas on the same node but different disks, the scheduler incorrectly counted replica sizes across disks. This could lead to false "insufficient storage" errors even when the target disk had enough available space.

Special notes for your reviewer:

Additional documentation or context

…lica scheduling

Longhorn: 12653

Signed-off-by: David Cheng <david.cheng@suse.com>
@davidcheng0922 davidcheng0922 self-assigned this Feb 12, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in the replica scheduler where disk-level storage was being incorrectly double-counted during replica scheduling. When scheduling multiple replicas on the same node but different disks, the scheduler incorrectly counted replica sizes across all disks on a node instead of per-disk, potentially causing false "insufficient storage" errors even when the target disk had enough space.

Changes:

  • Added disk-level filtering (r.Spec.DiskID == diskUUID) to storage accounting logic during replica scheduling
  • Improved code comment to clarify the purpose of accounting for replicas already assigned during the current scheduling cycle

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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