diff --git a/storage_controller/src/http.rs b/storage_controller/src/http.rs
index c627978c93..596675cc6f 100644
--- a/storage_controller/src/http.rs
+++ b/storage_controller/src/http.rs
@@ -480,6 +480,17 @@ async fn handle_node_configure(mut req: Request
) -> Result,
)
}
+async fn handle_node_status(req: Request) -> Result, ApiError> {
+ check_permissions(&req, Scope::Admin)?;
+
+ let state = get_state(&req);
+ let node_id: NodeId = parse_request_param(&req, "node_id")?;
+
+ let node_status = state.service.get_node_status(node_id).await?;
+
+ json_response(StatusCode::OK, node_status)
+}
+
async fn handle_node_drain(req: Request) -> Result, ApiError> {
check_permissions(&req, Scope::Admin)?;
@@ -854,6 +865,9 @@ pub fn make_router(
RequestName("control_v1_node_config"),
)
})
+ .get("/control/v1/node/:node_id", |r| {
+ named_request_span(r, handle_node_status, RequestName("control_v1_node_status"))
+ })
.put("/control/v1/node/:node_id/drain", |r| {
named_request_span(r, handle_node_drain, RequestName("control_v1_node_drain"))
})
diff --git a/storage_controller/src/service.rs b/storage_controller/src/service.rs
index d594366ff5..a16ae87968 100644
--- a/storage_controller/src/service.rs
+++ b/storage_controller/src/service.rs
@@ -4202,6 +4202,18 @@ impl Service {
Ok(nodes)
}
+ pub(crate) async fn get_node_status(&self, node_id: NodeId) -> Result {
+ self.inner
+ .read()
+ .unwrap()
+ .nodes
+ .get(&node_id)
+ .cloned()
+ .ok_or(ApiError::NotFound(
+ format!("Node {node_id} not registered").into(),
+ ))
+ }
+
pub(crate) async fn node_register(
&self,
register_req: NodeRegisterRequest,
@@ -4356,9 +4368,6 @@ impl Service {
if let Some(scheduling) = scheduling {
node.set_scheduling(scheduling);
-
- // TODO: once we have a background scheduling ticker for fill/drain, kick it
- // to wake up and start working.
}
// Update the scheduler, in case the elegibility of the node for new shards has changed
@@ -4433,7 +4442,7 @@ impl Service {
// TODO: in the background, we should balance work back onto this pageserver
}
AvailabilityTransition::Unchanged => {
- tracing::debug!("Node {} no change during config", node_id);
+ tracing::debug!("Node {} no availability change during config", node_id);
}
}