-
Notifications
You must be signed in to change notification settings - Fork 40
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
Configuring the VMM reservoir for dev setups could be easier. #4137
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
31d9283
Configuring the VMM reservoir for dev setups could be easier.
papertigers 1e1c209
Merge remote-tracking branch 'origin/main' into reservoir
papertigers 23a25d6
Address Jordan's feedback
papertigers 40cb812
Merge remote-tracking branch 'origin/main' into reservoir
papertigers 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ use crate::bootstrap::early_networking::{ | |
}; | ||
use crate::bootstrap::params::StartSledAgentRequest; | ||
use crate::config::Config; | ||
use crate::instance_manager::InstanceManager; | ||
use crate::instance_manager::{InstanceManager, ReservoirMode}; | ||
use crate::metrics::MetricsManager; | ||
use crate::nexus::{NexusClientWithResolver, NexusRequestQueue}; | ||
use crate::params::{ | ||
|
@@ -387,21 +387,33 @@ impl SledAgent { | |
storage.zone_bundler().clone(), | ||
)?; | ||
|
||
match config.vmm_reservoir_percentage { | ||
Some(sz) if sz > 0 && sz < 100 => { | ||
instances.set_reservoir_size(&hardware, sz).map_err(|e| { | ||
error!(log, "Failed to set VMM reservoir size: {e}"); | ||
e | ||
})?; | ||
} | ||
Some(0) => { | ||
warn!(log, "Not using VMM reservoir (size 0 bytes requested)"); | ||
} | ||
None => { | ||
warn!(log, "Not using VMM reservoir"); | ||
// Configure the VMM reservoir as either a percentage of DRAM or as an | ||
// exact size in MiB. | ||
let reservoir_mode = match ( | ||
config.vmm_reservoir_percentage, | ||
config.vmm_reservoir_size_mb, | ||
) { | ||
(None, None) => ReservoirMode::None, | ||
(Some(p), None) => ReservoirMode::Percentage(p), | ||
(None, Some(mb)) => ReservoirMode::Size(mb), | ||
(Some(_), Some(_)) => panic!( | ||
"only one of vmm_reservoir_percentage and \ | ||
vmm_reservoir_size_mb is allowed" | ||
), | ||
}; | ||
|
||
match reservoir_mode { | ||
ReservoirMode::None => warn!(log, "Not using VMM reservoir"), | ||
ReservoirMode::Size(0) | ReservoirMode::Percentage(0) => { | ||
warn!(log, "Not using VMM reservoir (size 0 bytes requested)") | ||
} | ||
Some(sz) => { | ||
panic!("invalid requested VMM reservoir percentage: {}", sz); | ||
_ => { | ||
instances | ||
.set_reservoir_size(&hardware, reservoir_mode) | ||
.map_err(|e| { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to use the |
||
error!(log, "Failed to setup VMM reservoir: {e}"); | ||
e | ||
})?; | ||
} | ||
} | ||
|
||
|
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.
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.
This check was here to verify that the agent would panic if it was configured with a percentage > 100. It looks like this got moved into an error into the callee, which I think is fine, but it would be good to put testing bad values in the config in some testing notes for the PR.
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 looked to see if there was a test that mocked some of this so that I could pass some values to the function but it doesn't look like such a setup exists. Maybe we can use this as an excuse to jump on a bench gimlet and test this together?
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.
yeah, there's no unit test for that behavior. When I merged this PR initially, I just tested it ad hoc (since it's a pretty straightforward thing to test, and only matters for startup of the agent).
but yes, let's do that!