Skip to content

Commit

Permalink
Expose firmware to inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
papertigers committed May 23, 2024
1 parent b8d74c2 commit 1ee77ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ impl SledAgent {
let mut disks = vec![];
let mut zpools = vec![];
let all_disks = self.storage().get_latest_disks().await;
for (identity, variant, slot) in all_disks.iter_all() {
for (identity, variant, slot, _firmware) in all_disks.iter_all() {
disks.push(crate::params::InventoryDisk {
identity: identity.clone(),
variant,
Expand Down
2 changes: 1 addition & 1 deletion sled-storage/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ impl StorageManager {
.resources
.disks()
.iter_all()
.filter_map(|(id, _variant, _slot)| {
.filter_map(|(id, _variant, _slot, _firmware)| {
if !all_ids.contains(id) {
Some(id.clone())
} else {
Expand Down
11 changes: 6 additions & 5 deletions sled-storage/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use omicron_common::disk::DiskIdentity;
use omicron_uuid_kinds::ZpoolUuid;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use sled_hardware::DiskVariant;
use sled_hardware::{DiskFirmware, DiskVariant};
use slog::{info, o, warn, Logger};
use std::collections::BTreeMap;
use std::sync::Arc;
Expand Down Expand Up @@ -241,16 +241,17 @@ impl AllDisks {
/// Returns an iterator over all disks, managed or not.
pub fn iter_all(
&self,
) -> impl Iterator<Item = (&DiskIdentity, DiskVariant, i64)> {
) -> impl Iterator<Item = (&DiskIdentity, DiskVariant, i64, &DiskFirmware)>
{
self.values.iter().map(|(identity, disk)| match disk {
ManagedDisk::ExplicitlyManaged(disk) => {
(identity, disk.variant(), disk.slot())
(identity, disk.variant(), disk.slot(), disk.firmware())
}
ManagedDisk::ImplicitlyManaged(disk) => {
(identity, disk.variant(), disk.slot())
(identity, disk.variant(), disk.slot(), disk.firmware())
}
ManagedDisk::Unmanaged(raw) => {
(identity, raw.variant(), raw.slot())
(identity, raw.variant(), raw.slot(), raw.firmware())
}
})
}
Expand Down

0 comments on commit 1ee77ff

Please sign in to comment.