Skip to content

Commit

Permalink
Unduplicate calls to ensure_nat_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMcFelix committed Jan 10, 2024
1 parent 774c183 commit f1cd2b1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions nexus/src/app/instance_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ impl super::Nexus {
let boundary_switches =
self.boundary_switches(&self.opctx_alloc).await?;

for external_ip in ips_of_interest {
// For each external ip, add a nat entry to the database
self.ensure_nat_entry(
external_ip,
sled_address,
&network_interface,
mac_address,
opctx,
)
.await?;
}

for switch in &boundary_switches {
debug!(&self.log, "notifying dendrite of updates";
"instance_id" => %authz_instance.id(),
Expand All @@ -389,18 +401,6 @@ impl super::Nexus {
))
})?;

for external_ip in ips_of_interest {
// For each external ip, add a nat entry to the database
self.ensure_nat_entry(
external_ip,
sled_address,
&network_interface,
mac_address,
opctx,
)
.await?;
}

// Notify dendrite that there are changes for it to reconcile.
// In the event of a failure to notify dendrite, we'll log an error
// and rely on dendrite's RPW timer to catch it up.
Expand Down

0 comments on commit f1cd2b1

Please sign in to comment.