Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly use the alloc op context for dpd nat updates #4654

Merged
merged 6 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions nexus/src/app/instance_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,6 @@ impl super::Nexus {
.instance_lookup_external_ips(opctx, instance_id)
.await?;

let boundary_switches = self.boundary_switches(opctx).await?;

let mut errors = vec![];
for entry in external_ips {
// Soft delete the NAT entry
Expand All @@ -478,6 +476,9 @@ impl super::Nexus {
}?;
}

let boundary_switches =
self.boundary_switches(&self.opctx_alloc).await?;

for switch in &boundary_switches {
debug!(&self.log, "notifying dendrite of updates";
"instance_id" => %authz_instance.id(),
Expand Down
24 changes: 24 additions & 0 deletions nexus/tests/integration_tests/instances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3911,6 +3911,30 @@ async fn test_instance_create_in_silo(cptestctx: &ControlPlaneTestContext) {
instance_simulate_with_opctx(nexus, &instance.identity.id, &opctx).await;
let instance = instance_get_as(&client, &instance_url, authn).await;
assert_eq!(instance.runtime.run_state, InstanceState::Running);

// Stop the instance
NexusRequest::new(
RequestBuilder::new(
client,
Method::POST,
&format!("/v1/instances/{}/stop", instance.identity.id),
)
.body(None as Option<&serde_json::Value>)
.expect_status(Some(StatusCode::ACCEPTED)),
)
.authn_as(AuthnMode::SiloUser(user_id))
.execute()
.await
.expect("Failed to stop the instance");

instance_simulate_with_opctx(nexus, &instance.identity.id, &opctx).await;

// Delete the instance
NexusRequest::object_delete(client, &instance_url)
.authn_as(AuthnMode::SiloUser(user_id))
.execute()
.await
.expect("Failed to delete the instance");
}

/// Test that appropriate OPTE V2P mappings are created and deleted.
Expand Down
Loading