fix(pbs): Verify forces ignore-verified=false; restore-test source_tier from storage type
Live PBS runbook surfaced two gaps: (1) PBS verify defaults to ignore-verified=true and
SKIPS already-verified snapshots, so corruption after the first verify is never caught —
the agent's integrity check now POSTs ignore-verified=false to actually re-read+re-check.
(2) restore-test source_tier was hardcoded 'local'; now derived from the source storage
type ('pbs' for a PBS datastore). Adds a form-POST path to the PBS client.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -346,6 +346,21 @@ func pbsTargetsFromPVE(cfg config.Config, px *proxmox.Client, logger *slog.Logge
|
||||
}
|
||||
}
|
||||
|
||||
// storageTier returns the restore-test source tier for a backup storage id: "pbs" when that
|
||||
// storage is a PBS datastore, else "local". Best-effort (a lookup failure → "local").
|
||||
func storageTier(ctx context.Context, px *proxmox.Client, storageID string) string {
|
||||
stores, err := px.ListStorage(ctx)
|
||||
if err != nil {
|
||||
return "local"
|
||||
}
|
||||
for _, s := range stores {
|
||||
if s.Storage == storageID && s.Type == "pbs" {
|
||||
return "pbs"
|
||||
}
|
||||
}
|
||||
return "local"
|
||||
}
|
||||
|
||||
// readTrimmed reads a file and trims surrounding whitespace/newline (for the .pw secret).
|
||||
func readTrimmed(path string) (string, error) {
|
||||
b, err := os.ReadFile(path)
|
||||
@@ -381,7 +396,7 @@ func buildRestoreTestScheduler(cfg config.Config, px *proxmox.Client, engine *re
|
||||
RestoreStorage: cfg.Backup.RestoreStorage,
|
||||
ScratchMin: min,
|
||||
ScratchMax: max,
|
||||
SourceTier: "local",
|
||||
SourceTier: storageTier(context.Background(), px, cfg.Backup.LocalBackupTarget),
|
||||
},
|
||||
Cadence: cadence,
|
||||
Logger: logger,
|
||||
@@ -665,7 +680,7 @@ func runSelftestRestoreTest(ctx context.Context, cfg config.Config, logger *slog
|
||||
fmt.Printf(" restoring %s into scratch band [%d,%d] on %s …\n", archive, min, max, cfg.Backup.RestoreStorage)
|
||||
res := engine.RunRestoreTest(ctx, reconcile.RestoreTestSpec{
|
||||
Archive: archive, RestoreStorage: cfg.Backup.RestoreStorage,
|
||||
ScratchMin: min, ScratchMax: max, SourceTier: "local",
|
||||
ScratchMin: min, ScratchMax: max, SourceTier: storageTier(ctx, px, cfg.Backup.LocalBackupTarget),
|
||||
})
|
||||
printJSON("restore-test record", backup.ToHubRestoreTest(res, time.Now().UTC()))
|
||||
if res.Skipped {
|
||||
|
||||
Reference in New Issue
Block a user