From 0b4831e9a193aa13bb060c927c9f4b7c24825c6a Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 11 Aug 2026 13:35:23 -0700 Subject: [PATCH 1/2] [spr] changes to main this commit is based on Created using spr 1.3.6-beta.1 [skip ci] --- openapi/wicketd.json | 23 --------------------- wicket/src/wicketd.rs | 4 ++-- wicketd-api/src/lib.rs | 13 ------------ wicketd/src/commission/mod.rs | 2 +- wicketd/src/http_entrypoints.rs | 36 --------------------------------- 5 files changed, 3 insertions(+), 75 deletions(-) diff --git a/openapi/wicketd.json b/openapi/wicketd.json index 5b7a800aefe..23271794b23 100644 --- a/openapi/wicketd.json +++ b/openapi/wicketd.json @@ -319,29 +319,6 @@ "$ref": "#/components/responses/Error" } } - }, - "post": { - "summary": "Run rack setup.", - "description": "Will return an error if not all of the rack setup configuration has been populated.", - "operationId": "post_run_rack_setup", - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RackInitUuid" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } } }, "/rack-setup/config": { diff --git a/wicket/src/wicketd.rs b/wicket/src/wicketd.rs index 16fd123def8..2a020b4536b 100644 --- a/wicket/src/wicketd.rs +++ b/wicket/src/wicketd.rs @@ -290,10 +290,10 @@ impl WicketdManager { fn start_rack_initialization(&self) { let log = self.log.clone(); - let addr = self.wicketd_addr; + let addr = self.commission_addr; let events_tx = self.events_tx.clone(); tokio::spawn(async move { - let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT); + let client = create_commission_client(&log, addr, WICKETD_TIMEOUT); let response = match client.post_run_rack_setup().await { Ok(_) => Ok(()), Err(error) => Err(error.to_string()), diff --git a/wicketd-api/src/lib.rs b/wicketd-api/src/lib.rs index 1e560596ee9..b7e7956fd24 100644 --- a/wicketd-api/src/lib.rs +++ b/wicketd-api/src/lib.rs @@ -11,7 +11,6 @@ use dropshot::RequestContext; use dropshot::StreamingBody; use dropshot::TypedBody; use gateway_client::types::IgnitionCommand; -use omicron_uuid_kinds::RackInitUuid; use schemars::JsonSchema; use semver::Version; use serde::Deserialize; @@ -186,18 +185,6 @@ pub trait WicketdApi { rqctx: RequestContext, ) -> Result, HttpError>; - /// Run rack setup. - /// - /// Will return an error if not all of the rack setup configuration has - /// been populated. - #[endpoint { - method = POST, - path = "/rack-setup" - }] - async fn post_run_rack_setup( - rqctx: RequestContext, - ) -> Result, HttpError>; - /// A status endpoint used to report high level information known to /// wicketd. /// diff --git a/wicketd/src/commission/mod.rs b/wicketd/src/commission/mod.rs index bbd03d2398e..a3c41734d03 100644 --- a/wicketd/src/commission/mod.rs +++ b/wicketd/src/commission/mod.rs @@ -5,7 +5,7 @@ //! The stable wicketd commissioning API. //! //! This API is used by automated tooling such as rkdeploy to commission new -//! racks. It is a reduced subset of the full, unstable wicketd API. +//! racks. //! //! **Automation must always use the stable API!** //! diff --git a/wicketd/src/http_entrypoints.rs b/wicketd/src/http_entrypoints.rs index 064d88fc335..f730747ec1f 100644 --- a/wicketd/src/http_entrypoints.rs +++ b/wicketd/src/http_entrypoints.rs @@ -15,7 +15,6 @@ use crate::mgs::GetInventoryResponse as GetMgsInventoryResponse; use crate::mgs::records_to_mgs_inventory; use crate::multirack_config::CurrentMultirackJoinConfig; use crate::transceivers::GetTransceiversResponse; -use bootstrap_agent_lockstep_client::ClientInfo as _; use bootstrap_agent_lockstep_types::RackOperationStatus; use dropshot::ApiDescription; use dropshot::HttpError; @@ -26,7 +25,6 @@ use dropshot::RequestContext; use dropshot::StreamingBody; use dropshot::TypedBody; use internal_dns_resolver::Resolver; -use omicron_uuid_kinds::RackInitUuid; use sled_agent_types::early_networking::SwitchSlot; use slog::o; use std::sync::Arc; @@ -310,40 +308,6 @@ impl WicketdApi for WicketdApiImpl { Ok(HttpResponseOk(op_status)) } - async fn post_run_rack_setup( - rqctx: RequestContext, - ) -> Result, HttpError> { - let ctx = rqctx.context(); - let log = &rqctx.log; - - let client = ba_lockstep_client(ctx); - let request = { - let mut config = ctx.rss_or_multirack_join_config.lock().unwrap(); - - let rss_config = config.rss_config_mut_or_conflict( - "cannot run rack setup when not preparing for RSS", - )?; - - rss_config.start_rss_request(&ctx.bootstrap_peers, log).map_err( - |err| HttpError::for_bad_request(None, format!("{err:#}")), - )? - }; - - slog::info!( - ctx.log, - "Sending RSS initialize request to {}", - client.baseurl() - ); - - let init_id = client - .rack_initialize(&request) - .await - .map_err(|err| ba_lockstep_error_to_http(err, "rack setup"))? - .into_inner(); - - Ok(HttpResponseOk(init_id)) - } - async fn get_inventory( rqctx: RequestContext, body_params: TypedBody, From 26d98d7c3d9ca175844520417087f2592f87fae8 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 11 Aug 2026 13:49:45 -0700 Subject: [PATCH 2/2] [spr] changes introduced through rebase Created using spr 1.3.6-beta.1 [skip ci] --- wicket/src/dispatch.rs | 14 ++++++++------ wicket/src/lib.rs | 1 + wicket/src/runner.rs | 17 ++++------------- wicket/src/wicketd.rs | 43 +++++++++++++++++++++--------------------- 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/wicket/src/dispatch.rs b/wicket/src/dispatch.rs index 2cbbecca9ef..1f1f9655d81 100644 --- a/wicket/src/dispatch.rs +++ b/wicket/src/dispatch.rs @@ -19,13 +19,15 @@ use slog::Drain; use crate::{ Runner, cli::{CommandOutput, ShellApp}, + wicketd::WicketdAddrs, }; pub fn exec() -> Result { - let wicketd_addr = - SocketAddrV6::new(Ipv6Addr::LOCALHOST, WICKETD_PORT, 0, 0); - let commission_addr = - SocketAddrV6::new(Ipv6Addr::LOCALHOST, WICKETD_COMMISSION_PORT, 0, 0); + let localhost = Ipv6Addr::LOCALHOST; + let addrs = WicketdAddrs { + wicketd: SocketAddrV6::new(localhost, WICKETD_PORT, 0, 0), + commission: SocketAddrV6::new(localhost, WICKETD_COMMISSION_PORT, 0, 0), + }; // SSH_ORIGINAL_COMMAND contains additional arguments, if any. match std::env::var("SSH_ORIGINAL_COMMAND") { @@ -37,7 +39,7 @@ pub fn exec() -> Result { let runtime = tokio::runtime::Runtime::new() .context("creating tokio runtime")?; runtime.block_on(exec_with_args( - wicketd_addr, + addrs.wicketd, args, OutputKind::Terminal, )) @@ -46,7 +48,7 @@ pub fn exec() -> Result { // Do not expose log messages via standard error since they'll show up // on top of the TUI. let log = setup_log(&log_path()?, WithStderr::No)?; - Runner::new(log, wicketd_addr, commission_addr).run()?; + Runner::new(log, addrs).run()?; Ok(ExitCode::SUCCESS) } } diff --git a/wicket/src/lib.rs b/wicket/src/lib.rs index 5e09cb91f45..732cf9988ec 100644 --- a/wicket/src/lib.rs +++ b/wicket/src/lib.rs @@ -25,3 +25,4 @@ pub use events::{Action, Event, Recorder, Snapshot}; pub use keymap::{Cmd, KeyHandler}; pub use state::State; pub use ui::{Control, Screen}; +pub use wicketd::WicketdAddrs; diff --git a/wicket/src/runner.rs b/wicket/src/runner.rs index f3fbd102945..f26ec0c98b1 100644 --- a/wicket/src/runner.rs +++ b/wicket/src/runner.rs @@ -17,7 +17,6 @@ use slog::Logger; use slog::{debug, error, info}; use slog_error_chain::InlineErrorChain; use std::io::{Stdout, stdout}; -use std::net::SocketAddrV6; use std::time::Instant; use tokio::sync::mpsc::{ UnboundedReceiver, UnboundedSender, unbounded_channel, @@ -30,7 +29,7 @@ use crate::helpers::get_update_test_error; use crate::state::CreateClearUpdateStateOptions; use crate::state::CreateStartUpdateOptions; use crate::ui::Screen; -use crate::wicketd::{self, WicketdHandle, WicketdManager}; +use crate::wicketd::{self, WicketdAddrs, WicketdHandle, WicketdManager}; use crate::{Action, Cmd, Event, KeyHandler, Recorder, State, TICK_INTERVAL}; // We can avoid a bunch of unnecessary type parameters by picking them ahead of time. @@ -283,22 +282,14 @@ pub struct Runner { #[allow(clippy::new_without_default)] impl Runner { - pub fn new( - log: slog::Logger, - wicketd_addr: SocketAddrV6, - commission_addr: SocketAddrV6, - ) -> Runner { + pub fn new(log: slog::Logger, addrs: WicketdAddrs) -> Runner { let (events_tx, events_rx) = unbounded_channel(); let tokio_rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .unwrap(); - let (wicketd, wicketd_manager) = WicketdManager::new( - &log, - events_tx.clone(), - wicketd_addr, - commission_addr, - ); + let (wicketd, wicketd_manager) = + WicketdManager::new(&log, events_tx.clone(), addrs); let core = RunnerCore::new(log); Runner { core, diff --git a/wicket/src/wicketd.rs b/wicket/src/wicketd.rs index 2a020b4536b..6540e9420de 100644 --- a/wicket/src/wicketd.rs +++ b/wicket/src/wicketd.rs @@ -25,6 +25,15 @@ use crate::keymap::ShowPopupCmd; use crate::state::ComponentId; use crate::{Cmd, Event}; +/// The addresses of the wicketd server. +#[derive(Clone, Copy, Debug)] +pub struct WicketdAddrs { + /// The address of the lockstep wicketd API. + pub wicketd: SocketAddrV6, + /// The address of the stable commission API. + pub commission: SocketAddrV6, +} + impl From for SpIdentifier { fn from(id: ComponentId) -> Self { match id { @@ -78,27 +87,19 @@ pub struct WicketdManager { log: Logger, rx: mpsc::Receiver, events_tx: UnboundedSender, - wicketd_addr: SocketAddrV6, - commission_addr: SocketAddrV6, + addrs: WicketdAddrs, } impl WicketdManager { pub fn new( log: &Logger, events_tx: UnboundedSender, - wicketd_addr: SocketAddrV6, - commission_addr: SocketAddrV6, + addrs: WicketdAddrs, ) -> (WicketdHandle, WicketdManager) { let log = log.new(o!("component" => "WicketdManager")); let (tx, rx) = tokio::sync::mpsc::channel(CHANNEL_CAPACITY); let handle = WicketdHandle { tx }; - let manager = WicketdManager { - log, - rx, - events_tx, - wicketd_addr, - commission_addr, - }; + let manager = WicketdManager { log, rx, events_tx, addrs }; (handle, manager) } @@ -164,7 +165,7 @@ impl WicketdManager { options: StartUpdateOptions, ) { let log = self.log.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; let events_tx = self.events_tx.clone(); tokio::spawn(async move { let update_client = @@ -197,7 +198,7 @@ impl WicketdManager { options: AbortUpdateOptions, ) { let log = self.log.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; let events_tx = self.events_tx.clone(); tokio::spawn(async move { let update_client = @@ -229,7 +230,7 @@ impl WicketdManager { options: ClearUpdateStateOptions, ) { let log = self.log.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; let events_tx = self.events_tx.clone(); tokio::spawn(async move { let update_client = @@ -266,7 +267,7 @@ impl WicketdManager { poll_inventory_now: mpsc::Sender, ) { let log = self.log.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; tokio::spawn(async move { let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT); let sp: SpIdentifier = component_id.into(); @@ -290,7 +291,7 @@ impl WicketdManager { fn start_rack_initialization(&self) { let log = self.log.clone(); - let addr = self.commission_addr; + let addr = self.addrs.commission; let events_tx = self.events_tx.clone(); tokio::spawn(async move { let client = create_commission_client(&log, addr, WICKETD_TIMEOUT); @@ -309,7 +310,7 @@ impl WicketdManager { fn poll_rack_setup_status(&self) { let log = self.log.clone(); let tx = self.events_tx.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; tokio::spawn(async move { let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT); let mut ticker = interval(WICKETD_POLL_INTERVAL * 2); @@ -335,7 +336,7 @@ impl WicketdManager { fn poll_location(&self) { let log = self.log.clone(); let tx = self.events_tx.clone(); - let addr = self.commission_addr; + let addr = self.addrs.commission; tokio::spawn(async move { let client = create_commission_client(&log, addr, WICKETD_TIMEOUT); let mut ticker = interval(WICKETD_POLL_INTERVAL * 2); @@ -393,7 +394,7 @@ impl WicketdManager { fn poll_rack_setup_config(&self) { let log = self.log.clone(); let tx = self.events_tx.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; tokio::spawn(async move { let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT); let mut ticker = interval(WICKETD_POLL_INTERVAL * 2); @@ -426,7 +427,7 @@ impl WicketdManager { fn poll_artifacts_and_event_reports(&self) { let log = self.log.clone(); let tx = self.events_tx.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; tokio::spawn(async move { let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT); let mut ticker = interval(WICKETD_POLL_INTERVAL * 2); @@ -455,7 +456,7 @@ impl WicketdManager { fn poll_inventory(&self, mut poll_now: mpsc::Receiver) { let log = self.log.clone(); let tx = self.events_tx.clone(); - let addr = self.wicketd_addr; + let addr = self.addrs.wicketd; tokio::spawn(async move { let client = create_wicketd_client(&log, addr, WICKETD_TIMEOUT);