feat(#2391): btrfs SnapshotAgentSubvolume/DeleteAgentSnapshot priv ops
Adds the first missing piece from #2391's migration-gaps list: a read-only btrfs snapshot priv op so hivectl migrate can freeze a consistent point-in-time copy of an agent's state subvolume for btrfs send, without stopping the live agent. - PrivRequest::SnapshotAgentSubvolume / DeleteAgentSnapshot (hive-sh4re) - hive-priv handlers: btrfs subvolume snapshot -r / delete, sibling dot-prefixed path (<AGENT_STATE_ROOT>/.<agent>.snapshot.<label>) - hive-c0re::priv_client wrappers - hivectl subvol snapshot / delete-snapshot verbs (no agent stop needed — btrfs snapshots are atomic against a live subvolume) Does not yet wire actual btrfs send/receive or the hivectl migrate verb — those stay tracked on #2391 as separate follow-up pieces.
This commit is contained in:
parent
0bfe47458c
commit
7799e0762a
4 changed files with 219 additions and 0 deletions
|
|
@ -580,6 +580,38 @@ pub enum PrivRequest {
|
|||
agent_name: String,
|
||||
},
|
||||
|
||||
/// Create a read-only snapshot of an agent's state subvolume
|
||||
/// (`btrfs subvolume snapshot -r <agent_root> <snapshot_path>`). Used as
|
||||
/// the first step of inter-hive migration (`hivectl migrate`): freezing
|
||||
/// a consistent point-in-time copy that `btrfs send` can stream from
|
||||
/// while the source subvolume keeps running underneath the live agent.
|
||||
///
|
||||
/// The snapshot is created as a sibling of the agent's state root
|
||||
/// (`<AGENT_STATE_ROOT>/.<agent_name>.snapshot.<snapshot_name>`, dot-prefixed
|
||||
/// so it never collides with a real agent name) and its path is returned
|
||||
/// verbatim in the response's `stdout`. Fails if the agent's state root
|
||||
/// isn't a btrfs subvolume (nothing to snapshot) or a snapshot with the
|
||||
/// same name already exists. Requires root.
|
||||
SnapshotAgentSubvolume {
|
||||
/// Logical agent name (validated by `validate_agent_name`).
|
||||
agent_name: String,
|
||||
/// Snapshot label (validated like a credential name:
|
||||
/// non-empty `[A-Za-z0-9_.-]`); becomes part of the snapshot path.
|
||||
snapshot_name: String,
|
||||
},
|
||||
|
||||
/// Delete a previously-created read-only snapshot
|
||||
/// (`btrfs subvolume delete <snapshot_path>`). Cleanup counterpart to
|
||||
/// [`PrivRequest::SnapshotAgentSubvolume`] — called once a migration's
|
||||
/// `btrfs send` has completed (or aborted) and the frozen copy is no
|
||||
/// longer needed. No-op if the snapshot path doesn't exist. Requires root.
|
||||
DeleteAgentSnapshot {
|
||||
/// Logical agent name (validated by `validate_agent_name`).
|
||||
agent_name: String,
|
||||
/// Snapshot label, same validation as `SnapshotAgentSubvolume`.
|
||||
snapshot_name: String,
|
||||
},
|
||||
|
||||
/// Write `/etc/tmpfiles.d/hyperhive-agents.conf` for the given agent set
|
||||
/// and immediately apply it with `systemd-tmpfiles --create`. Each entry
|
||||
/// declares the per-agent runtime dirs (`/run/hyperhive/agents/<name>` and
|
||||
|
|
|
|||
Loading…
Reference in a new issue