Skip to content

Commit 50cd41c

Browse files
authored
Read rack_subnet from RSS handoff request instead of the bootstore (#5684)
Fixes #5680.
1 parent e810f2e commit 50cd41c

File tree

2 files changed

+6
-47
lines changed

2 files changed

+6
-47
lines changed

nexus/src/app/mod.rs

-12
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,6 @@ impl Nexus {
441441

442442
// TODO-cleanup all the extra Arcs here seems wrong
443443
let nexus = Arc::new(nexus);
444-
let bootstore_opctx = OpContext::for_background(
445-
log.new(o!("component" => "Bootstore")),
446-
Arc::clone(&authz),
447-
authn::Context::internal_api(),
448-
Arc::clone(&db_datastore),
449-
);
450444
let opctx = OpContext::for_background(
451445
log.new(o!("component" => "SagaRecoverer")),
452446
Arc::clone(&authz),
@@ -486,12 +480,6 @@ impl Nexus {
486480
for task in task_nexus.background_tasks.driver.tasks() {
487481
task_nexus.background_tasks.driver.activate(task);
488482
}
489-
if let Err(e) = task_nexus
490-
.initial_bootstore_sync(&bootstore_opctx)
491-
.await
492-
{
493-
error!(task_log, "failed to run bootstore sync: {e}");
494-
}
495483
}
496484
Err(_) => {
497485
error!(task_log, "populate failed");

nexus/src/app/rack.rs

+6-35
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ impl super::Nexus {
254254

255255
let rack_network_config = &request.rack_network_config;
256256

257+
// The `rack` row is created with the rack ID we know when Nexus starts,
258+
// but we didn't know the rack subnet until now. Set it.
259+
let mut rack = self.rack_lookup(opctx, &self.rack_id).await?;
260+
rack.rack_subnet = Some(rack_network_config.rack_subnet.into());
261+
self.datastore().update_rack_subnet(opctx, &rack).await?;
262+
257263
// TODO - https://github.com/oxidecomputer/omicron/pull/3359
258264
// register all switches found during rack initialization
259265
// identify requested switch from config and associate
@@ -612,8 +618,6 @@ impl super::Nexus {
612618
} // TODO - https://github.com/oxidecomputer/omicron/issues/3277
613619
// record port speed
614620

615-
self.initial_bootstore_sync(&opctx).await?;
616-
617621
self.db_datastore
618622
.rack_set_initialized(
619623
opctx,
@@ -689,31 +693,6 @@ impl super::Nexus {
689693
}
690694
}
691695

692-
pub(crate) async fn initial_bootstore_sync(
693-
&self,
694-
opctx: &OpContext,
695-
) -> Result<(), Error> {
696-
let mut rack = self.rack_lookup(opctx, &self.rack_id).await?;
697-
if rack.rack_subnet.is_some() {
698-
return Ok(());
699-
}
700-
let sa = self.get_any_sled_agent_client(opctx).await?;
701-
let result = sa
702-
.read_network_bootstore_config_cache()
703-
.await
704-
.map_err(|e| Error::InternalError {
705-
internal_message: format!("read bootstore network config: {e}"),
706-
})?
707-
.into_inner();
708-
709-
rack.rack_subnet =
710-
result.body.rack_network_config.map(|x| x.rack_subnet.into());
711-
712-
self.datastore().update_rack_subnet(opctx, &rack).await?;
713-
714-
Ok(())
715-
}
716-
717696
/// Return the list of sleds that are inserted into an initialized rack
718697
/// but not yet initialized as part of a rack.
719698
//
@@ -885,14 +864,6 @@ impl super::Nexus {
885864
.address();
886865
Ok(format!("http://{}", addr))
887866
}
888-
889-
async fn get_any_sled_agent_client(
890-
&self,
891-
opctx: &OpContext,
892-
) -> Result<sled_agent_client::Client, Error> {
893-
let url = self.get_any_sled_agent_url(opctx).await?;
894-
Ok(sled_agent_client::Client::new(&url, self.log.clone()))
895-
}
896867
}
897868

898869
pub fn rack_subnet(

0 commit comments

Comments
 (0)