-
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
Conversation
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.
Thanks for the PR! This is definitely what I was thinking for this configuration. It sounds like you were able to get some testing laps in, but let me know if you need a hand at all there.
sled-agent/src/sled_agent.rs
Outdated
"cannot specify vmm_reservoir_percentage and \ | ||
vmm_reservoir_size_mb at the same time" |
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.
nit: I would probably phrase this as: "only one of vmm_reservoir_percentage
and vmm_reservoir_size_mb
is allowed" or something similar (instead of referring to the "same time")
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.
Fixed in 23a25d6
Some(sz) => { | ||
panic!("invalid requested VMM reservoir percentage: {}", sz); |
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!
sled-agent/src/config.rs
Outdated
@@ -51,6 +51,9 @@ pub struct Config { | |||
pub sidecar_revision: SidecarRevision, | |||
/// Optional percentage of DRAM to reserve for guest memory | |||
pub vmm_reservoir_percentage: Option<u8>, | |||
/// Optional DRAM to reserve for guest memory in MiB (cannot be used with |
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.
nit: maybe "mutually exclusive option with vmm_reservoir_percentage
"
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.
Fixed in 23a25d6
sled-agent/src/instance_manager.rs
Outdated
ReservoirMode::Percentage(percent) => { | ||
if !matches!(percent, 1..=99) { | ||
return Err(Error::ReservoirConfig(format!( | ||
"reservoir percentage of {} must be between 0 and 100", |
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.
nit: "VMM reservoir" to be extra clear
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.
Fixed in 23a25d6
_ => { | ||
instances | ||
.set_reservoir_size(&hardware, reservoir_mode) | ||
.map_err(|e| { |
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.
It would be nice to use the tap
crate for situations like this: tap_err()
At some point it would be nice to mock Testing this change. I made sure sled-agent came up fully on the first start:
Reservoir using
|
Re-running the failed test because we hit:
|
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.
ship it!
A potential fix for #3874
This also removes some of the asserts and panics in favor or returning errors directly.
I tested this on a physical box running helios by:
rsrvrctl -q
that things looked correctrsrvrctl -q
that the reservoir was set to 2 GiB.(Note I ran
rsrvrctl -s 0
between tests.Would appreciate if you could take a look @jordanhendricks to see if it's what you had in mind.