Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ flate2 = "1.0.26"
fs-err = "2.9.0"
futures = "0.3.28"
gateway-client = { path = "gateway-client" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["std"], rev = "1b3d1a4a074fb8ec2df67a906d41bfa636c261a8" }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "1b3d1a4a074fb8ec2df67a906d41bfa636c261a8" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["std"], rev = "da51768e10dbe260cc6302bcfd2ac379e275a313" }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "da51768e10dbe260cc6302bcfd2ac379e275a313" }
gateway-test-utils = { path = "gateway-test-utils" }
headers = "0.3.8"
heck = "0.4"
Expand Down
8 changes: 8 additions & 0 deletions gateway-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,14 @@ async fn update(
}
bail!("update failed (code {code})");
}
SpUpdateStatus::RotError { id, message } => {
if id != update_id {
bail!(
"different update failed ({id:?}, rot error {message})"
);
}
bail!("update failed (rot error {message})");
}
}
tokio::time::sleep(Duration::from_secs(1)).await;
}
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ enum SpUpdateStatus {
Aborted { id: Uuid },
/// The update process failed.
Failed { id: Uuid, code: u32 },
/// The update process failed with an RoT-specific error.
RotError { id: Uuid, message: String },
}

/// Progress of an SP preparing to update.
Expand Down
20 changes: 7 additions & 13 deletions gateway/src/http_entrypoints/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ impl From<UpdateStatus> for SpUpdateStatus {
UpdateStatus::Failed { id, code } => {
Self::Failed { id: id.into(), code }
}
UpdateStatus::RotError { id, error } => {
Self::RotError { id: id.into(), message: format!("{error:?}") }
}
}
}
}
Expand Down Expand Up @@ -206,20 +209,11 @@ impl From<Result<gateway_messages::RotStateV2, gateway_messages::RotError>>
}
}

impl From<gateway_messages::RotSlot> for RotSlot {
fn from(slot: gateway_messages::RotSlot) -> Self {
match slot {
gateway_messages::RotSlot::A => Self::A,
gateway_messages::RotSlot::B => Self::B,
}
}
}

impl From<gateway_messages::SlotId> for RotSlot {
fn from(slot: gateway_messages::SlotId) -> Self {
impl From<gateway_messages::RotSlotId> for RotSlot {
fn from(slot: gateway_messages::RotSlotId) -> Self {
match slot {
gateway_messages::SlotId::A => Self::A,
gateway_messages::SlotId::B => Self::B,
gateway_messages::RotSlotId::A => Self::A,
gateway_messages::RotSlotId::B => Self::B,
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions openapi/gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -2808,6 +2808,30 @@
"id",
"state"
]
},
{
"description": "The update process failed with an RoT-specific error.",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"message": {
"type": "string"
},
"state": {
"type": "string",
"enum": [
"rot_error"
]
}
},
"required": [
"id",
"message",
"state"
]
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions sp-sim/src/gimlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use gateway_messages::sp_impl::SpHandler;
use gateway_messages::sp_impl::{BoundsChecked, DeviceDescription};
use gateway_messages::ComponentAction;
use gateway_messages::Header;
use gateway_messages::SlotId;
use gateway_messages::RotSlotId;
use gateway_messages::SpComponent;
use gateway_messages::SpError;
use gateway_messages::SpPort;
Expand Down Expand Up @@ -547,8 +547,8 @@ impl Handler {
base_mac_address: [0; 6],
power_state: self.power_state,
rot: Ok(gateway_messages::RotStateV2 {
active: SlotId::A,
persistent_boot_preference: SlotId::A,
active: RotSlotId::A,
persistent_boot_preference: RotSlotId::A,
pending_persistent_boot_preference: None,
transient_boot_preference: None,
slot_a_sha3_256_digest: None,
Expand Down
6 changes: 3 additions & 3 deletions sp-sim/src/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use gateway_messages::IgnitionCommand;
use gateway_messages::IgnitionState;
use gateway_messages::MgsError;
use gateway_messages::PowerState;
use gateway_messages::SlotId;
use gateway_messages::RotSlotId;
use gateway_messages::SpComponent;
use gateway_messages::SpError;
use gateway_messages::SpPort;
Expand Down Expand Up @@ -344,8 +344,8 @@ impl Handler {
base_mac_address: [0; 6],
power_state: self.power_state,
rot: Ok(gateway_messages::RotStateV2 {
active: SlotId::A,
persistent_boot_preference: SlotId::A,
active: RotSlotId::A,
persistent_boot_preference: RotSlotId::A,
pending_persistent_boot_preference: None,
transient_boot_preference: None,
slot_a_sha3_256_digest: None,
Expand Down
4 changes: 4 additions & 0 deletions wicketd/src/update_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,10 @@ impl UpdateContext {
ensure!(id == update_id, "SP processing different update");
bail!("update failed (error code {code})");
}
SpUpdateStatus::RotError { message, id } => {
ensure!(id == update_id, "SP processing different update");
bail!("update failed (rot error message {message})");
}
}

tokio::time::sleep(STATUS_POLL_FREQ).await;
Expand Down