Repository navigation
Use topo instead of devinfo for disks, make location required #11590
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
smklein
wants to merge
25
commits into
disk-location-inventory
Choose a base branch
from
topo-disk-scan
base: disk-location-inventory
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 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8a1fe6e
sled-hardware: find disks through the hardware topology
smklein ee90985
merge
smklein 6eb6812
Drop incomplete_disks; installinator scans M.2s best-effort, as on main
smklein 3d37f71
Make topology read errors per bay where the bay is known
smklein 6d3fce2
Carry the disk bay read error to poll_device_tree as a Result
smklein 46739e3
Drop a call-site comment that repeats read_bays' docs
smklein 6649ba9
merge
smklein 5d2d2ca
Take one topology snapshot per hardware poll
smklein df74bfe
Report unreadable disk bays instead of their previous state
smklein a43217e
Leave the bay location out of its classify errors
smklein 486eb07
Report bays missing from a hardware poll as unreadable
smklein 09c2ecc
merge
smklein 4235d82
topo: don't describe a fixed bay count in module docs
smklein f06884a
topo: drop sharkfin example from NodeKey docs
smklein 08858aa
sled-hardware: type disk locations and key disk bays by them
smklein a74fbc3
sled-hardware: report why a bay's device is unusable
smklein 3705a36
Explain why only one NVMe namespace becomes a disk
smklein 9cbad45
Treat an NVMe controller with more than one namespace as unusable
smklein 83fe780
sled-hardware: assemble disk bays from topology records in portable code
smklein 2e84c20
sled-hardware: decide which topology slots are M.2 bays in portable code
smklein 48d693b
sled-hardware: document how oxhc lays out disk bays
smklein 9b52334
sled-hardware: take slot types from libtopo 0.2.1
smklein 9f5fddf
sled-hardware: move topology node records into topo_nodes
smklein d0533bf
sled-hardware: rename classify_bay to describe_bay
smklein 5ff0ef1
sled-hardware: reword disk_bay module and resolve_bays docs
smklein 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
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
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 |
|---|---|---|
|
|
@@ -217,11 +217,11 @@ pub struct UnparsedDisk { | |
| identity: DiskIdentity, | ||
| is_boot_disk: bool, | ||
| firmware: DiskFirmware, | ||
| #[serde(default)] | ||
| location: Option<String>, | ||
| location: String, | ||
| } | ||
|
|
||
| impl UnparsedDisk { | ||
| #[expect(clippy::too_many_arguments)] | ||
| pub fn new( | ||
| devfs_path: Utf8PathBuf, | ||
| dev_path: Option<Utf8PathBuf>, | ||
|
|
@@ -230,6 +230,7 @@ impl UnparsedDisk { | |
| identity: DiskIdentity, | ||
| is_boot_disk: bool, | ||
| firmware: DiskFirmware, | ||
| location: String, | ||
| ) -> Self { | ||
| Self { | ||
| paths: DiskPaths { devfs_path, dev_path }, | ||
|
|
@@ -238,16 +239,10 @@ impl UnparsedDisk { | |
| identity, | ||
| is_boot_disk, | ||
| firmware, | ||
| location: None, | ||
| location, | ||
| } | ||
| } | ||
|
|
||
| /// Records where this disk sits in the chassis. See [`Self::location`]. | ||
| pub fn with_location(mut self, location: Option<String>) -> Self { | ||
| self.location = location; | ||
| self | ||
| } | ||
|
|
||
| pub fn paths(&self) -> &DiskPaths { | ||
| &self.paths | ||
| } | ||
|
|
@@ -268,16 +263,19 @@ impl UnparsedDisk { | |
| self.is_boot_disk | ||
| } | ||
|
|
||
| /// The PCIe physical slot number of the bridge above this disk. | ||
| /// The PCIe physical slot number of the bridge behind this disk's bay. | ||
| /// | ||
| /// This is the `physical-slot#` property of the parent `pcieb` device. | ||
| /// It identifies the disk's position in the board's PCIe topology and is | ||
| /// board-specific: the same U.2 bay has a different number on Gimlet and | ||
| /// Cosmo. It is not the location label printed on the chassis. | ||
| /// This is the `binding/slot` property of the bay in the hardware | ||
| /// topology, the same number the `pcieb` device reports as | ||
| /// `physical-slot#`. It identifies the bay's position in the board's PCIe | ||
| /// topology and is board-specific: the same U.2 bay has a different | ||
| /// number on Gimlet and Cosmo. It is not the location label printed on | ||
| /// the chassis. | ||
| /// | ||
| /// Although **thus far** it has been stable, this value may also change | ||
| /// in subsequent host OS versions. For stability, the value of "location" | ||
| /// should be preferred. | ||
| /// in subsequent host OS versions. It is kept as the key inventory uses | ||
| /// for a disk and to join a disk to its firmware. For anything else, | ||
| /// prefer [`Self::location`]. | ||
| pub fn pcie_slot(&self) -> i64 { | ||
| self.pcie_slot | ||
| } | ||
|
|
@@ -286,12 +284,11 @@ impl UnparsedDisk { | |
| /// hardware topology: "N5" for a U.2 bay, "M.2 East" for a boot device. | ||
| /// | ||
| /// This is the operator-facing position, matching what is printed on the | ||
| /// sled, and is the value to show someone who has to find the drive. It | ||
| /// comes from libtopo and is best-effort: `None` means the topology had | ||
| /// no label for the disk or could not be read. A missing location never | ||
| /// prevents the disk from being used. | ||
| pub fn location(&self) -> Option<&str> { | ||
| self.location.as_deref() | ||
| /// sled, and is the value to show someone who has to find the drive. The | ||
| /// topology is where sled-hardware finds disks in the first place, so | ||
| /// every disk has one. | ||
| pub fn location(&self) -> &str { | ||
| &self.location | ||
| } | ||
|
|
||
| pub fn firmware(&self) -> &DiskFirmware { | ||
|
|
@@ -326,7 +323,7 @@ pub struct PooledDisk { | |
| pub zpool_name: ZpoolName, | ||
| pub firmware: DiskFirmware, | ||
| /// See [`UnparsedDisk::location`]. | ||
| pub location: Option<String>, | ||
|
Collaborator
Author
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. In summary, this is the "goal" of this PR. The location information we're reading from libtopo should be non-optional. |
||
| pub location: String, | ||
| } | ||
|
|
||
| impl PooledDisk { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.