slice 8B.2 (agent): emit snapshotted phase at storage-snapshot moment (v0.13.0)

BackupRunner.BackupWithSnapshotHook tails the task log for the 'create storage
snapshot' marker (snapshot mode only) and fires onSnapshot once; localapi flips
/backup/status to 'snapshotted' before 'done' so the controller resumes early.
Phase 0 validated on PVE 9.2.2: marker confirmed, downtime ~24s->~1s (934MB).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 14:54:18 +02:00
parent fe7b3c4ab7
commit 570410cd1a
8 changed files with 248 additions and 18 deletions
+24
View File
@@ -3,6 +3,30 @@
All notable changes to **felhom-agent** are recorded here. Update on every code
change that gets pushed.
## v0.13.0 — slice 8B.2: quiesce downtime optimization (`snapshotted` phase) (2026-06-10)
The agent half of slice 8B.2. In snapshot mode, vzdump only needs the app-stopped state captured at
the **storage-snapshot moment**; after that it reads from the snapshot and the app can resume. The
agent now emits a **`snapshotted`** phase on `GET /backup/status` when the snapshot is taken, so the
controller (v0.38.0) resumes its app early — app downtime drops from *whole-backup* to
*until-snapshot* with no loss of app-consistency. Validated Phase-0 first on PVE 9.2.2: the marker is
`INFO: create storage snapshot 'vzdump'`; downtime ~24s→~1s for a 934 MB guest.
### Added / changed (`internal/backup` + `internal/localapi`)
- **`BackupRunner.BackupWithSnapshotHook(ctx, vmid, onSnapshot)`** — while the vzdump runs, a watcher
tails the task log (`TaskLogTail`) for the **`create storage snapshot`** marker and fires
`onSnapshot` **once**. The marker only appears in snapshot mode (stop/downgraded takes no storage
snapshot), and the watcher also bails on `backup mode: stop` — so it never fires in stop mode.
(`Backup` keeps its signature for the scheduler/selftest; both share one body.)
- **`/backup/status` phase `snapshotted`** (between `running` and `done`): `handleBackup` passes the
hook → `markSnapshotted` flips the running job to `snapshotted`. `done`/`failed` semantics unchanged.
### Tests
- localapi: snapshot mode → phase reaches `snapshotted` before `done` (gated fake holds the backup
open); stop mode → `snapshotted` **never** emitted (stays running → done). runner: the watcher
fires `onSnapshot` on the marker; in stop-mode log it never fires. `snapshotWatchInterval` is a
package var so tests run fast.
## v0.12.0 — slice 8C Phase A: disk endpoints + data-bearing classifier gate + mkfs executor (2026-06-10)
The agent half of slice 8C, Phase A (additive). Adds the host disk-management endpoints the