refactor(hivectl): move quota + subvol under agents

Both groups only ever act on a single managed agent's state dir, so
they belong in the `agents` namespace rather than as top-level verbs
next to `forge` / `matrix` / `wg`.

Renames `quota limit` -> `quota set`: the enclosing group already
carries the noun, so the bare verb matches the flat `set-parent` /
`set-limits` spelling without stuttering, and it removes the
`set-limits` (cpu/mem) vs `quota limit` (disk) ambiguity. Adds a
cross-pointer from `set-limits` to `agents quota`.

Handlers stay in their own modules; `run_agents` gains the reparenting
glue. Regenerates docs/tools/hivectl-cli.md.

Refs #2724
This commit is contained in:
atlas 2026-07-26 18:15:42 +02:00 committed by mara
commit 766b1f71fb
9 changed files with 215 additions and 204 deletions

View file

@ -1,12 +1,15 @@
//! `hivectl agents` — container lifecycle over the host admin socket
//! (list/restart/restart-all/spawn/kill/destroy/rebuild/set-parent).
//! `hivectl agents` — everything scoped to a managed agent: container
//! lifecycle over the host admin socket
//! (list/restart/restart-all/pause/resume/spawn/kill/destroy/rebuild/
//! set-parent/set-limits), plus the `quota` and `subvol` groups, whose
//! handlers live in their own modules.
use std::path::Path;
use anyhow::{Context as _, Result, bail};
use hive_host_sock::HostRequest;
use crate::cli::AgentsCmd;
use crate::cli::{AgentsCmd, QuotaCmd};
use crate::dag_progress::wait_for_dags;
use crate::util::render;
@ -228,5 +231,13 @@ pub(crate) async fn run_agents(socket: &Path, cmd: AgentsCmd) -> Result<()> {
.await?,
)
}
// `quota` and `subvol` keep their own modules — this arm is just
// the reparenting glue that moved them under `agents`.
AgentsCmd::Quota { cmd } => match cmd {
QuotaCmd::Enable => crate::quota::quota_enable(socket).await,
QuotaCmd::Show { name } => crate::quota::quota_show(socket, name.as_deref()).await,
QuotaCmd::Set { name, size } => crate::quota::quota_limit(socket, &name, &size).await,
},
AgentsCmd::Subvol { cmd } => crate::subvol::dispatch_subvol(socket, cmd).await,
}
}