Skip to content

Conversation

@gjcolombo
Copy link
Contributor

PHD uses the propolis-server instance_spec_ensure endpoint when creating VMs. This maximizes the framework's control over what virtual devices and backends get created and its knowledge of how devices should manifest to guests.

When sled agent creates a VM, it uses the instance_ensure endpoint, which takes an InstanceEnsureRequest that specifies components at a slightly higher level of abstraction than instance_spec_ensure. The server handles calls to the former endpoint by shimming the InstanceEnsureRequest into an instance spec and then pretending the caller called instance_spec_ensure. The shim is relatively straightforward, but because PHD doesn't use it (and as #750 shows) it can be a great place for bugs to hide...

Although the medium-term plan is to try to switch sled agent over to using the spec endpoint (see RFD 505), for now add an affordance to PHD to allow it to use the instance_ensure endpoint if a test requests it.

Tested by running the new test against master before and after #751 merged and verifying that the test fails without that change and passes with it.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Overall, this looks good to me! I think there's an easier way out that doesn't require doing the whole type erasure dance, though.

Comment on lines 337 to 346
let send_fut: Pin<
Box<
dyn Future<
Output = Result<
ResponseValue<InstanceEnsureResponse>,
_,
>,
> + Send,
>,
> = match api {
Copy link
Member

Choose a reason for hiding this comment

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

you love to see it!

@gjcolombo gjcolombo merged commit bae86d1 into master Aug 28, 2024
@gjcolombo gjcolombo deleted the gjcolombo/phd-instance-ensure-no-spec branch August 28, 2024 23:06
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.

3 participants