From feb27f4f505bcf4998a4636d132654031f8604fe Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 18 Jul 2024 21:26:59 -0700 Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?= =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.6-beta.1 [skip ci] --- Cargo.lock | 4 ++ clients/bootstrap-agent-client/Cargo.toml | 1 + clients/bootstrap-agent-client/src/lib.rs | 2 + clients/wicketd-client/Cargo.toml | 1 + clients/wicketd-client/src/lib.rs | 2 + openapi/bootstrap-agent.json | 36 ++++++------ openapi/wicketd.json | 40 +++++++------ sled-agent/src/bootstrap/http_entrypoints.rs | 25 ++++---- sled-agent/src/bootstrap/rack_ops.rs | 60 +++++--------------- sled-agent/src/bootstrap/server.rs | 4 +- uuid-kinds/src/lib.rs | 2 + wicket/src/ui/panes/rack_setup.rs | 16 +++--- wicketd-api/Cargo.toml | 1 + wicketd-api/src/lib.rs | 8 +-- wicketd/Cargo.toml | 1 + wicketd/src/http_entrypoints.rs | 8 +-- 16 files changed, 96 insertions(+), 115 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f08c7a483d..ce366cd7f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -703,6 +703,7 @@ name = "bootstrap-agent-client" version = "0.1.0" dependencies = [ "omicron-common", + "omicron-uuid-kinds", "omicron-workspace-hack", "oxnet", "progenitor", @@ -11141,6 +11142,7 @@ dependencies = [ "omicron-ddm-admin-client", "omicron-passwords", "omicron-test-utils", + "omicron-uuid-kinds", "omicron-workspace-hack", "once_cell", "openapi-lint", @@ -11184,6 +11186,7 @@ dependencies = [ "gateway-client", "omicron-common", "omicron-passwords", + "omicron-uuid-kinds", "omicron-workspace-hack", "schemars", "serde", @@ -11199,6 +11202,7 @@ dependencies = [ "chrono", "installinator-common", "omicron-common", + "omicron-uuid-kinds", "omicron-workspace-hack", "progenitor", "regress", diff --git a/clients/bootstrap-agent-client/Cargo.toml b/clients/bootstrap-agent-client/Cargo.toml index 0b1d2fab4b..e152e31966 100644 --- a/clients/bootstrap-agent-client/Cargo.toml +++ b/clients/bootstrap-agent-client/Cargo.toml @@ -18,5 +18,6 @@ serde_json.workspace = true sled-hardware-types.workspace = true slog.workspace = true uuid.workspace = true +omicron-uuid-kinds.workspace = true omicron-workspace-hack.workspace = true oxnet.workspace = true diff --git a/clients/bootstrap-agent-client/src/lib.rs b/clients/bootstrap-agent-client/src/lib.rs index b29f4e69f4..c737283d84 100644 --- a/clients/bootstrap-agent-client/src/lib.rs +++ b/clients/bootstrap-agent-client/src/lib.rs @@ -24,6 +24,8 @@ progenitor::generate_api!( replace = { AllowedSourceIps = omicron_common::api::external::AllowedSourceIps, ImportExportPolicy = omicron_common::api::external::ImportExportPolicy, + TypedUuidForRackInitKind = omicron_uuid_kinds::RackInitUuid, + TypedUuidForRackResetKind = omicron_uuid_kinds::RackResetUuid, } ); diff --git a/clients/wicketd-client/Cargo.toml b/clients/wicketd-client/Cargo.toml index 8e50964e59..0e55acd8bb 100644 --- a/clients/wicketd-client/Cargo.toml +++ b/clients/wicketd-client/Cargo.toml @@ -11,6 +11,7 @@ workspace = true chrono.workspace = true installinator-common.workspace = true omicron-common.workspace = true +omicron-uuid-kinds.workspace = true omicron-workspace-hack.workspace = true progenitor.workspace = true regress.workspace = true diff --git a/clients/wicketd-client/src/lib.rs b/clients/wicketd-client/src/lib.rs index bb377de31e..7a07ecd6a5 100644 --- a/clients/wicketd-client/src/lib.rs +++ b/clients/wicketd-client/src/lib.rs @@ -81,6 +81,8 @@ progenitor::generate_api!( StepEventForInstallinatorSpec = installinator_common::StepEvent, StepEventForWicketdEngineSpec = wicket_common::update_events::StepEvent, SwitchLocation = omicron_common::api::internal::shared::SwitchLocation, + TypedUuidForRackInitKind = omicron_uuid_kinds::RackInitUuid, + TypedUuidForRackResetKind = omicron_uuid_kinds::RackResetUuid, UpdateSimulatedResult = wicket_common::rack_update::UpdateSimulatedResult, UpdateTestError = wicket_common::rack_update::UpdateTestError, UplinkPreflightStepId = wicket_common::preflight_check::UplinkPreflightStepId, diff --git a/openapi/bootstrap-agent.json b/openapi/bootstrap-agent.json index 879e8cdc3f..68ae76e523 100644 --- a/openapi/bootstrap-agent.json +++ b/openapi/bootstrap-agent.json @@ -105,7 +105,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" } } } @@ -127,7 +127,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" } } } @@ -838,10 +838,6 @@ "speed400_g" ] }, - "RackInitId": { - "type": "string", - "format": "uuid" - }, "RackInitializeRequest": { "description": "Configuration for the \"rack setup service\".\n\nThe Rack Setup Service should be responsible for one-time setup actions, such as CockroachDB placement and initialization. Without operator intervention, however, these actions need a way to be automated in our deployment.", "type": "object", @@ -998,7 +994,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "status": { "type": "string", @@ -1020,7 +1016,7 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" } ] }, @@ -1039,7 +1035,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "message": { "type": "string" @@ -1061,7 +1057,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "status": { "type": "string", @@ -1079,7 +1075,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "status": { "type": "string", @@ -1101,7 +1097,7 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" } ] }, @@ -1120,7 +1116,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "message": { "type": "string" @@ -1142,7 +1138,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "status": { "type": "string", @@ -1158,10 +1154,6 @@ } ] }, - "RackResetId": { - "type": "string", - "format": "uuid" - }, "RecoverySiloConfig": { "description": "RecoverySiloConfig\n\n
JSON schema\n\n```json { \"type\": \"object\", \"required\": [ \"silo_name\", \"user_name\", \"user_password_hash\" ], \"properties\": { \"silo_name\": { \"$ref\": \"#/components/schemas/Name\" }, \"user_name\": { \"$ref\": \"#/components/schemas/UserId\" }, \"user_password_hash\": { \"$ref\": \"#/components/schemas/NewPasswordHash\" } } } ```
", "type": "object", @@ -1235,6 +1227,14 @@ } ] }, + "TypedUuidForRackInitKind": { + "type": "string", + "format": "uuid" + }, + "TypedUuidForRackResetKind": { + "type": "string", + "format": "uuid" + }, "UplinkAddressConfig": { "type": "object", "properties": { diff --git a/openapi/wicketd.json b/openapi/wicketd.json index 34e7eadb54..48e5d290a3 100644 --- a/openapi/wicketd.json +++ b/openapi/wicketd.json @@ -355,7 +355,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" } } } @@ -377,7 +377,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" } } } @@ -2618,19 +2618,14 @@ "rack_network_config" ] }, - "RackInitId": { - "description": "RackInitId\n\n
JSON schema\n\n```json { \"type\": \"string\", \"format\": \"uuid\" } ```
", - "type": "string", - "format": "uuid" - }, "RackOperationStatus": { - "description": "Current status of any rack-level operation being performed by this bootstrap agent.\n\n
JSON schema\n\n```json { \"description\": \"Current status of any rack-level operation being performed by this bootstrap agent.\", \"oneOf\": [ { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackInitId\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initializing\" ] } } }, { \"description\": \"`id` will be none if the rack was already initialized on startup.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"id\": { \"allOf\": [ { \"$ref\": \"#/components/schemas/RackInitId\" } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackInitId\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackInitId\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_panicked\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackResetId\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"resetting\" ] } } }, { \"description\": \"`reset_id` will be None if the rack is in an uninitialized-on-startup, or Some if it is in an uninitialized state due to a reset operation completing.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"reset_id\": { \"allOf\": [ { \"$ref\": \"#/components/schemas/RackResetId\" } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"uninitialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackResetId\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/RackResetId\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_panicked\" ] } } } ] } ```
", + "description": "Current status of any rack-level operation being performed by this bootstrap agent.\n\n
JSON schema\n\n```json { \"description\": \"Current status of any rack-level operation being performed by this bootstrap agent.\", \"oneOf\": [ { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initializing\" ] } } }, { \"description\": \"`id` will be none if the rack was already initialized on startup.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"id\": { \"allOf\": [ { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackInitKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"initialization_panicked\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"resetting\" ] } } }, { \"description\": \"`reset_id` will be None if the rack is in an uninitialized-on-startup, or Some if it is in an uninitialized state due to a reset operation completing.\", \"type\": \"object\", \"required\": [ \"status\" ], \"properties\": { \"reset_id\": { \"allOf\": [ { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" } ] }, \"status\": { \"type\": \"string\", \"enum\": [ \"uninitialized\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"message\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"message\": { \"type\": \"string\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_failed\" ] } } }, { \"type\": \"object\", \"required\": [ \"id\", \"status\" ], \"properties\": { \"id\": { \"$ref\": \"#/components/schemas/TypedUuidForRackResetKind\" }, \"status\": { \"type\": \"string\", \"enum\": [ \"reset_panicked\" ] } } } ] } ```
", "oneOf": [ { "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "status": { "type": "string", @@ -2652,7 +2647,7 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" } ] }, @@ -2671,7 +2666,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "message": { "type": "string" @@ -2693,7 +2688,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackInitId" + "$ref": "#/components/schemas/TypedUuidForRackInitKind" }, "status": { "type": "string", @@ -2711,7 +2706,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "status": { "type": "string", @@ -2733,7 +2728,7 @@ "nullable": true, "allOf": [ { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" } ] }, @@ -2752,7 +2747,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "message": { "type": "string" @@ -2774,7 +2769,7 @@ "type": "object", "properties": { "id": { - "$ref": "#/components/schemas/RackResetId" + "$ref": "#/components/schemas/TypedUuidForRackResetKind" }, "status": { "type": "string", @@ -2790,11 +2785,6 @@ } ] }, - "RackResetId": { - "description": "RackResetId\n\n
JSON schema\n\n```json { \"type\": \"string\", \"format\": \"uuid\" } ```
", - "type": "string", - "format": "uuid" - }, "RackV1Inventory": { "description": "The current state of the v1 Rack as known to wicketd", "type": "object", @@ -5682,6 +5672,14 @@ } ] }, + "TypedUuidForRackInitKind": { + "type": "string", + "format": "uuid" + }, + "TypedUuidForRackResetKind": { + "type": "string", + "format": "uuid" + }, "UpdateComponent": { "oneOf": [ { diff --git a/sled-agent/src/bootstrap/http_entrypoints.rs b/sled-agent/src/bootstrap/http_entrypoints.rs index 2fa0b83f1d..d3207f05a8 100644 --- a/sled-agent/src/bootstrap/http_entrypoints.rs +++ b/sled-agent/src/bootstrap/http_entrypoints.rs @@ -11,7 +11,6 @@ use super::rack_ops::RssAccess; use super::BootstrapError; use super::RssAccessError; use crate::bootstrap::params::RackInitializeRequest; -use crate::bootstrap::rack_ops::{RackInitId, RackResetId}; use crate::updates::ConfigUpdates; use crate::updates::{Component, UpdateManager}; use bootstore::schemes::v0 as bootstore; @@ -22,6 +21,8 @@ use dropshot::{ }; use http::StatusCode; use omicron_common::api::external::Error; +use omicron_uuid_kinds::RackInitUuid; +use omicron_uuid_kinds::RackResetUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use sled_hardware_types::Baseboard; @@ -47,7 +48,7 @@ impl BootstrapServerContext { pub(super) fn start_rack_initialize( &self, request: RackInitializeRequest, - ) -> Result { + ) -> Result { self.rss_access.start_initializing( &self.base_log, self.global_zone_bootstrap_ip, @@ -89,34 +90,34 @@ pub(crate) fn api() -> BootstrapApiDescription { #[serde(tag = "status", rename_all = "snake_case")] pub enum RackOperationStatus { Initializing { - id: RackInitId, + id: RackInitUuid, }, /// `id` will be none if the rack was already initialized on startup. Initialized { - id: Option, + id: Option, }, InitializationFailed { - id: RackInitId, + id: RackInitUuid, message: String, }, InitializationPanicked { - id: RackInitId, + id: RackInitUuid, }, Resetting { - id: RackResetId, + id: RackResetUuid, }, /// `reset_id` will be None if the rack is in an uninitialized-on-startup, /// or Some if it is in an uninitialized state due to a reset operation /// completing. Uninitialized { - reset_id: Option, + reset_id: Option, }, ResetFailed { - id: RackResetId, + id: RackResetUuid, message: String, }, ResetPanicked { - id: RackResetId, + id: RackResetUuid, }, } @@ -173,7 +174,7 @@ async fn rack_initialization_status( async fn rack_initialize( rqctx: RequestContext, body: TypedBody, -) -> Result, HttpError> { +) -> Result, HttpError> { let ctx = rqctx.context(); let request = body.into_inner(); let id = ctx @@ -189,7 +190,7 @@ async fn rack_initialize( }] async fn rack_reset( rqctx: RequestContext, -) -> Result, HttpError> { +) -> Result, HttpError> { let ctx = rqctx.context(); let id = ctx .rss_access diff --git a/sled-agent/src/bootstrap/rack_ops.rs b/sled-agent/src/bootstrap/rack_ops.rs index 5cfd0b074a..4da5f0ab28 100644 --- a/sled-agent/src/bootstrap/rack_ops.rs +++ b/sled-agent/src/bootstrap/rack_ops.rs @@ -9,9 +9,8 @@ use crate::bootstrap::params::RackInitializeRequest; use crate::bootstrap::rss_handle::RssHandle; use crate::rack_setup::service::SetupServiceError; use bootstore::schemes::v0 as bootstore; -use schemars::JsonSchema; -use serde::Deserialize; -use serde::Serialize; +use omicron_uuid_kinds::RackInitUuid; +use omicron_uuid_kinds::RackResetUuid; use sled_storage::manager::StorageHandle; use slog::Logger; use std::mem; @@ -20,37 +19,6 @@ use std::sync::Arc; use std::sync::Mutex; use tokio::sync::oneshot; use tokio::sync::oneshot::error::TryRecvError; -use uuid::Uuid; - -#[derive( - Debug, - Clone, - Copy, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - Serialize, - Deserialize, - JsonSchema, -)] -pub struct RackInitId(pub Uuid); - -#[derive( - Debug, - Clone, - Copy, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - Serialize, - Deserialize, - JsonSchema, -)] -pub struct RackResetId(pub Uuid); #[derive(Debug, Clone, thiserror::Error)] pub enum RssAccessError { @@ -174,7 +142,7 @@ impl RssAccess { storage_manager: &StorageHandle, bootstore_node_handle: &bootstore::NodeHandle, request: RackInitializeRequest, - ) -> Result { + ) -> Result { let mut status = self.status.lock().unwrap(); match &*status { @@ -202,7 +170,7 @@ impl RssAccess { } RssStatus::Uninitialized { .. } => { let (completion_tx, completion) = oneshot::channel(); - let id = RackInitId(Uuid::new_v4()); + let id = RackInitUuid::new_v4(); *status = RssStatus::Initializing { id, completion }; mem::drop(status); @@ -240,7 +208,7 @@ impl RssAccess { &self, parent_log: &Logger, global_zone_bootstrap_ip: Ipv6Addr, - ) -> Result { + ) -> Result { let mut status = self.status.lock().unwrap(); match &*status { @@ -267,7 +235,7 @@ impl RssAccess { } RssStatus::Initialized { .. } => { let (completion_tx, completion) = oneshot::channel(); - let id = RackResetId(Uuid::new_v4()); + let id = RackResetUuid::new_v4(); *status = RssStatus::Resetting { id, completion }; mem::drop(status); @@ -302,40 +270,40 @@ enum RssStatus { // We can either be uninitialized on startup (in which case `reset_id` // is None) or because a reset has completed (in which case `reset_id` // is Some). - reset_id: Option, + reset_id: Option, }, Initialized { // We can either be initialized on startup (in which case `id` // is None) or because initialization has completed (in which case `id` // is Some). - id: Option, + id: Option, }, // Tranistory states (which we may be in for a long time, even on human time // scales, but should eventually leave). Initializing { - id: RackInitId, + id: RackInitUuid, completion: oneshot::Receiver<()>, }, Resetting { - id: RackResetId, + id: RackResetUuid, completion: oneshot::Receiver<()>, }, // Terminal failure states; these require support intervention. InitializationFailed { - id: RackInitId, + id: RackInitUuid, err: SetupServiceError, }, InitializationPanicked { - id: RackInitId, + id: RackInitUuid, }, ResetFailed { - id: RackResetId, + id: RackResetUuid, err: SetupServiceError, }, ResetPanicked { - id: RackResetId, + id: RackResetUuid, }, } diff --git a/sled-agent/src/bootstrap/server.rs b/sled-agent/src/bootstrap/server.rs index 369437d3aa..69a6f455cc 100644 --- a/sled-agent/src/bootstrap/server.rs +++ b/sled-agent/src/bootstrap/server.rs @@ -8,7 +8,6 @@ use super::config::BOOTSTRAP_AGENT_HTTP_PORT; use super::http_entrypoints; use super::params::RackInitializeRequest; use super::params::StartSledAgentRequest; -use super::rack_ops::RackInitId; use super::views::SledAgentResponse; use super::BootstrapError; use super::RssAccessError; @@ -42,6 +41,7 @@ use omicron_common::ledger; use omicron_common::ledger::Ledger; use omicron_ddm_admin_client::Client as DdmAdminClient; use omicron_ddm_admin_client::DdmError; +use omicron_uuid_kinds::RackInitUuid; use sled_hardware::underlay; use sled_storage::dataset::CONFIG_DATASET; use sled_storage::manager::StorageHandle; @@ -290,7 +290,7 @@ impl Server { pub fn start_rack_initialize( &self, request: RackInitializeRequest, - ) -> Result { + ) -> Result { self.bootstrap_http_server.app_private().start_rack_initialize(request) } diff --git a/uuid-kinds/src/lib.rs b/uuid-kinds/src/lib.rs index 53acc9c1ed..fb8a6f6fa9 100644 --- a/uuid-kinds/src/lib.rs +++ b/uuid-kinds/src/lib.rs @@ -58,6 +58,8 @@ impl_typed_uuid_kind! { OmicronZone => "service", PhysicalDisk => "physical_disk", Propolis => "propolis", + RackInit => "rack_init", + RackReset => "rack_reset", Sled => "sled", TufRepo => "tuf_repo", Upstairs => "upstairs", diff --git a/wicket/src/ui/panes/rack_setup.rs b/wicket/src/ui/panes/rack_setup.rs index b4fa9de6f0..7bb63b6b1b 100644 --- a/wicket/src/ui/panes/rack_setup.rs +++ b/wicket/src/ui/panes/rack_setup.rs @@ -352,7 +352,7 @@ fn draw_rack_status_details_popup( ])); if let Some(id) = reset_id { body.lines.push(Line::from(vec![Span::styled( - format!("Last reset operation ID: {}", id.0), + format!("Last reset operation ID: {}", id), style::plain_text(), )])); } @@ -364,7 +364,7 @@ fn draw_rack_status_details_popup( ])); if let Some(id) = id { body.lines.push(Line::from(vec![Span::styled( - format!("Last initialization operation ID: {}", id.0), + format!("Last initialization operation ID: {}", id), style::plain_text(), )])); } @@ -375,7 +375,7 @@ fn draw_rack_status_details_popup( Span::styled("Initialization Failed", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Last initialization operation ID: {}", id.0), + format!("Last initialization operation ID: {}", id), style::plain_text(), )])); push_text_lines(message, prefix, &mut body.lines); @@ -386,7 +386,7 @@ fn draw_rack_status_details_popup( Span::styled("Initialization Panicked", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Last initialization operation ID: {}", id.0), + format!("Last initialization operation ID: {}", id), style::plain_text(), )])); } @@ -396,7 +396,7 @@ fn draw_rack_status_details_popup( Span::styled("Reset Failed", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Last reset operation ID: {}", id.0), + format!("Last reset operation ID: {}", id), style::plain_text(), )])); push_text_lines(message, prefix, &mut body.lines); @@ -407,7 +407,7 @@ fn draw_rack_status_details_popup( Span::styled("Reset Panicked", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Last reset operation ID: {}", id.0), + format!("Last reset operation ID: {}", id), style::plain_text(), )])); } @@ -417,7 +417,7 @@ fn draw_rack_status_details_popup( Span::styled("Initializing", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Current operation ID: {}", id.0), + format!("Current operation ID: {}", id), style::plain_text(), )])); } @@ -427,7 +427,7 @@ fn draw_rack_status_details_popup( Span::styled("Resetting", style::plain_text()), ])); body.lines.push(Line::from(vec![Span::styled( - format!("Current operation ID: {}", id.0), + format!("Current operation ID: {}", id), style::plain_text(), )])); } diff --git a/wicketd-api/Cargo.toml b/wicketd-api/Cargo.toml index ba1d862a40..75c3a53461 100644 --- a/wicketd-api/Cargo.toml +++ b/wicketd-api/Cargo.toml @@ -12,6 +12,7 @@ dropshot.workspace = true gateway-client.workspace = true omicron-common.workspace = true omicron-passwords.workspace = true +omicron-uuid-kinds.workspace = true omicron-workspace-hack.workspace = true schemars.workspace = true serde.workspace = true diff --git a/wicketd-api/src/lib.rs b/wicketd-api/src/lib.rs index 9192578305..2af264eb94 100644 --- a/wicketd-api/src/lib.rs +++ b/wicketd-api/src/lib.rs @@ -2,9 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use bootstrap_agent_client::types::RackInitId; use bootstrap_agent_client::types::RackOperationStatus; -use bootstrap_agent_client::types::RackResetId; use dropshot::HttpError; use dropshot::HttpResponseOk; use dropshot::HttpResponseUpdatedNoContent; @@ -16,6 +14,8 @@ use gateway_client::types::IgnitionCommand; use omicron_common::api::external::SemverVersion; use omicron_common::update::ArtifactHashId; use omicron_common::update::ArtifactId; +use omicron_uuid_kinds::RackInitUuid; +use omicron_uuid_kinds::RackResetUuid; use schemars::JsonSchema; use serde::Deserialize; use serde::Serialize; @@ -170,7 +170,7 @@ pub trait WicketdApi { }] async fn post_run_rack_setup( rqctx: RequestContext, - ) -> Result, HttpError>; + ) -> Result, HttpError>; /// Run rack reset. #[endpoint { @@ -179,7 +179,7 @@ pub trait WicketdApi { }] async fn post_run_rack_reset( rqctx: RequestContext, - ) -> Result, HttpError>; + ) -> Result, HttpError>; /// A status endpoint used to report high level information known to /// wicketd. diff --git a/wicketd/Cargo.toml b/wicketd/Cargo.toml index d2e870226b..324ae01b42 100644 --- a/wicketd/Cargo.toml +++ b/wicketd/Cargo.toml @@ -57,6 +57,7 @@ installinator-common.workspace = true omicron-certificates.workspace = true omicron-common.workspace = true omicron-passwords.workspace = true +omicron-uuid-kinds.workspace = true sled-hardware-types.workspace = true tufaceous-lib.workspace = true update-common.workspace = true diff --git a/wicketd/src/http_entrypoints.rs b/wicketd/src/http_entrypoints.rs index 5661843c23..55b4d61c9a 100644 --- a/wicketd/src/http_entrypoints.rs +++ b/wicketd/src/http_entrypoints.rs @@ -10,9 +10,7 @@ use crate::mgs::GetInventoryError; use crate::mgs::MgsHandle; use crate::mgs::ShutdownInProgress; use crate::SmfConfigValues; -use bootstrap_agent_client::types::RackInitId; use bootstrap_agent_client::types::RackOperationStatus; -use bootstrap_agent_client::types::RackResetId; use dropshot::ApiDescription; use dropshot::HttpError; use dropshot::HttpResponseOk; @@ -24,6 +22,8 @@ use dropshot::TypedBody; use http::StatusCode; use internal_dns::resolver::Resolver; use omicron_common::api::internal::shared::SwitchLocation; +use omicron_uuid_kinds::RackInitUuid; +use omicron_uuid_kinds::RackResetUuid; use sled_hardware_types::Baseboard; use slog::o; use std::collections::BTreeMap; @@ -237,7 +237,7 @@ impl WicketdApi for WicketdApiImpl { async fn post_run_rack_setup( rqctx: RequestContext, - ) -> Result, HttpError> { + ) -> Result, HttpError> { let ctx = rqctx.context(); let log = &rqctx.log; @@ -291,7 +291,7 @@ impl WicketdApi for WicketdApiImpl { async fn post_run_rack_reset( rqctx: RequestContext, - ) -> Result, HttpError> { + ) -> Result, HttpError> { let ctx = rqctx.context(); let sled_agent_addr = ctx.bootstrap_agent_addr().map_err(|err| { From a6d5eddbf5c30c888c5ab2dc300b39058d1c47ef Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 18 Jul 2024 21:27:57 -0700 Subject: [PATCH 2/3] fix style Created using spr 1.3.6-beta.1 --- sled-agent/src/sim/sled_agent.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sled-agent/src/sim/sled_agent.rs b/sled-agent/src/sim/sled_agent.rs index f1cdc49d3b..f23b14c377 100644 --- a/sled-agent/src/sim/sled_agent.rs +++ b/sled-agent/src/sim/sled_agent.rs @@ -44,7 +44,9 @@ use propolis_client::{ types::VolumeConstructionRequest, Client as PropolisClient, }; use propolis_mock_server::Context as PropolisContext; -use sled_agent_types::early_networking::{EarlyNetworkConfig, EarlyNetworkConfigBody}; +use sled_agent_types::early_networking::{ + EarlyNetworkConfig, EarlyNetworkConfigBody, +}; use sled_storage::resources::DisksManagementResult; use slog::Logger; use std::collections::{HashMap, HashSet, VecDeque}; From 146a838011bae440b54dd68a7c7c3c69de9f69d7 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 18 Jul 2024 21:40:45 -0700 Subject: [PATCH 3/3] fix doc build Created using spr 1.3.6-beta.1 --- openapi/sled-agent.json | 2 +- sled-agent/types/src/early_networking.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openapi/sled-agent.json b/openapi/sled-agent.json index 27cfe576b7..1323769da2 100644 --- a/openapi/sled-agent.json +++ b/openapi/sled-agent.json @@ -2658,7 +2658,7 @@ ] }, "EarlyNetworkConfig": { - "description": "Network configuration required to bring up the control plane\n\nThe fields in this structure are those from [`super::params::RackInitializeRequest`] necessary for use beyond RSS. This is just for the initial rack configuration and cold boot purposes. Updates come from Nexus.", + "description": "Network configuration required to bring up the control plane\n\nThe fields in this structure are those from [`crate::rack_init::RackInitializeRequest`] necessary for use beyond RSS. This is just for the initial rack configuration and cold boot purposes. Updates come from Nexus.", "type": "object", "properties": { "body": { diff --git a/sled-agent/types/src/early_networking.rs b/sled-agent/types/src/early_networking.rs index 48426e6205..dc93aa1300 100644 --- a/sled-agent/types/src/early_networking.rs +++ b/sled-agent/types/src/early_networking.rs @@ -15,9 +15,9 @@ use slog::{warn, Logger}; /// Network configuration required to bring up the control plane /// /// The fields in this structure are those from -/// [`super::params::RackInitializeRequest`] necessary for use beyond RSS. This -/// is just for the initial rack configuration and cold boot purposes. Updates -/// come from Nexus. +/// [`crate::rack_init::RackInitializeRequest`] necessary for use beyond RSS. +/// This is just for the initial rack configuration and cold boot purposes. +/// Updates come from Nexus. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] pub struct EarlyNetworkConfig { // The current generation number of data as stored in CRDB.