Skip to content

Commit

Permalink
Use opctx_alloc in start saga to query boundary switches
Browse files Browse the repository at this point in the history
Finding boundary switches requires fleet access; use the special instance-
allocation context to do this (this context was already used for sled lookups
earlier in the relevant saga step).

This wasn't previously a problem because the instance create saga was
responsible for configuring NAT configuration, and it received a boundary switch
list as a saga parameter, which list was also provided by querying using the
instance allocation context.
  • Loading branch information
gjcolombo committed Oct 12, 2023
1 parent 7e88bdf commit 0f093de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nexus/src/app/sagas/instance_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,20 @@ async fn sis_dpd_ensure(
);
let datastore = osagactx.datastore();

// Querying sleds requires fleet access; use the instance allocator context
// for this.
let sled_uuid = sagactx.lookup::<Uuid>("sled_id")?;
let (.., sled) = LookupPath::new(&osagactx.nexus().opctx_alloc, &datastore)
.sled_id(sled_uuid)
.fetch()
.await
.map_err(ActionError::action_failed)?;

// Querying boundary switches also requires fleet access and the use of the
// instance allocator context.
let boundary_switches = osagactx
.nexus()
.boundary_switches(&opctx)
.boundary_switches(&osagactx.nexus().opctx_alloc)
.await
.map_err(ActionError::action_failed)?;

Expand Down

0 comments on commit 0f093de

Please sign in to comment.