Skip to content

Commit

Permalink
update to dropshot 0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iliana committed Dec 5, 2024
1 parent 5e71ab8 commit 45b9156
Show file tree
Hide file tree
Showing 34 changed files with 249 additions and 219 deletions.
348 changes: 175 additions & 173 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ dns-server = { path = "dns-server" }
dns-server-api = { path = "dns-server-api" }
dns-service-client = { path = "clients/dns-service-client" }
dpd-client = { path = "clients/dpd-client" }
dropshot = { version = "0.13.0", features = [ "usdt-probes" ] }
dropshot = { version = "0.15.0", features = [ "usdt-probes" ] }
dyn-clone = "1.0.17"
either = "1.13.0"
expectorate = "1.1.0"
Expand Down Expand Up @@ -886,8 +886,3 @@ path = "workspace-hack"
[patch."https://github.com/oxidecomputer/omicron"]
omicron-uuid-kinds = { path = "uuid-kinds" }
omicron-common = { path = "common" }

# /!\ REMOVE BEFORE FLIGHT: Temporary patch to test dropshot breaking changes
[patch.crates-io.dropshot]
git = 'https://github.com/oxidecomputer/dropshot'
branch = 'eliza/custom-error-httpresponse-result'
1 change: 1 addition & 0 deletions clickhouse-admin/src/clickhouse_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl From<ClickhouseCliError> for HttpError {
error_code: Some(String::from("Internal")),
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions clickhouse-admin/src/clickward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl From<ClickwardError> for HttpError {
error_code: Some(String::from("Internal")),
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions cockroach-admin/src/cockroach_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl From<CockroachCliError> for HttpError {
error_code: Some(String::from("Internal")),
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions cockroach-admin/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl ServerContext {
error_code: None,
external_message: message.clone(),
internal_message: message,
headers: None,
})
}
}
Expand Down
6 changes: 6 additions & 0 deletions common/src/api/external/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ impl From<Error> for HttpError {
"credentials missing or invalid",
),
internal_message,
headers: None,
},

Error::InvalidRequest { message } => {
Expand All @@ -445,6 +446,7 @@ impl From<Error> for HttpError {
error_code: Some(String::from("InvalidRequest")),
external_message,
internal_message,
headers: None,
}
}

Expand All @@ -459,6 +461,7 @@ impl From<Error> for HttpError {
label, external_message
),
internal_message,
headers: None,
}
}

Expand Down Expand Up @@ -493,6 +496,7 @@ impl From<Error> for HttpError {
external_message
),
internal_message,
headers: None,
}
}

Expand All @@ -508,6 +512,7 @@ impl From<Error> for HttpError {
error_code: Some(String::from("Conflict")),
external_message,
internal_message,
headers: None,
}
}

Expand All @@ -519,6 +524,7 @@ impl From<Error> for HttpError {
error_code: Some(String::from("Not Found")),
external_message,
internal_message,
headers: None,
}
}

Expand Down
2 changes: 1 addition & 1 deletion dns-server/examples/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[dropshot]
# 100 MiB. This ought to be large enough for a while, but not so large that
# we'll use tons of memory parsing incoming HTTP requests.
request_body_max_bytes = 104857600
default_request_body_max_bytes = 104857600

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 2 additions & 0 deletions dns-server/src/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ impl From<UpdateError> for dropshot::HttpError {
)),
external_message: message.clone(),
internal_message: message,
headers: None,
},

UpdateError::UpdateInProgress { .. } => dropshot::HttpError {
status_code: dropshot::ErrorStatusCode::CONFLICT,
error_code: Some(String::from(ERROR_CODE_UPDATE_IN_PROGRESS)),
external_message: message.clone(),
internal_message: message,
headers: None,
},

