Rip InstanceRuntimeState
out of the internal API
#6556
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
omicron_common::api::internal::InstanceRuntimeState
type was oncea key component of how Nexus and sled-agents communicated about
instances. Now, however, it's outlived its usefulness: #5749 changed
Nexus'
cpapi_instances_put
and sled-agent'sinstance_get
APIs tooperate exclusively on
VmmRuntimeState
s rather thanInstanceRuntimeState
, with the sled-agent almost completely unaware ofInstanceRuntimeState
.At present, the
InstanceRuntimeState
type remains in the internal APIjust because it's used in the
InstanceEnsureBody
type, which is sentto sled-agent's
instance_ensure_registered
API when a new VMM isregistered. However, looking at the code that
instance_ensure_registered
calls into in sled-agent, we see that theonly thing from the
InstanceRuntimeState
that the sled-agent actuallyuses is the migration ID of the current migration (if the instance is
migrating in). Soooo...we can just replace the whole
InstanceRuntimeState
there with amigration_id: Option<Uuid>
. Oncethat's done, there are now no longer any internal APIs in Nexus or in
sled-agent that actually use
InstanceRuntimeState
, so the type can beremoved from the internal API entirely. All of the code in Nexus that
deals with instance runtime states already has changed to operate
exclusively on the
nexus_db_model
version of the struct, so removingthe API type is actually quite straightforward.
In addition, I've refactored the sled-agent
instance_ensure_registered
code paths a little bit to pass around the
InstanceEnsureBody
, ratherthan unpacking its fields at the HTTP entrypoint and then passing them
all through the chain of method calls that actually gets it to the
instance-runner task. Just passing the struct around means we can remove
a bunch of
#[allow(clippy::too_many_arguments)]
attributes. It alsomakes changing the contents of the instance-ensure payload a bit easier,
as we'll no longer need to change the arguments list in the whole maze
of tiny little functions, all alike, that pass around all the pieces of
the
InstanceEnsureBody
.