topology: drop manager-root special case + notify three agents on reparent (#743)

This commit is contained in:
damocles 2026-05-31 13:23:00 +02:00 committed by Mara
commit 2c3b62be55
4 changed files with 139 additions and 20 deletions

View file

@ -2188,16 +2188,21 @@ async fn post_set_parent(
.map(str::trim)
.filter(|s| !s.is_empty())
.map(str::to_owned);
match crate::topology::set_parent(&child, new_parent.as_deref()) {
// `reparent_with_notify` wraps `topology::set_parent` with the
// three notification messages (#743) + the ContainerView rescan.
// Idempotent same-parent calls skip both the messages and the
// disk write per the topology fast-path.
match state
.coord
.reparent_with_notify(&child, new_parent.as_deref())
.await
{
Ok(()) => {
tracing::info!(
child = %child,
new_parent = ?new_parent,
"operator: set-parent via dashboard"
);
// Topology drives ContainerView.parent; refresh the
// snapshot so connected viewers see the new tree.
state.coord.rescan_containers_and_emit().await;
(StatusCode::OK, "ok").into_response()
}
Err(e) => error_response(&format!("set-parent {child} failed: {e}")),