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

Update Rust crate dropshot to 0.16.0 #1645

Merged
merged 4 commits into from
Mar 7, 2025
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
343 changes: 222 additions & 121 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ ringbuffer = "0.15.0"
rusqlite = { version = "0.32" }
rustls-pemfile = { version = "1.0.4" }
schemars = { version = "0.8", features = [ "chrono", "uuid1" ] }
semver = "1"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
sha2 = "0.10"
Expand Down Expand Up @@ -114,7 +115,7 @@ usdt = "0.5.0"
uuid = { version = "1", features = [ "serde", "v4" ] }

# git
dropshot = { version = "0.12.0", features = [ "usdt-probes" ] }
dropshot = { version = "0.16.0", features = [ "usdt-probes" ] }
omicron-common = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
nexus-client = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
internal-dns = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
Expand Down
1 change: 1 addition & 0 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ http.workspace = true
hyper.workspace = true
omicron-common.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
Expand Down
4 changes: 3 additions & 1 deletion agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use anyhow::{anyhow, bail, Result};
use clap::Parser;
use dropshot::{ConfigLogging, ConfigLoggingIfExists, ConfigLoggingLevel};
use semver::Version;
use slog::{debug, error, info, o, Logger};
use std::collections::HashSet;
use std::io::Write;
Expand Down Expand Up @@ -341,7 +342,8 @@ async fn main() -> Result<()> {

fn write_openapi<W: Write>(f: &mut W) -> Result<()> {
let api = server::make_api()?;
api.openapi("Crucible Agent", "0.0.0").write(f)?;
api.openapi("Crucible Agent", Version::new(0, 0, 1))
.write(f)?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion agent/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ pub async fn run_server(
let server = dropshot::HttpServerStarter::new(
&dropshot::ConfigDropshot {
bind_address,
request_body_max_bytes: 1024 * 10,
default_request_body_max_bytes: 1024 * 10,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
},
Expand Down
1 change: 1 addition & 0 deletions downstairs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ reqwest.workspace = true
ringbuffer.workspace = true
rusqlite.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
Expand Down
6 changes: 4 additions & 2 deletions downstairs/src/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use dropshot::RequestContext;
use dropshot::{endpoint, Path};
use hyper::{Response, StatusCode};
use schemars::JsonSchema;
use semver::Version;
use serde::Deserialize;

use super::*;
Expand All @@ -30,7 +31,8 @@ pub struct FileServerContext {

pub fn write_openapi<W: Write>(f: &mut W) -> Result<()> {
let api = build_api();
api.openapi("Downstairs Repair", "0.0.0").write(f)?;
api.openapi("Downstairs Repair", Version::new(0, 0, 1))
.write(f)?;
Ok(())
}

Expand All @@ -57,7 +59,7 @@ pub fn repair_main(
*/
let config_dropshot = ConfigDropshot {
bind_address: addr,
request_body_max_bytes: 1024,
default_request_body_max_bytes: 1024,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
};
Expand Down
1 change: 1 addition & 0 deletions dsc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dropshot.workspace = true
rand.workspace = true
rand_chacha.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
statistical.workspace = true
tokio.workspace = true
Expand Down
6 changes: 4 additions & 2 deletions dsc/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use dropshot::Path;
use dropshot::RequestContext;
use dropshot::{HttpResponseOk, HttpResponseUpdatedNoContent};
use schemars::JsonSchema;
use semver::Version;
use serde::Deserialize;
use std::sync::Arc;

Expand Down Expand Up @@ -51,7 +52,7 @@ pub async fn begin(dsci: Arc<DscInfo>, addr: SocketAddr) -> Result<(), String> {
// Setup dropshot
let config_dropshot = ConfigDropshot {
bind_address: addr,
request_body_max_bytes: 1024,
default_request_body_max_bytes: 1024,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
};
Expand Down Expand Up @@ -588,14 +589,15 @@ async fn dsc_enable_random_max(
#[cfg(test)]
mod test {
use openapiv3::OpenAPI;
use semver::Version;

use super::build_api;

#[test]
fn test_dsc_openapi() {
let api = build_api();
let mut raw = Vec::new();
api.openapi("DownStairs Control", "0.0.0")
api.openapi("DownStairs Control", Version::new(0, 0, 1))
.write(&mut raw)
.unwrap();
let actual = String::from_utf8(raw).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion openapi/crucible-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "Crucible Agent",
"version": "0.0.0"
"version": "0.0.1"
},
"paths": {
"/crucible/0/regions": {
Expand Down
2 changes: 1 addition & 1 deletion openapi/crucible-control.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "Crucible Control",
"version": "0.0.0"
"version": "0.0.1"
},
"paths": {
"/info": {
Expand Down
2 changes: 1 addition & 1 deletion openapi/crucible-pantry.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "Crucible Pantry",
"version": "0.0.0"
"version": "0.0.1"
},
"paths": {
"/crucible/pantry/0": {
Expand Down
2 changes: 1 addition & 1 deletion openapi/downstairs-repair.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "Downstairs Repair",
"version": "0.0.0"
"version": "0.0.1"
},
"paths": {
"/extent/{eid}/files": {
Expand Down
2 changes: 1 addition & 1 deletion openapi/dsc-control.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "DownStairs Control",
"version": "0.0.0"
"version": "0.0.1"
},
"paths": {
"/allrunning": {
Expand Down
1 change: 1 addition & 0 deletions pantry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ futures.workspace = true
http.workspace = true
hyper.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
Expand Down
4 changes: 3 additions & 1 deletion pantry/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use anyhow::{anyhow, Result};
use clap::Parser;
use semver::Version;
use std::io::Write;
use std::net::SocketAddr;
use std::path::PathBuf;
Expand Down Expand Up @@ -46,7 +47,8 @@ async fn main() -> Result<()> {

fn write_openapi<W: Write>(f: &mut W) -> Result<()> {
let api = server::make_api().map_err(|e| anyhow!(e))?;
api.openapi("Crucible Pantry", "0.0.0").write(f)?;
api.openapi("Crucible Pantry", Version::new(0, 0, 1))
.write(f)?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion pantry/src/pantry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ impl Pantry {
"volume {} is no longer active!",
volume_id
)),
hyper::StatusCode::GONE,
dropshot::ClientErrorStatusCode::GONE,
format!("volume {} is no longer active!", volume_id),
))
} else {
Expand Down
2 changes: 1 addition & 1 deletion pantry/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ pub fn run_server(
bind_address,
// max import, multiplied by worst case base64 overhead, plus room
// for metadata
request_body_max_bytes: 1024
default_request_body_max_bytes: 1024
+ crate::pantry::PantryEntry::MAX_CHUNK_SIZE * 2,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
Expand Down
1 change: 1 addition & 0 deletions upstairs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rand.workspace = true
rayon.workspace = true
ringbuffer.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
serde_json.workspace = true
slog.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions upstairs/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn start(
*/
let config_dropshot = ConfigDropshot {
bind_address: addr,
request_body_max_bytes: 1024,
default_request_body_max_bytes: 1024,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
};
Expand Down Expand Up @@ -186,14 +186,15 @@ async fn downstairs_work_queue(
#[cfg(test)]
mod test {
use openapiv3::OpenAPI;
use semver::Version;

use super::build_api;

#[test]
fn test_crucible_control_openapi() {
let api = build_api();
let mut raw = Vec::new();
api.openapi("Crucible Control", "0.0.0")
api.openapi("Crucible Control", Version::new(0, 0, 1))
.write(&mut raw)
.unwrap();
let actual = String::from_utf8(raw).unwrap();
Expand Down
8 changes: 6 additions & 2 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ futures-core = { version = "0.3" }
futures-executor = { version = "0.3" }
futures-sink = { version = "0.3" }
futures-util = { version = "0.3", features = ["channel", "io", "sink"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hex = { version = "0.4", features = ["serde"] }
indexmap = { version = "2", features = ["serde"] }
libc = { version = "0.2", features = ["extra_traits"] }
Expand Down Expand Up @@ -79,7 +78,6 @@ futures-core = { version = "0.3" }
futures-executor = { version = "0.3" }
futures-sink = { version = "0.3" }
futures-util = { version = "0.3", features = ["channel", "io", "sink"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hex = { version = "0.4", features = ["serde"] }
indexmap = { version = "2", features = ["serde"] }
libc = { version = "0.2", features = ["extra_traits"] }
Expand Down Expand Up @@ -117,6 +115,7 @@ zerocopy = { version = "0.7", features = ["derive", "simd"] }
[target.x86_64-unknown-linux-gnu.dependencies]
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1" }
dof = { version = "0.3", default-features = false, features = ["des"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand All @@ -129,6 +128,7 @@ tokio-util = { version = "0.7", features = ["codec", "io"] }

[target.x86_64-unknown-linux-gnu.build-dependencies]
dof = { version = "0.3", default-features = false, features = ["des"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand All @@ -140,6 +140,7 @@ spin = { version = "0.9", default-features = false, features = ["once", "spin_mu
tokio-util = { version = "0.7", features = ["codec", "io"] }

[target.aarch64-apple-darwin.dependencies]
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand All @@ -150,6 +151,7 @@ rustls-pki-types = { version = "1", features = ["std"] }
tokio-util = { version = "0.7", features = ["codec", "io"] }

[target.aarch64-apple-darwin.build-dependencies]
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand All @@ -162,6 +164,7 @@ tokio-util = { version = "0.7", features = ["codec", "io"] }
[target.x86_64-unknown-illumos.dependencies]
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1" }
dof = { version = "0.3", default-features = false, features = ["des"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand All @@ -175,6 +178,7 @@ toml_edit = { version = "0.19", features = ["serde"] }

[target.x86_64-unknown-illumos.build-dependencies]
dof = { version = "0.3", default-features = false, features = ["des"] }
getrandom = { version = "0.2", default-features = false, features = ["std"] }
hyper = { version = "1", features = ["full"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "tls12", "webpki-tokio"] }
hyper-util = { version = "0.1", features = ["full"] }
Expand Down