oxidecomputer / oxidecomputer/omicron
HostPhase2Status could use an enum when boot disk is unknown
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
To decide whether a sled is missing from inventory, we use the following method:
impl SledAgentUpdateStatus {
/// Update status suitable for a given sled ID that isn't present in
/// inventory.
pub fn unknown(sled_id: SledUuid) -> Self {
Self {
sled_id,
zones: IdOrdMap::new(),
host_phase_2: HostPhase2Status {
boot_disk: Err("unknown".to_string()),
slot_a_version: TufRepoVersion::Unknown,
slot_b_version: TufRepoVersion::Unknown,
},
}
}
}
How we check the boot disk is a bit fragile due to string equality. It would be nice to return an enum variant.
Found in https://github.com/oxidecomputer/omicron/pull/10476#discussion_r3306051658
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SledAgentUpdateStatus::unknown and the HostPhase2Status boot_disk field shown in the issue. Search for checks that compare the boot-disk error to the "unknown" string and trace their callers. Done means the unknown state is represented by an enum variant rather than fragile string equality, with affected behavior preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100