UpdateError::InternalError(_) => {
Expand Down
2 changes: 1 addition & 1 deletion gateway/examples/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ host_phase2_recovery_image_cache_max_images = 1
[dropshot]
# We want to allow uploads of host phase 2 recovery images, which may be
# measured in the (small) hundreds of MiB. Set this to 1 GiB for testing.
request_body_max_bytes = 1_073_741_824
default_request_body_max_bytes = 1_073_741_824

[switch]
# Which interface is connected to our local sidecar SP (i.e., the SP that acts
Expand Down
1 change: 1 addition & 0 deletions gateway/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ pub(crate) fn http_err_with_message(
error_code: Some(error_code.to_string()),
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
1 change: 1 addition & 0 deletions illumos-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl From<ExecutionError> for HttpError {
error_code: Some(String::from("Internal")),
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions nexus-config/src/nexus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,10 @@ mod test {
external_dns_servers = [ "1.1.1.1", "9.9.9.9" ]
[deployment.dropshot_external]
bind_address = "10.1.2.3:4567"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.dropshot_internal]
bind_address = "10.1.2.3:4568"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.internal_dns]
type = "from_subnet"
subnet.net = "::/56"
Expand Down Expand Up @@ -1176,10 +1176,10 @@ mod test {
external_dns_servers = [ "1.1.1.1", "9.9.9.9" ]
[deployment.dropshot_external]
bind_address = "10.1.2.3:4567"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.dropshot_internal]
bind_address = "10.1.2.3:4568"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.internal_dns]
type = "from_subnet"
subnet.net = "::/56"
Expand Down Expand Up @@ -1262,10 +1262,10 @@ mod test {
external_dns_servers = [ "1.1.1.1", "9.9.9.9" ]
[deployment.dropshot_external]
bind_address = "10.1.2.3:4567"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.dropshot_internal]
bind_address = "10.1.2.3:4568"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.internal_dns]
type = "from_subnet"
subnet.net = "::/56"
Expand Down Expand Up @@ -1319,10 +1319,10 @@ mod test {
external_dns_servers = [ "1.1.1.1", "9.9.9.9" ]
[deployment.dropshot_external]
bind_address = "10.1.2.3:4567"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.dropshot_internal]
bind_address = "10.1.2.3:4568"
request_body_max_bytes = 1024
default_request_body_max_bytes = 1024
[deployment.internal_dns]
type = "from_subnet"
subnet.net = "::/56"
Expand Down
4 changes: 2 additions & 2 deletions nexus/examples/config-second.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bind_address = "127.0.0.1:12222"
#
# This should be brought back down to a more reasonable value once per-endpoint
# request body limits are implemented.
request_body_max_bytes = 3221225472
default_request_body_max_bytes = 3221225472
# To have Nexus's external HTTP endpoint use TLS, uncomment the line below. You
# will also need to provide an initial TLS certificate during rack
# initialization. If you're using this config file, you're probably running a
Expand All @@ -73,7 +73,7 @@ request_body_max_bytes = 3221225472
# This config file uses 12223 to avoid colliding with the usual 12221 that's
# used by `omicron-dev run-all`
bind_address = "[::1]:12223"
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

#[deployment.internal_dns]
## These values are overridden at the bottom of this file.
Expand Down
4 changes: 2 additions & 2 deletions nexus/examples/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bind_address = "127.0.0.1:12220"
#
# This should be brought back down to a more reasonable value once per-endpoint
# request body limits are implemented.
request_body_max_bytes = 3221225472
default_request_body_max_bytes = 3221225472
# To have Nexus's external HTTP endpoint use TLS, uncomment the line below. You
# will also need to provide an initial TLS certificate during rack
# initialization. If you're using this config file, you're probably running a
Expand All @@ -57,7 +57,7 @@ request_body_max_bytes = 3221225472
[deployment.dropshot_internal]
# IP Address and TCP port on which to listen for the internal API
bind_address = "[::1]:12221"
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

