fix: Handle JBOD/passthrough disks behind RAID controllers gracefully#138
Draft
andaaron wants to merge 1 commit intoproject-machine:mainfrom
Draft
fix: Handle JBOD/passthrough disks behind RAID controllers gracefully#138andaaron wants to merge 1 commit intoproject-machine:mainfrom
andaaron wants to merge 1 commit intoproject-machine:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #138 +/- ##
==========================================
+ Coverage 49.97% 50.13% +0.16%
==========================================
Files 27 28 +1
Lines 3666 3688 +22
==========================================
+ Hits 1832 1849 +17
- Misses 1621 1627 +6
+ Partials 213 212 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When a disk is visible through a RAID's sysfs tree but has no corresponding virtual/logical drive entry (e.g. JBOD or passthrough mode), GetDiskType previously returned a hard error that aborted disk scanning entirely. This broke ScanAllDisks on systems with mixed RAID and JBOD configurations. Introduce ErrNotVirtualDrive sentinel so RAID drivers can signal "I queried successfully but this device isn't one of my VDs" vs a real failure. ScanDisk and GetDiskType now catch this sentinel and fall through to generic sysfs-based disk type detection instead of failing. Changes across all three RAID drivers (megaraid, mpi3mr, smartpqi): - Return ErrNotVirtualDrive when controller query succeeds but the device path matches no virtual drive - Implement IsSysPathRAID via the new sysfs package instead of returning false unconditionally - Extract IsSysPathRAID and GetSysPaths into linux/sysfs package to allow driver-level use without circular imports and and allow mocking Includes mock-based unit tests covering RAID match, JBOD fallback, wrapped sentinel detection, real errors, and multi-controller scenarios. Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
raharper
reviewed
Apr 7, 2026
Collaborator
raharper
left a comment
There was a problem hiding this comment.
If possible, I'd like to see the storcli output of a JBOD box and integrate that into the _tests we currently have for correctly identifying disks on RAID, but not classify the disk as a RAID type.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a disk is visible through a RAID's sysfs tree but has no corresponding virtual/logical drive entry (e.g. JBOD or passthrough mode), GetDiskType previously returned a hard error that aborted disk scanning entirely. This broke ScanAllDisks on systems with mixed RAID and JBOD configurations.
Introduce ErrNotVirtualDrive sentinel so RAID drivers can signal "I queried successfully but this device isn't one of my VDs" vs a real failure. ScanDisk and GetDiskType now catch this sentinel and fall through to generic sysfs-based disk type detection instead of failing.
Changes across all three RAID drivers (megaraid, mpi3mr, smartpqi):
Includes mock-based unit tests covering RAID match, JBOD fallback, wrapped sentinel detection, real errors, and multi-controller scenarios.