ee87cca16e
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
4.8 KiB
Markdown
64 lines
4.8 KiB
Markdown
# REPORT — felhom-controller v0.57.0 (UI fixes: stable host-storage list + Tier-2 config panel)
|
||
|
||
Part A of the "UI fixes (Part A) + storage-restructure spike (Part B)" spec. Part A ships a single
|
||
controller version bump (v0.57.0); Part B builds nothing (findings report — see below). Built,
|
||
deployed, and live-validated on guest 9201.
|
||
|
||
## A1 — host-storage list no longer reorders (item 2)
|
||
The monitoring page has two storage sections. v0.56.0's 4C sorted the **server-rendered, user-data-only**
|
||
list (`buildStorageBars`). The list the customer actually saw reordering was the **other** one:
|
||
`#host-storage-bars`, filled client-side from the agent's PVE-storage list (`local`, `local-lvm`,
|
||
`felhom-pbs`, `felhom-usb` with thin-pool % + temperature). The agent enumerates `pvesm` in a
|
||
non-deterministic order and this list never passed through a Go sort, so it reshuffled on every 8 s poll.
|
||
|
||
Fix (`internal/web/agent_host_metrics_handler.go`): `enrichHostStorageTargets` sorts the
|
||
`/api/host-metrics` response **server-side** — user-data (`usb`/`local-dir`) → system+apps
|
||
(`lvmthin`/`lvm`) → builtin local (`local`) → backup (`pbs`/`nfs`/`cifs`) → other; alphabetical by id
|
||
within a tier — and attaches a **friendly Hungarian label + one-line purpose** per entry. The raw PVE id
|
||
stays in `Name` and is rendered muted in `monitoring.html`. **Display labels only — PVE storage ids are
|
||
never renamed** (vzdump/PBS targets reference them by name). Decision flagged for the owner: a follow-up
|
||
could replace the raw breakdown with customer-meaningful aggregates and push the raw `local`/`local-lvm`/
|
||
`pbs` detail to an operator (hub) view; this pass takes the smallest change that fixes the confusion
|
||
(friendly labels + descriptions on the existing list).
|
||
|
||
## A2 — per-app Tier-2 config panel (item 4)
|
||
The "2. mentés" row's **Beállítás** button linked to the app deploy page (no backup-location setting — a
|
||
dead end). New surface: `GET/POST /stacks/{name}/backup` (`tier2_config_handler.go` +
|
||
`templates/tier2_config.html`), wired in `server.go` behind RequireAuth + CsrfProtect; the button is
|
||
repointed there on **every** "2. mentés" branch (configured / disconnected / inactive / unconfigured /
|
||
disabled). The panel shows the current/effective off-drive target, whether it's the size-limited internal
|
||
SSD, the last-run reason, and lets the customer **pin a different registered drive** or **turn Tier 2
|
||
off**. It is **always visible**: with only the internal SSD it shows "automatikus: belső SSD — csak
|
||
DB/konfiguráció" + the rootfs-headroom note; for a non-HDD app it shows honest "already in the PBS
|
||
whole-guest snapshot; the off-drive copy is supplementary" context (no active control, since Tier 2 does
|
||
not run for rootfs apps).
|
||
|
||
Persistence: two preference fields on `settings.CrossDriveBackup` — `UserDisabled` + `PreferredTarget`
|
||
— set via `SetTier2Preference` and **preserved across the Tier-2 runner's status writes**
|
||
(`withTier2Prefs` in `tier2.go`). `selectTier2Target` now honors a valid pinned target (registered,
|
||
schedulable, off physical disk) before the auto-pick; an invalid pin silently falls back to auto.
|
||
`RunTier2` skips a customer-disabled app. Saving with Tier 2 on for an HDD app triggers an immediate run.
|
||
|
||
## Live validation (guest 9201, v0.57.0, public URL https://felhom.demo-felhom.eu)
|
||
- **A1:** `/api/host-metrics` returns a stable order across repeated polls — `felhom-usb` →
|
||
`local-lvm` → `local` → `felhom-pbs` — each entry carrying `label` + `purpose` (e.g. `local-lvm` →
|
||
"Belső SSD – rendszer és alkalmazások"). Confirmed 3 consecutive polls identical.
|
||
- **A2 (HDD app, RomM):** panel shows Tier 2 **Bekapcsolva**, effective target "belső SSD (rendszer) —
|
||
csak DB/konfiguráció", the SSD-only banner, the "Nincs másik adatmeghajtó" help (single-drive demo),
|
||
and the enabled checkbox + target dropdown. POST disable → 303 + flash → GET shows **Kikapcsolva**;
|
||
POST re-enable → GET shows **Bekapcsolva** and the controller log records an immediate successful
|
||
Tier 2 run (RomM → SSD, 77 KB, DB/config only).
|
||
- **A2 (non-HDD app, ActualBudget):** panel shows the PBS-coverage context ("már szerepelnek a teljes
|
||
rendszermentésben (PBS) … nincs külön teendő"), no active form.
|
||
- Both `/backups` "Beállítás" buttons now target `/stacks/{name}/backup`; logs clean (no errors/panics).
|
||
|
||
## Tests
|
||
`enrichHostStorageTargets` (order, labels, determinism, unknown-type fallback);
|
||
`selectTier2Target` (honors a pin / falls back on an invalid pin); status writes preserve the
|
||
preference. Full `go test ./...` green.
|
||
|
||
## Part B — storage-restructure spike
|
||
Build-nothing investigation; the findings report gating the provisioning spec is at
|
||
`felhom-agent/REPORT-storage-split-spike.md` (and summarised in that repo's CHANGELOG). Nothing in the
|
||
controller changed for Part B.
|