-
Notifications
You must be signed in to change notification settings - Fork 39
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
Setup the VMM reservoir in a background task #5124
Merged
Merged
Changes from 4 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1d0ed8c
Setup the VMM reservoir in a background task
andrewjstone bbbe079
comments
andrewjstone bdea2f6
review fixes
andrewjstone 710b0ce
Wait for VMM reservoir allocation when ensuring propolis instances
andrewjstone 233f2d1
Revert "Wait for VMM reservoir allocation when ensuring propolis inst…
andrewjstone bedf0c1
remove watch from vmm_reservoir
andrewjstone 7bdf2e3
Add sled_agent_get to nexus internal API
andrewjstone 7c4a2de
wip
andrewjstone 58a84fa
wip
andrewjstone f6116b6
wip
andrewjstone cf185cf
wip
andrewjstone 7dbcedc
wip
andrewjstone 7429a8d
wip
andrewjstone c6a396c
wip
andrewjstone 32cd05b
wip
andrewjstone e7ce5af
wip
andrewjstone 00d248e
wip
andrewjstone adc29dc
Solid test for sled-agent
andrewjstone 3418a60
Make sled upserts conditional on rcgen
andrewjstone 0488749
extra rcgen check
andrewjstone 8a7d297
plumb through reservoir size changes
andrewjstone f379afb
typo
andrewjstone 9c130e2
Merge branch 'main' into ajs/vmm-reservoir-bg-thread
andrewjstone f49208e
Return an result for sled upserts, with error for decommissioned
andrewjstone 5b1914b
fix warnings
andrewjstone e5795c9
clippy
andrewjstone 8d1ae0c
Merge branch 'main' into ajs/vmm-reservoir-bg-thread
andrewjstone 0f904f4
Give sled-agent its own generation number
andrewjstone 4fd1afd
review fixes
andrewjstone edbf0a0
Merge branch 'main' into ajs/vmm-reservoir-bg-thread
andrewjstone 5b01ef0
Handle sled decommissioning
andrewjstone 332832e
Merge branch 'main' into ajs/vmm-reservoir-bg-thread
andrewjstone e9167a8
type fix for Baseboard
andrewjstone c611a81
COMMENTS
andrewjstone 9027e5b
Merge branch 'main' into ajs/vmm-reservoir-bg-thread
andrewjstone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little concerned by this, since it feels kinda like a partial solution? Yes, this would be correct if we only provisioned a single VM on this sled, but that case seems unlikely to me.
Should we just wait for the entire reservoir to be "provisioned according to what Nexus expects", for now?
Example with this "wait for single VM's worth of RAM" case that I think would be bad
In this case: we over-provision the sled! The VMs might misbehave, since they're operating with a reservoir that doesn't have enough space.
If we're concerned about Nexus being able to successfully provision instances to sleds quickly -- this can still fail! From a user's perspective, this would look like "I tried to start a VM, Nexus thought it was ready, the sled said no, so my allocation failed". So it's kinda a roll of the dice on "does my request fail because nexus was too eager", or "does my request succeed but violate system variants because sled agent is too eager".
Alternatives?
There seem like a few other options here that avoid this issue, but they have other tradeoffs.
Option 1: The Instance Manager refuses to provision VMs until the reservoir is "at least the size that Nexus expected it to be". This means that we'd never overprovision, but we would make it more likely for instance ensure requests to fail during boot. This could be mitigated in a few ways - blocking the instance provision request until the reservoir is sized, using HTTP error codes and a retry loop during Nexus instance provision saga, etc.
Option 2: The "Instance Manager" part of Sled Agent refuses to be online until it gets this sizing information from Nexus, and as a part of that handshake, Nexus updates how it perceives the Sled. The interaction could look like:
There are certainly other options in this space too. But I think that we should be very careful to avoid overprovisioning, even in boot-only edge cases, if that's a system property we claim to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I treated this check as a proxy for the entire reservoir being ready. The reservoir doesn't report getting partially filled right now and the size only gets set once at RSS time. However, I fully agree with what you said that this is only a partial solution and Nexus can increase the reservoir size. The old size may still be big enough for each individual new instance, but not big enough for all instances intended to run on the sled. Your option 1, would fix this immediate overprovisioning problem. This is also the reason I proposed splitting the current reservoir allocation into "what Nexus wants the next reservation to be" and "what the sled-agent tells it it has allocated". If the real change in size hasn't reached Nexus yet, then nexus won't provision any extra VMs. Nexus will always know how much total space it has and what it's capable of provisioning. This is similar to your option 2.
Unfortunately, the above solution that splits between desired and actual states of the reservoir doesn't work when a sled is rebooted, as reservoir allocation may fail on the reboot and nexus will not know about it until after it tries to allocate a VM and it fails because the reservoir hasn't been allocated. I think this is also a problem with Option 2, as there is a TOCTOU where the sled-agent can say "hey I'm ready", and then crash and restart and fail allocation. All in all, I think I prefer option 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I don't think sled agent will end up overprovisioning memory for VMs if an instance start request arrives while the reservoir is smaller than Nexus expects: if I understand bhyve's behavior correctly, attempting to start a VM with insufficient memory in the reservoir will fail outright and won't use any non-reservoir memory. The instance has still failed to start, of course, and we have to decide how to deal with that, but I don't think the change as written will overcommit sled memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, okay, that's good to know! The problem still exists in the form of "will this instance provisioning request fail in a visible way for a client", but that's good that we wouldn't end up violating that constraint either way.