From ee6c690eed5781a035bcc41a315b0b0b1dbb0dd5 Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Mon, 16 Dec 2024 19:32:17 +0000 Subject: [PATCH] even more --- gateway-api/src/lib.rs | 4 ++++ gateway-test-utils/configs/config.test.toml | 4 +--- gateway/examples/config.toml | 4 +--- installinator-api/src/lib.rs | 14 ++++---------- nexus/tests/config.test.toml | 4 ++-- smf/mgs-sim/config.toml | 4 +--- smf/mgs/config.toml | 4 +--- wicketd-api/src/lib.rs | 5 +++++ wicketd/src/lib.rs | 5 +---- 9 files changed, 20 insertions(+), 28 deletions(-) diff --git a/gateway-api/src/lib.rs b/gateway-api/src/lib.rs index 30f262ec45..b4c710355e 100644 --- a/gateway-api/src/lib.rs +++ b/gateway-api/src/lib.rs @@ -29,6 +29,9 @@ use schemars::JsonSchema; use serde::Deserialize; use uuid::Uuid; +/// The host phase 2 recovery image is currently (Dec 2024) ~130 MiB. +const HOST_PHASE2_MAX_BYTES: usize = 512 * 1024 * 1024; + #[dropshot::api_description] pub trait GatewayApi { type Context; @@ -434,6 +437,7 @@ pub trait GatewayApi { #[endpoint { method = POST, path = "/recovery/host-phase2", + request_body_max_bytes = HOST_PHASE2_MAX_BYTES, }] async fn recovery_host_phase2_upload( rqctx: RequestContext, diff --git a/gateway-test-utils/configs/config.test.toml b/gateway-test-utils/configs/config.test.toml index 85c166fc6f..1e8f06e915 100644 --- a/gateway-test-utils/configs/config.test.toml +++ b/gateway-test-utils/configs/config.test.toml @@ -9,9 +9,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. -default_request_body_max_bytes = 536870912 +default_request_body_max_bytes = 1048576 [switch] # For tests, bind to port 0 (i.e., OS chooses an open port) instead of MGS's diff --git a/gateway/examples/config.toml b/gateway/examples/config.toml index 89c8a5fa53..cc0223dc47 100644 --- a/gateway/examples/config.toml +++ b/gateway/examples/config.toml @@ -9,9 +9,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. -default_request_body_max_bytes = 1_073_741_824 +default_request_body_max_bytes = 1048576 [switch] # Which interface is connected to our local sidecar SP (i.e., the SP that acts diff --git a/installinator-api/src/lib.rs b/installinator-api/src/lib.rs index 1b1c24c972..63efa615a7 100644 --- a/installinator-api/src/lib.rs +++ b/installinator-api/src/lib.rs @@ -21,6 +21,8 @@ use schemars::JsonSchema; use serde::Deserialize; use uuid::Uuid; +const PROGRESS_REPORT_MAX_BYTES: usize = 4 * 1024 * 1024; + #[derive(Debug, Deserialize, JsonSchema)] pub struct ReportQuery { /// A unique identifier for the update. @@ -50,6 +52,7 @@ pub trait InstallinatorApi { #[endpoint { method = POST, path = "/report-progress/{update_id}", + request_body_max_bytes = PROGRESS_REPORT_MAX_BYTES, }] async fn report_progress( rqctx: RequestContext, @@ -120,16 +123,7 @@ impl EventReportStatus { pub fn default_config(bind_address: std::net::SocketAddr) -> ConfigDropshot { ConfigDropshot { bind_address, - // Even though the installinator sets an upper bound on the number of - // items in a progress report, they can get pretty large if they - // haven't gone through for a bit. Ensure that hitting the max request - // size won't cause a failure by setting a generous upper bound for the - // request size. - // - // TODO: replace with an endpoint-specific option once - // https://github.com/oxidecomputer/dropshot/pull/618 lands and is - // available in omicron. - default_request_body_max_bytes: 4 * 1024 * 1024, + default_request_body_max_bytes: 1024, default_handler_task_mode: HandlerTaskMode::Detached, log_headers: vec![], } diff --git a/nexus/tests/config.test.toml b/nexus/tests/config.test.toml index 2b3cd92740..3194e18802 100644 --- a/nexus/tests/config.test.toml +++ b/nexus/tests/config.test.toml @@ -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" -default_request_body_max_bytes = 8388608 +default_request_body_max_bytes = 1048576 [deployment.dropshot_internal] bind_address = "127.0.0.1:0" -default_request_body_max_bytes = 8388608 +default_request_body_max_bytes = 1048576 # # NOTE: for the test suite, the internal DNS address will be replaced with one diff --git a/smf/mgs-sim/config.toml b/smf/mgs-sim/config.toml index 41d0d7c1f5..b23614f662 100644 --- a/smf/mgs-sim/config.toml +++ b/smf/mgs-sim/config.toml @@ -9,9 +9,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. -default_request_body_max_bytes = 536870912 +default_request_body_max_bytes = 1048576 [switch] # Which interface is connected to our local sidecar SP (i.e., the SP that acts diff --git a/smf/mgs/config.toml b/smf/mgs/config.toml index ff19074c94..6b10a046cc 100644 --- a/smf/mgs/config.toml +++ b/smf/mgs/config.toml @@ -9,9 +9,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. -default_request_body_max_bytes = 536870912 +default_request_body_max_bytes = 1048576 [switch] # Which interface is connected to our local sidecar SP (i.e., the SP that acts diff --git a/wicketd-api/src/lib.rs b/wicketd-api/src/lib.rs index c4c170481b..47533b892d 100644 --- a/wicketd-api/src/lib.rs +++ b/wicketd-api/src/lib.rs @@ -39,6 +39,10 @@ use wicket_common::rack_update::ClearUpdateStateResponse; use wicket_common::rack_update::StartUpdateOptions; use wicket_common::update_events::EventReport; +/// Full release repositories are currently (Dec 2024) 1.8 GiB and are likely to +/// continue growing. +const PUT_REPOSITORY_MAX_BYTES: usize = 4 * 1024 * 1024 * 1024; + #[dropshot::api_description] pub trait WicketdApi { type Context; @@ -203,6 +207,7 @@ pub trait WicketdApi { #[endpoint { method = PUT, path = "/repository", + request_body_max_bytes = PUT_REPOSITORY_MAX_BYTES, }] async fn put_repository( rqctx: RequestContext, diff --git a/wicketd/src/lib.rs b/wicketd/src/lib.rs index 66db255f1f..1fbf278ead 100644 --- a/wicketd/src/lib.rs +++ b/wicketd/src/lib.rs @@ -130,10 +130,7 @@ impl Server { let dropshot_config = ConfigDropshot { bind_address: SocketAddr::V6(args.address), - // The maximum request size is set to 4 GB -- artifacts can be large - // and there's currently no way to set a larger request size for - // some endpoints. - default_request_body_max_bytes: 4 << 30, + default_request_body_max_bytes: 8 * 1024 * 1024, default_handler_task_mode: HandlerTaskMode::Detached, log_headers: vec![], };