v0.5.1: live-validation prep — fix unmounted-dir durable_id mis-id + watchdog UUID memory

Surfaced preparing the live USB validation on demo-felhom:
- observe.go: an unmounted removable dir-storage no longer falls through to the ROOT fs
  for its backing device/UUID — durable_id was becoming uuid:<root-uuid> (a DR mis-id that
  would re-attach the wrong disk). Now derived only from the target's own mountpoint;
  unmounted → no device + stable store:<name> durable_id. Removed containingMountDevice.
- watchdog.go: remember the fs-UUID observed while attached and backfill it onto the
  re-mount target, so re-mount works even if the known-set cache refreshed mid-drop
  (doc 03 §7 "sourced from the existing definition").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 11:01:40 +02:00
parent 9d6e49236c
commit 77b4f21450
6 changed files with 90 additions and 23 deletions
+10
View File
@@ -4,6 +4,7 @@ import (
"context"
"io"
"log/slog"
"strings"
"testing"
"gitea.dooplex.hu/admin/felhom-agent/internal/hub"
@@ -249,6 +250,15 @@ func TestObserve_USBUnpluggedIsDisconnected(t *testing.T) {
if usb.DurableID == "" {
t.Errorf("durable_id must never be empty (DR re-attach lookup)")
}
// CRITICAL: an unmounted dir-storage must NOT inherit the ROOT filesystem's UUID/device
// (that would re-attach the WRONG disk on DR). With only root mounted, the USB target
// resolves to no device and a stable store-id durable_id — never "uuid:<root-uuid>".
if strings.HasPrefix(usb.DurableID, "uuid:") {
t.Errorf("unmounted target must not carry a uuid durable_id (got %q — root-UUID mis-id risk)", usb.DurableID)
}
if usb.BackingDevice != "" {
t.Errorf("unmounted target must not resolve a backing device (got %q)", usb.BackingDevice)
}
}
func TestObserve_ProxmoxErrorIsFatalForStorage(t *testing.T) {