From 54470d57d3dfabad282a6b32879e773567c74585 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 22 Aug 2025 12:29:34 -0500 Subject: [PATCH 1/2] remove bad project_ prefix from silo-scoped IP pool endpoints --- end-to-end-tests/src/bin/commtest.rs | 58 +++++++++++----------- nexus/external-api/output/nexus_tags.txt | 8 +-- nexus/external-api/src/lib.rs | 14 ++++-- nexus/src/external_api/http_entrypoints.rs | 8 +-- openapi/nexus.json | 11 ++-- 5 files changed, 54 insertions(+), 45 deletions(-) diff --git a/end-to-end-tests/src/bin/commtest.rs b/end-to-end-tests/src/bin/commtest.rs index a2e46391025..f883bd9e388 100644 --- a/end-to-end-tests/src/bin/commtest.rs +++ b/end-to-end-tests/src/bin/commtest.rs @@ -280,37 +280,37 @@ async fn rack_prepare( })?; let pool_name = "default"; - api_retry!( - if let Err(e) = oxide.ip_pool_view().pool("default").send().await { - if let Some(reqwest::StatusCode::NOT_FOUND) = e.status() { - print!("default ip pool does not exist, creating ..."); - oxide - .ip_pool_create() - .body(IpPoolCreate { - name: pool_name.parse().unwrap(), - description: "Default IP pool".to_string(), - }) - .send() - .await?; - oxide - .ip_pool_silo_link() - .pool(pool_name) - .body(IpPoolLinkSilo { - silo: NameOrId::Name("recovery".parse().unwrap()), - is_default: true, - }) - .send() - .await?; - println!("done"); - Ok(()) - } else { - Err(e) - } - } else { - println!("default ip pool already exists"); + api_retry!(if let Err(e) = + oxide.system_ip_pool_view().pool("default").send().await + { + if let Some(reqwest::StatusCode::NOT_FOUND) = e.status() { + print!("default ip pool does not exist, creating ..."); + oxide + .ip_pool_create() + .body(IpPoolCreate { + name: pool_name.parse().unwrap(), + description: "Default IP pool".to_string(), + }) + .send() + .await?; + oxide + .ip_pool_silo_link() + .pool(pool_name) + .body(IpPoolLinkSilo { + silo: NameOrId::Name("recovery".parse().unwrap()), + is_default: true, + }) + .send() + .await?; + println!("done"); Ok(()) + } else { + Err(e) } - )?; + } else { + println!("default ip pool already exists"); + Ok(()) + })?; let pool = api_retry!( oxide diff --git a/nexus/external-api/output/nexus_tags.txt b/nexus/external-api/output/nexus_tags.txt index 19a1876ec69..edd0928b704 100644 --- a/nexus/external-api/output/nexus_tags.txt +++ b/nexus/external-api/output/nexus_tags.txt @@ -134,10 +134,10 @@ system_policy_view GET /v1/system/policy API operations found with tag "projects" OPERATION ID METHOD URL PATH +ip_pool_list GET /v1/ip-pools +ip_pool_view GET /v1/ip-pools/{pool} project_create POST /v1/projects project_delete DELETE /v1/projects/{project} -project_ip_pool_list GET /v1/ip-pools -project_ip_pool_view GET /v1/ip-pools/{pool} project_list GET /v1/projects project_policy_update PUT /v1/projects/{project}/policy project_policy_view GET /v1/projects/{project}/policy @@ -215,7 +215,6 @@ API operations found with tag "system/ip-pools" OPERATION ID METHOD URL PATH ip_pool_create POST /v1/system/ip-pools ip_pool_delete DELETE /v1/system/ip-pools/{pool} -ip_pool_list GET /v1/system/ip-pools ip_pool_range_add POST /v1/system/ip-pools/{pool}/ranges/add ip_pool_range_list GET /v1/system/ip-pools/{pool}/ranges ip_pool_range_remove POST /v1/system/ip-pools/{pool}/ranges/remove @@ -229,7 +228,8 @@ ip_pool_silo_unlink DELETE /v1/system/ip-pools/{pool}/sil ip_pool_silo_update PUT /v1/system/ip-pools/{pool}/silos/{silo} ip_pool_update PUT /v1/system/ip-pools/{pool} ip_pool_utilization_view GET /v1/system/ip-pools/{pool}/utilization -ip_pool_view GET /v1/system/ip-pools/{pool} +system_ip_pool_list GET /v1/system/ip-pools +system_ip_pool_view GET /v1/system/ip-pools/{pool} API operations found with tag "system/metrics" OPERATION ID METHOD URL PATH diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index 38dc5894458..c02e2ee42e0 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -669,12 +669,14 @@ pub trait NexusExternalApi { // IP Pools /// List IP pools + /// + /// For the current silo. #[endpoint { method = GET, path = "/v1/ip-pools", tags = ["projects"], }] - async fn project_ip_pool_list( + async fn ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError>; @@ -685,18 +687,20 @@ pub trait NexusExternalApi { path = "/v1/ip-pools/{pool}", tags = ["projects"], }] - async fn project_ip_pool_view( + async fn ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError>; /// List IP pools + /// + /// Operator endpoint to list all IP pools across the system. #[endpoint { method = GET, path = "/v1/system/ip-pools", tags = ["system/ip-pools"], }] - async fn ip_pool_list( + async fn system_ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError>; @@ -713,12 +717,14 @@ pub trait NexusExternalApi { ) -> Result, HttpError>; /// Fetch IP pool + /// + /// Operator endpoint to view an IP pool. #[endpoint { method = GET, path = "/v1/system/ip-pools/{pool}", tags = ["system/ip-pools"], }] - async fn ip_pool_view( + async fn system_ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError>; diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index be75d2a3e90..37cbd20a7e7 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -1093,7 +1093,7 @@ impl NexusExternalApi for NexusExternalApiImpl { // IP Pools - async fn project_ip_pool_list( + async fn ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError> { @@ -1128,7 +1128,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn project_ip_pool_view( + async fn ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError> { @@ -1152,7 +1152,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn ip_pool_list( + async fn system_ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError> { @@ -1204,7 +1204,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn ip_pool_view( + async fn system_ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError> { diff --git a/openapi/nexus.json b/openapi/nexus.json index 816f81a61d1..370d4a00d51 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -5286,7 +5286,8 @@ "projects" ], "summary": "List IP pools", - "operationId": "project_ip_pool_list", + "description": "For the current silo.", + "operationId": "ip_pool_list", "parameters": [ { "in": "query", @@ -5345,7 +5346,7 @@ "projects" ], "summary": "Fetch IP pool", - "operationId": "project_ip_pool_view", + "operationId": "ip_pool_view", "parameters": [ { "in": "path", @@ -8247,7 +8248,8 @@ "system/ip-pools" ], "summary": "List IP pools", - "operationId": "ip_pool_list", + "description": "Operator endpoint to list all IP pools across the system.", + "operationId": "system_ip_pool_list", "parameters": [ { "in": "query", @@ -8341,7 +8343,8 @@ "system/ip-pools" ], "summary": "Fetch IP pool", - "operationId": "ip_pool_view", + "description": "Operator endpoint to view an IP pool.", + "operationId": "system_ip_pool_view", "parameters": [ { "in": "path", From 65074aa2e05dec1690503cc404e350ab47c247a0 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 22 Aug 2025 16:29:32 -0500 Subject: [PATCH 2/2] improve doc comment descriptions --- nexus/external-api/src/lib.rs | 4 +--- openapi/nexus.json | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index c02e2ee42e0..2ef323708d7 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -694,7 +694,7 @@ pub trait NexusExternalApi { /// List IP pools /// - /// Operator endpoint to list all IP pools across the system. + /// List all IP pools regardless of silo links. #[endpoint { method = GET, path = "/v1/system/ip-pools", @@ -717,8 +717,6 @@ pub trait NexusExternalApi { ) -> Result, HttpError>; /// Fetch IP pool - /// - /// Operator endpoint to view an IP pool. #[endpoint { method = GET, path = "/v1/system/ip-pools/{pool}", diff --git a/openapi/nexus.json b/openapi/nexus.json index 370d4a00d51..89955c1ee00 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -8248,7 +8248,7 @@ "system/ip-pools" ], "summary": "List IP pools", - "description": "Operator endpoint to list all IP pools across the system.", + "description": "List all IP pools regardless of silo.", "operationId": "system_ip_pool_list", "parameters": [ { @@ -8343,7 +8343,6 @@ "system/ip-pools" ], "summary": "Fetch IP pool", - "description": "Operator endpoint to view an IP pool.", "operationId": "system_ip_pool_view", "parameters": [ {