[deployment.internal_dns]
# Example address.
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/background/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ pub mod test {
},
&dropshot::ConfigDropshot {
bind_address: "[::1]:0".parse().unwrap(),
request_body_max_bytes: 8 * 1024,
default_request_body_max_bytes: 8 * 1024,
default_handler_task_mode: HandlerTaskMode::Detached,
log_headers: vec![],
},
Expand Down
10 changes: 9 additions & 1 deletion nexus/test-utils/src/http_testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,15 @@ impl<'a> RequestBuilder<'a> {
if let Some(allowed_headers) = self.allowed_headers {
for header_name in headers.keys() {
ensure!(
allowed_headers.contains(header_name),
allowed_headers.contains(header_name)
|| (
// Dropshot adds `allow` headers to its 405 Method
// Not Allowed responses, per RFC 9110. If we expect
// a 405 we should also inherently expect `allow`.
self.expected_status
== Some(http::StatusCode::METHOD_NOT_ALLOWED)
&& header_name == http::header::ALLOW
),
"response contained unexpected header {:?}",
header_name
);
Expand Down
4 changes: 2 additions & 2 deletions nexus/tests/config.test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ external_dns_servers = ["1.1.1.1", "9.9.9.9"]
# available port) because the test suite will be running many servers
# concurrently.
bind_address = "127.0.0.1:0"
request_body_max_bytes = 8388608
default_request_body_max_bytes = 8388608

[deployment.dropshot_internal]
bind_address = "127.0.0.1:0"
request_body_max_bytes = 8388608
default_request_body_max_bytes = 8388608

#
# NOTE: for the test suite, the internal DNS address will be replaced with one
Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/boot_disk_os_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl From<&BootDiskOsWriteError> for HttpError {
error_code: None,
external_message: message.clone(),
internal_message: message,
headers: None,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ impl SledAgentApi for SledAgentImpl {
error_code: None,
external_message: message.clone(),
internal_message: message,
headers: None,
}
})?;
Ok(HttpResponseUpdatedNoContent())
Expand Down Expand Up @@ -759,6 +760,7 @@ impl SledAgentApi for SledAgentImpl {
error_code: None,
external_message: message.clone(),
internal_message: message,
headers: None,
});
}
None => {
Expand All @@ -768,6 +770,7 @@ impl SledAgentApi for SledAgentImpl {
error_code: None,
external_message: message.clone(),
internal_message: message,
headers: None,
});
}
};
Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/sim/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ fn method_unimplemented<T>() -> Result<T, HttpError> {
.to_string(),
internal_message: "Method not implemented in sled-agent-sim"
.to_string(),
headers: None,
})
}

Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse-admin-keeper/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dropshot]
# 1 MiB; we don't expect any requests of more than nominal size.
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse-admin-server/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dropshot]
# 1 MiB; we don't expect any requests of more than nominal size.
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/clickhouse-admin-single/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dropshot]
# 1 MiB; we don't expect any requests of more than nominal size.
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/cockroach-admin/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dropshot]
# 1 MiB; we don't expect any requests of more than nominal size.
request_body_max_bytes = 1048576
default_request_body_max_bytes = 1048576

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/external-dns/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[dropshot]
# 100 MiB. This ought to be large enough for a while, but not so large that
# we'll use tons of memory parsing it.
request_body_max_bytes = 104857600
default_request_body_max_bytes = 104857600

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/internal-dns/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[dropshot]
# 100 MiB. This ought to be large enough for a while, but not so large that
# we'll use tons of memory parsing it.
request_body_max_bytes = 104857600
default_request_body_max_bytes = 104857600

[log]
# Show log messages of this level and more severe
Expand Down
2 changes: 1 addition & 1 deletion smf/mgs-sim/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ host_phase2_recovery_image_cache_max_images = 1
[dropshot]
# We want to allow uploads of host phase 2 recovery images, which may be
# measured in the (small) hundreds of MiB. Set this to 512 MiB.
request_body_max_bytes = 536870912
default_request_body_max_bytes = 536870912

[switch]
# Which interface is connected to our local sidecar SP (i.e., the SP that acts
Expand Down
2 changes: 1 addition & 1 deletion smf/sled-agent/gimlet-standalone/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ data_links = ["net0", "net1"]
[dropshot]
# Host OS images are just over 800 MiB currently; set this to 2 GiB to give some
# breathing room.
request_body_max_bytes = 2_147_483_648
default_request_body_max_bytes = 2_147_483_648

[log]
level = "info"
Expand Down
2 changes: 1 addition & 1 deletion smf/sled-agent/gimlet/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ data_links = ["cxgbe0", "cxgbe1"]
[dropshot]
# Host OS images are just over 800 MiB currently; set this to 2 GiB to give some
# breathing room.
request_body_max_bytes = 2_147_483_648
default_request_body_max_bytes = 2_147_483_648

[log]
level = "info"
Expand Down
Loading

0 comments on commit 45b9156

Please sign in to comment.