Skip to content

Commit

Permalink
even more
Browse files Browse the repository at this point in the history
  • Loading branch information
iliana committed Dec 16, 2024
1 parent 097619e commit ee6c690
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 28 deletions.
4 changes: 4 additions & 0 deletions gateway-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Self::Context>,
Expand Down
4 changes: 1 addition & 3 deletions gateway-test-utils/configs/config.test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions gateway/examples/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions installinator-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<Self::Context>,
Expand Down Expand Up @@ -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![],
}
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"
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
Expand Down
4 changes: 1 addition & 3 deletions smf/mgs-sim/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions smf/mgs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions wicketd-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Self::Context>,
Expand Down
5 changes: 1 addition & 4 deletions wicketd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![],
};
Expand Down

0 comments on commit ee6c690

Please sign in to comment.