diff --git a/hive-c0re/src/bin/hivectl.rs b/hive-c0re/src/bin/hivectl.rs index 92085413..bdcc6c48 100644 --- a/hive-c0re/src/bin/hivectl.rs +++ b/hive-c0re/src/bin/hivectl.rs @@ -620,6 +620,24 @@ enum SubvolCmd { #[arg(long)] yes: bool, }, + /// Create a read-only snapshot of an agent's state subvolume — the + /// first step of the (in-progress) inter-hive migration path, or a + /// manual point-in-time backup. Agent must already be a subvolume + /// (`subvol upgrade` first). Prints the snapshot's host path. + Snapshot { + /// Agent name (e.g. `damocles`, `iris`). + name: String, + /// Snapshot label (`[A-Za-z0-9_.-]`); defaults to a UTC timestamp. + #[arg(long)] + label: Option, + }, + /// Delete a snapshot created by `subvol snapshot`. + DeleteSnapshot { + /// Agent name the snapshot belongs to. + name: String, + /// Snapshot label passed to `subvol snapshot --label`. + label: String, + }, } #[tokio::main] @@ -693,6 +711,10 @@ async fn main() -> Result<()> { Cmd::Restart { scope, graceful } => restart(&socket, scope.to_scope(), graceful).await, Cmd::Subvol { cmd } => match cmd { SubvolCmd::Upgrade { name, yes } => subvol_upgrade(&socket, &name, yes).await, + SubvolCmd::Snapshot { name, label } => subvol_snapshot(&name, label).await, + SubvolCmd::DeleteSnapshot { name, label } => { + subvol_delete_snapshot(&name, &label).await + } }, Cmd::Choom { name, @@ -1703,6 +1725,38 @@ async fn subvol_upgrade(socket: &Path, name: &str, yes: bool) -> Result<()> { Ok(()) } +/// `subvol snapshot [--label