Skip to content

Commit

Permalink
propolis-server should use reservoir on prod gear
Browse files Browse the repository at this point in the history
Add "omicron-build" feature to propolis-server which compiles out the
developer-friendly vmm-reservoir check, opting to use the reservoir
unconditionally on the assumption that Oxide machines will be
appropriately configured for such duty.

Fix #408
  • Loading branch information
pfmooney committed May 18, 2023
1 parent b14db9c commit 5ed3c84
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
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 @@ -50,7 +50,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 @@ -68,8 +68,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

0 comments on commit 5ed3c84

Please sign in to comment.