hivectl: rename hivectl agents to hivectl agent <name> <verb>

This commit is contained in:
damocles 2026-07-27 19:00:44 +02:00 committed by mara
commit 03afbd1316
19 changed files with 367 additions and 525 deletions

View file

@ -112,10 +112,6 @@ pub enum HostRequest {
/// `true` pauses, `false` resumes. Idempotent either way.
paused: bool,
},
/// Stop and restart all managed containers in sequence. Convenience
/// wrapper for `hivectl agents restart-all`; iterates the live
/// container list and restarts each one.
RestartAll,
/// Restart containers hive-wide (`hivectl restart`), scoped like
/// `Stop`/`Start`. Each targeted agent rides exactly one DAG
/// server-side — the `Restart` template (mechanical stop + reconcile),
@ -146,7 +142,7 @@ pub enum HostRequest {
/// persistent state dir under the agents root. Answered daemon-side
/// because that root is `0700 hive-core`: a client stat-ing it
/// without root gets EACCES, so the pre-flight "does this agent
/// exist?" guard in front of `hivectl choom` / `agents subvol` used
/// exist?" guard in front of `hivectl agent <name> choom` / `subvol` used
/// to fail with a permission error instead of an answer. The daemon
/// already runs as the owning user and does the same check for its
/// own provisioning paths. Result: [`HostResponse::agent_exists`].
@ -157,7 +153,7 @@ pub enum HostRequest {
AgentExists { name: Ident },
/// List managed agents with their full status + technical state
/// (running / needs-login / needs-update / deployed sha / parent /
/// pending reminders) — the `hivectl agents list` roster view.
/// pending reminders) — the `hivectl list-agents` roster view.
/// Reuses the dashboard's per-agent `ContainerView` aggregation.
AgentStatus,
/// Report this hive's canonical DNS domain
@ -309,43 +305,46 @@ pub enum HostRequest {
/// the agent's `gh` wrapper / git credential helper — no rebuild needed.
SetAgentGithubToken { agent: Ident, token: String },
/// Turn on btrfs qgroup accounting on the agent-state filesystem, via
/// the privileged helper. Daemon-side equivalent of `hivectl agents quota
/// enable`. Returns advisory lines in [`HostResponse::messages`].
/// the privileged helper. Daemon-side equivalent of `hivectl
/// quota-enable`. Returns advisory lines in [`HostResponse::messages`].
QuotaEnable,
/// Set (or, with `limit = None`, clear) an agent's btrfs disk quota via
/// the privileged helper. Daemon-side equivalent of `hivectl agents quota
/// set`; the size string is parsed to bytes client-side. Returns a
/// bare success — the client prints the confirmation from the value it
/// sent.
/// the privileged helper. Daemon-side equivalent of `hivectl agent
/// <name> quota set`; the size string is parsed to bytes client-side.
/// Returns a bare success — the client prints the confirmation from
/// the value it sent.
QuotaLimit {
name: Ident,
#[serde(default)]
limit: Option<u64>,
},
/// Report per-agent btrfs qgroup usage (`hivectl agents quota show [name]`).
/// The daemon resolves the agent set (all kept state dirs when `name`
/// is absent) and reads each subvolume's referenced/exclusive usage via
/// the privileged helper. Result rows land in [`HostResponse::quota`];
/// a "btrfs quota not enabled" error short-circuits the whole sweep as a
/// plain [`HostResponse::error`] so the client can print the enable hint.
/// Report btrfs qgroup usage (`hivectl agent <name> quota show`, or all
/// kept state dirs when `name` is absent — no CLI path reaches the
/// absent case today, but the daemon still supports it). The daemon
/// resolves the agent set and reads each subvolume's referenced/
/// exclusive usage via the privileged helper. Result rows land in
/// [`HostResponse::quota`]; a "btrfs quota not enabled" error
/// short-circuits the whole sweep as a plain [`HostResponse::error`]
/// so the client can print the enable hint.
QuotaShow {
#[serde(default)]
name: Option<Ident>,
},
/// Migrate an agent's plain state dir to a btrfs subvolume via the
/// privileged helper (`hivectl agents subvol upgrade`). The agent MUST already
/// be stopped — the client orchestrates stop → this → start. Returns a
/// bare success; the client prints its own progress lines.
/// privileged helper (`hivectl agent <name> subvol upgrade`). The agent
/// MUST already be stopped — the client orchestrates stop → this →
/// start. Returns a bare success; the client prints its own progress
/// lines.
UpgradeSubvolume { name: Ident },
/// Create a read-only btrfs snapshot of an agent's state subvolume
/// (`hivectl agents subvol snapshot create`). `label` is validated client-side
/// AND by hive-priv. Returns the snapshot's host path in
/// [`HostResponse::messages`].
/// (`hivectl agent <name> subvol snapshot create`). `label` is
/// validated client-side AND by hive-priv. Returns the snapshot's
/// host path in [`HostResponse::messages`].
SnapshotSubvolume { name: Ident, label: String },
/// Delete a snapshot created by `SnapshotSubvolume` (`hivectl agents subvol
/// Delete a snapshot created by `SnapshotSubvolume` (`hivectl agent <name> subvol
/// snapshot delete`). Bare success; the client prints the confirmation.
DeleteSnapshot { name: Ident, label: String },
/// Export a snapshot to a local file via `btrfs send` (`hivectl agents subvol
/// Export a snapshot to a local file via `btrfs send` (`hivectl agent <name> subvol
/// snapshot send`). `dest` is a bare filename (hive-priv rejects paths);
/// `parent` names an optional parent snapshot for an incremental send.
/// Returns the written file's host path in [`HostResponse::messages`].