Skip to content

Add sled-agent API for managing attached subnets - #9778

Merged
bnaecker merged 7 commits into
mainfrom
sled-agent-attached-subnet-api
Feb 4, 2026
Merged

bnaecker merged 7 commits into
mainfrom
sled-agent-attached-subnet-api

Conversation

@bnaecker

@bnaecker bnaecker commented Feb 3, 2026

Copy link
Copy Markdown
Collaborator
  • Add APIs to the sled agent for attaching and detaching either a single subnet on an instance, or setting / clearing the entire set for an instance.
  • Add list of attached subnets in the instance-creation request body, and fill that in from Nexus with the (currently-empty) set of attached subnets for the target instnace.
  • Plumb attachment requests all the way through the sled-agent internals to the new APIs in OPTE.
  • Add mapping of attached subnets per-instance to the simulated sled agent for testing.
  • Fixes Add sled-agent API for attached external subnets #9702

- Add APIs to the sled agent for attaching and detaching either a single
  subnet on an instance, or setting / clearing the entire set for an
  instance.
- Add list of attached subnets in the instance-creation request body,
  and fill that in from Nexus with the (currently-empty) set of attached
  subnets for the target instnace.
- Plumb attachment requests all the way through the sled-agent internals
  to the new APIs in OPTE.
- Add mapping of attached subnets per-instance to the simulated sled
  agent for testing.
- Fixes #9702
Comment thread common/src/api/internal/shared/mod.rs Resolved
Comment thread sled-agent/src/instance.rs Resolved
Comment thread common/src/api/internal/shared/mod.rs Resolved
Comment thread illumos-utils/src/opte/port_manager.rs Resolved
Comment thread sled-agent/src/instance.rs Resolved
Comment thread sled-agent/src/instance.rs Resolved

@FelixMcFelix FelixMcFelix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this Ben, the impl makes sense to me reading through. Just some nits in addition to the existing comments.

Comment thread sled-agent/src/instance.rs Resolved
Comment thread sled-agent/src/instance.rs Resolved
- Update instance's view of attached subnets based on what actually gets
  applied in OPTE.
- Enum to describe attached subnet kind, instead of boolean.
- Inline error chain, contains_key over get, and a few other minor fixes
Comment thread sled-agent/src/instance.rs Resolved
@bnaecker
bnaecker merged commit 16c22eb into main Feb 4, 2026
17 checks passed
@bnaecker
bnaecker deleted the sled-agent-attached-subnet-api branch February 4, 2026 17:24
sunshowers added a commit that referenced this pull request Oct 22, 2026
When a VMM is registered in Sled Agent, the instance's attached subnets
are sent in the `InstanceSledLocalConfig`. Previously (since #9778), we
discarded them in Sled Agent and created the VMM's OPTE ports with no
attached subnets. This meant that any traffic to and from the subnets
was dropped at the OPTE port.

This bug occurs on every VMM registration for an instance with attached
subnets -- certainly starts and restarts, but also (once they are
implemented) live migrations.

The good news is that the buggy situation doesn't last very long,
because the correct state is fully restored by the
`attached_subnet_manager` background task, which is run every 60 seconds
by every Nexus instance. Hooray for reconciliation loops, I guess?

Of course, we should fix the bug. Do this by building the VMM's attached
subnets from the registration requests. If a caller lists the same
subnet more than once, we reject the registration with a 400. (In a
subsequent commit, we'll add a new Sled Agent API version which
expresses this constraint in the type system.)

This bug was introduced in #9778, which shipped in v18.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sled-agent API for attached external subnets

4 participants