Skip to content

Commit

Permalink
Reconfigurator: Record external networking allocations when realizing…
Browse files Browse the repository at this point in the history
… a blueprint (#5045)

This PR expands blueprint execution to record external IPs and created
NICs for Nexus, Boundary NTP, and External DNS in crdb _before_ sending
new zone requests to sled-agents.

The implementation has a very obvious TOCTOU race, but I think it's okay
(as explained in the comments inline). If two Nexuses try to realize the
same blueprint simultaneously and both see no records present, only one
will succeed to insert, and the other will spuriously fail. Assuming
that failure causes a retry, subsequent attempts to realize the same
blueprint will succeed, as the required records will be present. If this
seems wrong, please holler!

I'd like to give this a spin on either madrid or one of the software
testbeds before merging, but I think this is ready for review.
  • Loading branch information
jgallagher authored Feb 21, 2024
1 parent 6993b41 commit 55ef8da
Show file tree
Hide file tree
Showing 7 changed files with 1,140 additions and 13 deletions.
13 changes: 11 additions & 2 deletions nexus/blueprint-execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use uuid::Uuid;

mod dns;
mod omicron_zones;
mod resource_allocation;

struct Sled {
id: Uuid,
Expand Down Expand Up @@ -69,6 +70,14 @@ where
"blueprint_id" => ?blueprint.id
);

resource_allocation::ensure_zone_resources_allocated(
&opctx,
datastore,
&blueprint.omicron_zones,
)
.await
.map_err(|err| vec![err])?;

let sleds_by_id: BTreeMap<Uuid, _> = datastore
.sled_list_all_batched(&opctx)
.await
Expand All @@ -82,9 +91,9 @@ where

dns::deploy_dns(
&opctx,
&datastore,
datastore,
String::from(nexus_label),
&blueprint,
blueprint,
&sleds_by_id,
)
.await
Expand Down
Loading

0 comments on commit 55ef8da

Please sign in to comment.