-
Notifications
You must be signed in to change notification settings - Fork 47
Add host phase 1 flash hashes to inventory #8624
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
Changes from 8 commits
86d430d
e73406b
ddbb2e9
8e1feff
f6043fe
f3970af
3b19f8b
cd5b8a2
95e4994
cd8f1e0
5792473
e2f233c
bdbd14d
515e263
8dcf785
4f41d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ use nexus_db_schema::schema::inv_zone_manifest_zone; | |
use nexus_db_schema::schema::{ | ||
hw_baseboard_id, inv_caboose, inv_clickhouse_keeper_membership, | ||
inv_cockroachdb_status, inv_collection, inv_collection_error, inv_dataset, | ||
inv_last_reconciliation_dataset_result, | ||
inv_host_phase_1_flash_hash, inv_last_reconciliation_dataset_result, | ||
inv_last_reconciliation_disk_result, | ||
inv_last_reconciliation_orphaned_dataset, | ||
inv_last_reconciliation_zone_result, inv_mupdate_override_non_boot, | ||
|
@@ -158,6 +158,36 @@ impl From<HwRotSlot> for RotSlot { | |
} | ||
} | ||
|
||
// See [`M2Slot`]. | ||
impl_enum_type!( | ||
HwHostPhase1SlotEnum: | ||
|
||
#[derive(Copy, Clone, Debug, AsExpression, FromSqlRow, PartialEq)] | ||
pub enum HwHostPhase1Slot; | ||
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. Thoughts on just calling it something like 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. Sorry if this is rambly - thinking out loud. I definitely want to use something like this in other places (even on this PR!). I worry slightly about conflating two strongly-related-but-slightly-different things:
Things I have vague worry might change in the future:
Point 2 is a really long-winded way of saying "I'm not sure I think I'm coming around to "just call this 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. Renamed to |
||
|
||
// Enum values | ||
A => b"A" | ||
B => b"B" | ||
); | ||
|
||
impl From<HwHostPhase1Slot> for M2Slot { | ||
fn from(value: HwHostPhase1Slot) -> Self { | ||
match value { | ||
HwHostPhase1Slot::A => Self::A, | ||
HwHostPhase1Slot::B => Self::B, | ||
} | ||
} | ||
} | ||
|
||
impl From<M2Slot> for HwHostPhase1Slot { | ||
fn from(value: M2Slot) -> Self { | ||
match value { | ||
M2Slot::A => Self::A, | ||
M2Slot::B => Self::B, | ||
} | ||
} | ||
} | ||
|
||
// See [`nexus_types::inventory::CabooseWhich`]. | ||
impl_enum_type!( | ||
CabooseWhichEnum: | ||
|
@@ -752,6 +782,19 @@ impl From<InvRootOfTrust> for nexus_types::inventory::RotState { | |
} | ||
} | ||
|
||
/// See [`nexus_types::inventory::HostPhase1FlashHash`]. | ||
#[derive(Queryable, Clone, Debug, Selectable)] | ||
#[diesel(table_name = inv_host_phase_1_flash_hash)] | ||
pub struct InvHostPhase1FlashHash { | ||
pub inv_collection_id: Uuid, | ||
pub hw_baseboard_id: Uuid, | ||
pub time_collected: DateTime<Utc>, | ||
pub source: String, | ||
|
||
pub slot: HwHostPhase1Slot, | ||
pub hash: ArtifactHash, | ||
} | ||
|
||
/// See [`nexus_types::inventory::CabooseFound`]. | ||
#[derive(Queryable, Clone, Debug, Selectable)] | ||
#[diesel(table_name = inv_caboose)] | ||
|
@@ -966,6 +1009,7 @@ impl InvSledConfigReconciler { | |
boot_partition_a_error: Option<String>, | ||
boot_partition_b_error: Option<String>, | ||
) -> Self { | ||
// TODO-john replace this column with the hw_host_phase_1_slot enum? | ||
jgallagher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let (boot_disk_slot, boot_disk_error) = match boot_disk { | ||
Ok(M2Slot::A) => (Some(SqlU8(0)), None), | ||
Ok(M2Slot::B) => (Some(SqlU8(1)), None), | ||
|
Uh oh!
There was an error while loading. Please reload this page.