Skip to content
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

propolis-server should use reservoir on prod gear #410

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/buildomat/jobs/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ cargo --version
rustc --version

banner build
ptime -m cargo build --release --verbose -p propolis-server

# Enable the "omicron-build" feature to indicate this is an artifact destined
# for production use on an appropriately configured Oxide machine
ptime -m cargo build --release --verbose -p propolis-server --features omicron-build

banner image
ptime -m cargo run -p propolis-package
Expand Down
13 changes: 10 additions & 3 deletions bin/propolis-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ slog-async.workspace = true
slog-bunyan.workspace = true
slog-dtrace.workspace = true
slog-term.workspace = true
propolis.workspace = true
propolis = { workspace = true, features = ["crucible-full", "oximeter"] }
propolis-client = { workspace = true, features = ["generated"] }
propolis-server-config.workspace = true
rfb.workspace = true
Expand All @@ -71,8 +71,15 @@ expectorate.workspace = true
mockall.workspace = true

[features]
default = ["propolis/crucible-full", "propolis/oximeter"]
falcon = ["propolis/falcon", "propolis-client/falcon"]
default = []

# When building to be packaged for inclusion in the production ramdisk
# (nominally an Omicron package), certain code is compiled in or out.
omicron-build = []

# If selected, only build a mock server which does not actually spawn instances
# (i.e. to test with a facsimile of the API on unsupported platforms)
mock-only = []

# Falcon builds require corresponding bits turned on in the dependency libs
falcon = ["propolis/falcon", "propolis-client/falcon"]
14 changes: 11 additions & 3 deletions bin/propolis-server/src/lib/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ fn blockdev_backend(
}
}

// Automatically enable use of the memory reservoir (rather than transient
// allocations) for guest memory if it meets some arbitrary size threshold.
const RESERVOIR_THRESH_MB: usize = 512;
#[cfg(not(feature = "omicron-build"))]
pub fn reservoir_decide(log: &slog::Logger) -> bool {
// Automatically enable use of the memory reservoir (rather than transient
// allocations) for guest memory if it meets some arbitrary size threshold.
const RESERVOIR_THRESH_MB: usize = 512;

match propolis::vmm::query_reservoir() {
Err(e) => {
slog::error!(log, "could not query reservoir {:?}", e);
Expand All @@ -94,3 +96,9 @@ pub fn reservoir_decide(log: &slog::Logger) -> bool {
}
}
}

#[cfg(feature = "omicron-build")]
pub fn reservoir_decide(_log: &slog::Logger) -> bool {
// Always use the reservoir in production
true
}
4 changes: 4 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ fn cmd_clippy(strict: bool) -> Result<()> {
// Everything in the workspace (including tests, etc)
failed |= run_clippy(&["--workspace", "--all-targets"])?;

// Check the server as it is built for production
failed |=
run_clippy(&["-p", "propolis-server", "--features", "omicron-build"])?;

// Check the Falcon bits
failed |= run_clippy(&["-p", "propolis-server", "--features", "falcon"])?;

Expand Down
Loading