Skip to content

[reconfigurator] Pre-checks and post_update actions for RoT bootloader update #8325

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clients/gateway-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ serde.workspace = true
serde_json.workspace = true
schemars.workspace = true
slog.workspace = true
thiserror.workspace = true
uuid.workspace = true
omicron-workspace-hack.workspace = true
2 changes: 1 addition & 1 deletion clients/gateway-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ progenitor::generate_api!(
HostPhase2RecoveryImageId = { derives = [PartialEq, Eq, PartialOrd, Ord] },
ImageVersion = { derives = [PartialEq, Eq, PartialOrd, Ord] },
RotImageDetails = { derives = [PartialEq, Eq, PartialOrd, Ord] },
RotImageError = { derives = [ PartialEq, Eq, PartialOrd, Ord] },
RotImageError = { derives = [ thiserror::Error, PartialEq, Eq, PartialOrd, Ord] },
RotState = { derives = [PartialEq, Eq, PartialOrd, Ord] },
SpComponentCaboose = { derives = [PartialEq, Eq] },
SpIdentifier = { derives = [Copy, PartialEq, Hash, Eq] },
Expand Down
1 change: 1 addition & 0 deletions nexus/mgs-updates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ chrono.workspace = true
futures.workspace = true
gateway-client.workspace = true
gateway-types.workspace = true
gateway-messages.workspace = true
id-map.workspace = true
internal-dns-resolver.workspace = true
internal-dns-types.workspace = true
Expand Down
16 changes: 15 additions & 1 deletion nexus/mgs-updates/src/common_sp_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use super::MgsClients;
use super::UpdateProgress;
use futures::future::BoxFuture;
use gateway_client::types::RotImageError;
use gateway_client::types::SpType;
use gateway_client::types::SpUpdateStatus;
use gateway_types::rot::RotSlot;
Expand Down Expand Up @@ -267,14 +268,15 @@ pub trait SpComponentUpdateHelper {
log: &'a slog::Logger,
mgs_clients: &'a mut MgsClients,
update: &'a PendingMgsUpdate,
) -> BoxFuture<'a, Result<(), GatewayClientError>>;
) -> BoxFuture<'a, Result<(), PostUpdateError>>;
}

/// Describes the live state of the component before the update begins
#[derive(Debug)]
pub enum PrecheckStatus {
UpdateComplete,
ReadyForUpdate,
WaitingForOngoingRotBootloaderUpdate,
}

#[derive(Debug, Error)]
Expand Down Expand Up @@ -319,6 +321,18 @@ pub enum PrecheckError {
WrongInactiveVersion { expected: ExpectedVersion, found: FoundVersion },
}

#[derive(Debug, thiserror::Error)]
pub enum PostUpdateError {
#[error("communicating with MGS")]
GatewayClientError(#[from] GatewayClientError),

#[error("communicating with RoT: {message:?}")]
RotCommunicationFailed { message: String },

#[error("invalid RoT bootloader image: {error:?}")]
RotBootloaderImageError { error: RotImageError },
}

#[derive(Debug)]
pub enum FoundVersion {
MissingVersion,
Expand Down
Loading
Loading