-
Notifications
You must be signed in to change notification settings - Fork 47
Add desired host phase 2 contents to OmicronSledConfig
(PR 1/4)
#8538
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b867be7
OmicronSledConfig: add desired host phase 2 contents
jgallagher a3dc674
openapi
jgallagher f55d70b
replace TODO with issue link
jgallagher 3d4f72c
expectorate
jgallagher 8027c0d
expectorate again
jgallagher 1e6ce9f
fix string
jgallagher 8f6cb71
swrite! instead of write!().unwrap()
jgallagher 778fbd5
Merge remote-tracking branch 'origin/main' into john/sled-config-phase2
jgallagher 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ use nexus_db_schema::schema::{ | |
use nexus_sled_agent_shared::inventory::BootImageHeader; | ||
use nexus_sled_agent_shared::inventory::BootPartitionDetails; | ||
use nexus_sled_agent_shared::inventory::ConfigReconcilerInventoryStatus; | ||
use nexus_sled_agent_shared::inventory::HostPhase2DesiredContents; | ||
use nexus_sled_agent_shared::inventory::HostPhase2DesiredSlots; | ||
use nexus_sled_agent_shared::inventory::MupdateOverrideBootInventory; | ||
use nexus_sled_agent_shared::inventory::MupdateOverrideInventory; | ||
use nexus_sled_agent_shared::inventory::MupdateOverrideNonBootInventory; | ||
|
@@ -1944,6 +1946,9 @@ pub struct InvOmicronSledConfig { | |
pub id: DbTypedUuid<OmicronSledConfigKind>, | ||
pub generation: Generation, | ||
pub remove_mupdate_override: Option<DbTypedUuid<MupdateOverrideKind>>, | ||
|
||
#[diesel(embed)] | ||
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. TIL |
||
pub host_phase_2: DbHostPhase2DesiredSlots, | ||
} | ||
|
||
impl InvOmicronSledConfig { | ||
|
@@ -1952,12 +1957,51 @@ impl InvOmicronSledConfig { | |
id: OmicronSledConfigUuid, | ||
generation: external::Generation, | ||
remove_mupdate_override: Option<MupdateOverrideUuid>, | ||
host_phase_2: HostPhase2DesiredSlots, | ||
) -> Self { | ||
Self { | ||
inv_collection_id: inv_collection_id.into(), | ||
id: id.into(), | ||
generation: Generation(generation), | ||
remove_mupdate_override: remove_mupdate_override.map(From::from), | ||
host_phase_2: host_phase_2.into(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Queryable, Clone, Debug, Selectable, Insertable)] | ||
#[diesel(table_name = inv_omicron_sled_config)] | ||
pub struct DbHostPhase2DesiredSlots { | ||
pub host_phase_2_desired_slot_a: Option<ArtifactHash>, | ||
pub host_phase_2_desired_slot_b: Option<ArtifactHash>, | ||
} | ||
|
||
impl From<HostPhase2DesiredSlots> for DbHostPhase2DesiredSlots { | ||
fn from(value: HostPhase2DesiredSlots) -> Self { | ||
let remap = |desired| match desired { | ||
HostPhase2DesiredContents::CurrentContents => None, | ||
HostPhase2DesiredContents::Artifact { hash } => { | ||
Some(ArtifactHash(hash)) | ||
} | ||
}; | ||
Self { | ||
host_phase_2_desired_slot_a: remap(value.slot_a), | ||
host_phase_2_desired_slot_b: remap(value.slot_b), | ||
} | ||
} | ||
} | ||
|
||
impl From<DbHostPhase2DesiredSlots> for HostPhase2DesiredSlots { | ||
fn from(value: DbHostPhase2DesiredSlots) -> Self { | ||
let remap = |maybe_artifact| match maybe_artifact { | ||
None => HostPhase2DesiredContents::CurrentContents, | ||
Some(ArtifactHash(hash)) => { | ||
HostPhase2DesiredContents::Artifact { hash } | ||
} | ||
}; | ||
Self { | ||
slot_a: remap(value.host_phase_2_desired_slot_a), | ||
slot_b: remap(value.host_phase_2_desired_slot_b), | ||
} | ||
} | ||
} | ||
|
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
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
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.