Skip to content

Commit

Permalink
XXX stash
Browse files Browse the repository at this point in the history
  • Loading branch information
papertigers committed Jul 26, 2024
1 parent ccf8e67 commit 206166d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 1 deletion.
15 changes: 15 additions & 0 deletions nexus/db-model/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,20 @@ table! {
}
}

table! {
inv_nvme_disk_firmware (inv_collection_id, sled_id, slot) {
inv_collection_id -> Uuid,
sled_id -> Uuid,
slot -> Int8,

number_of_slots -> Int8,
active_slot -> Int8,
next_active_slot -> Nullable<Int8>,
slot1_is_read_only -> Bool,
slot_fw_versions -> Array<Nullable<Text>>,
}
}

table! {
inv_zpool (inv_collection_id, sled_id, id) {
inv_collection_id -> Uuid,
Expand Down Expand Up @@ -1816,6 +1830,7 @@ allow_tables_to_appear_in_same_query!(
network_interface,
instance_network_interface,
inv_physical_disk,
inv_nvme_disk_firmware,
service_network_interface,
oximeter,
physical_disk,
Expand Down
1 change: 1 addition & 0 deletions nexus/db-queries/src/db/datastore/physical_disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ mod test {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("TEST1".to_string())],
}
}
Expand Down
4 changes: 4 additions & 0 deletions nexus/inventory/src/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ pub fn representative() -> Representative {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("EXAMP1".to_string())],
},
// ... and a couple different vendors for our U.2s
Expand All @@ -302,6 +303,7 @@ pub fn representative() -> Representative {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("EXAMP1".to_string())],
},
sled_agent_client::types::InventoryDisk {
Expand All @@ -315,6 +317,7 @@ pub fn representative() -> Representative {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("EXAMP1".to_string())],
},
sled_agent_client::types::InventoryDisk {
Expand All @@ -328,6 +331,7 @@ pub fn representative() -> Representative {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("EXAMP1".to_string())],
},
];
Expand Down
1 change: 1 addition & 0 deletions nexus/reconfigurator/planning/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ impl Sled {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some(
"SIMUL1".to_string(),
)],
Expand Down
2 changes: 2 additions & 0 deletions nexus/types/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ pub struct PhysicalDisk {
pub identity: omicron_common::disk::DiskIdentity,
pub variant: PhysicalDiskKind,
pub slot: i64,
pub active_firmware_slot: u8,
}

impl From<sled_agent_client::types::InventoryDisk> for PhysicalDisk {
Expand All @@ -375,6 +376,7 @@ impl From<sled_agent_client::types::InventoryDisk> for PhysicalDisk {
identity: disk.identity,
variant: disk.variant.into(),
slot: disk.slot,
active_firmware_slot: disk.active_firmware_slot,
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -3368,6 +3368,9 @@
"type": "integer",
"format": "int64"
},
"slot1_is_read_only": {
"type": "boolean"
},
"slot_firmware_versions": {
"type": "array",
"items": {
Expand All @@ -3384,6 +3387,7 @@
"identity",
"number_of_firmware_slots",
"slot",
"slot1_is_read_only",
"slot_firmware_versions",
"variant"
]
Expand Down
2 changes: 2 additions & 0 deletions schema/crdb/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,8 @@ CREATE TABLE IF NOT EXISTS omicron.public.inv_nvme_disk_firmware (
active_slot INT8 CHECK (number_of_slots BETWEEN 1 AND 7) NOT NULL,
-- staged firmware slot to be active on reset
next_active_slot INT8 CHECK (number_of_slots BETWEEN 1 AND 7),
-- slot1 is distinct in the NVMe spec in the sense that it can be read only
slot1_is_read_only BOOLEAN,
-- the firmware version string for each NVMe slot (0 indexed), a NULL means the
-- slot exists but is empty
slot_fw_versions STRING(8)[] CHECK (array_length(slot_fw_versions) BETWEEN 1 AND 7),
Expand Down
3 changes: 2 additions & 1 deletion sled-agent/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,10 @@ pub struct InventoryDisk {
// Today we only have NVMe disks so we embedded the firmware metadata here.
// In the future we can track firmware metadata in a unique type if we
// support more than one disk format.
pub number_of_firmware_slots: u8,
pub active_firmware_slot: u8,
pub next_active_firmware_slot: Option<u8>,
pub number_of_firmware_slots: u8,
pub slot1_is_read_only: bool,
pub slot_firmware_versions: Vec<Option<String>>,
}

Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/rack_setup/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,7 @@ mod test {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("TEST1".to_string())],
})
.collect(),
Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/sim/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ impl SledAgent {
active_firmware_slot: 1,
next_active_firmware_slot: None,
number_of_firmware_slots: 1,
slot1_is_read_only: true,
slot_firmware_versions: vec![Some("SIMUL1".to_string())],
})
.collect(),
Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ impl SledAgent {
active_firmware_slot: firmware.active_slot(),
next_active_firmware_slot: firmware.next_active_slot(),
number_of_firmware_slots: firmware.number_of_slots(),
slot1_is_read_only: firmware.slot1_read_only(),
slot_firmware_versions: firmware.slots().to_vec(),
});
}
Expand Down

0 comments on commit 206166d

Please sign in to comment.