Skip to content

Commit

Permalink
Read rack_subnet from RSS handoff request instead of the bootstore (#…
Browse files Browse the repository at this point in the history
…5684)

Fixes #5680.
  • Loading branch information
jgallagher committed May 2, 2024
1 parent e810f2e commit 50cd41c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 47 deletions.
12 changes: 0 additions & 12 deletions nexus/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,6 @@ impl Nexus {

// TODO-cleanup all the extra Arcs here seems wrong
let nexus = Arc::new(nexus);
let bootstore_opctx = OpContext::for_background(
log.new(o!("component" => "Bootstore")),
Arc::clone(&authz),
authn::Context::internal_api(),
Arc::clone(&db_datastore),
);
let opctx = OpContext::for_background(
log.new(o!("component" => "SagaRecoverer")),
Arc::clone(&authz),
Expand Down Expand Up @@ -486,12 +480,6 @@ impl Nexus {
for task in task_nexus.background_tasks.driver.tasks() {
task_nexus.background_tasks.driver.activate(task);
}
if let Err(e) = task_nexus
.initial_bootstore_sync(&bootstore_opctx)
.await
{
error!(task_log, "failed to run bootstore sync: {e}");
}
}
Err(_) => {
error!(task_log, "populate failed");
Expand Down
41 changes: 6 additions & 35 deletions nexus/src/app/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ impl super::Nexus {

let rack_network_config = &request.rack_network_config;

// The `rack` row is created with the rack ID we know when Nexus starts,
// but we didn't know the rack subnet until now. Set it.
let mut rack = self.rack_lookup(opctx, &self.rack_id).await?;
rack.rack_subnet = Some(rack_network_config.rack_subnet.into());
self.datastore().update_rack_subnet(opctx, &rack).await?;

// TODO - https://github.com/oxidecomputer/omicron/pull/3359
// register all switches found during rack initialization
// identify requested switch from config and associate
Expand Down Expand Up @@ -612,8 +618,6 @@ impl super::Nexus {
} // TODO - https://github.com/oxidecomputer/omicron/issues/3277
// record port speed

self.initial_bootstore_sync(&opctx).await?;

self.db_datastore
.rack_set_initialized(
opctx,
Expand Down Expand Up @@ -689,31 +693,6 @@ impl super::Nexus {
}
}

pub(crate) async fn initial_bootstore_sync(
&self,
opctx: &OpContext,
) -> Result<(), Error> {
let mut rack = self.rack_lookup(opctx, &self.rack_id).await?;
if rack.rack_subnet.is_some() {
return Ok(());
}
let sa = self.get_any_sled_agent_client(opctx).await?;
let result = sa
.read_network_bootstore_config_cache()
.await
.map_err(|e| Error::InternalError {
internal_message: format!("read bootstore network config: {e}"),
})?
.into_inner();

rack.rack_subnet =
result.body.rack_network_config.map(|x| x.rack_subnet.into());

self.datastore().update_rack_subnet(opctx, &rack).await?;

Ok(())
}

/// Return the list of sleds that are inserted into an initialized rack
/// but not yet initialized as part of a rack.
//
Expand Down Expand Up @@ -885,14 +864,6 @@ impl super::Nexus {
.address();
Ok(format!("http://{}", addr))
}

async fn get_any_sled_agent_client(
&self,
opctx: &OpContext,
) -> Result<sled_agent_client::Client, Error> {
let url = self.get_any_sled_agent_url(opctx).await?;
Ok(sled_agent_client::Client::new(&url, self.log.clone()))
}
}

pub fn rack_subnet(
Expand Down

0 comments on commit 50cd41c

Please sign in to comment.