Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Correct PBS unread-inventory lifecycle controls

pulse-triage[bot]18d284893a4c
diff --git a/internal/monitoring/pbs_inventory_envelope_test.go b/internal/monitoring/pbs_inventory_envelope_test.go
index 8bed6e500f..0316b15094 100644
--- a/internal/monitoring/pbs_inventory_envelope_test.go
+++ b/internal/monitoring/pbs_inventory_envelope_test.go
@@ -77,6 +77,14 @@ func TestPBSMissingInventoryArrayRetainsUnreadScope(t *testing.T) {
}
}
for _, p := range f.postures(t) {
+ // With no accepted point, this guest has no established
+ // provider association. Do not invent one from its VMID.
+ if !warm && p.SubjectResourceID == f.ids[1] {
+ if p.State != recovery.ProtectionStateUnknown || len(p.ProviderStates) != 0 {
+ t.Errorf("cold unread guest gained evidence or protection: %+v", p)
+ }
+ continue
+ }
if p.State == recovery.ProtectionStateProtected || len(p.ProviderStates) != 1 ||
p.ProviderStates[0].HistoryCompleteness != recovery.ProtectionHistoryPartial ||
p.ProviderStates[0].Permissions != operationaltrust.EvidencePermissionsUnknown {
@@ -170,7 +178,13 @@ func TestPBSMissingInventoryArrayConsumerLifecycle(t *testing.T) {
if phase == "confirmed-empty" {
want = 0
}
- if len(f.live()) != want || len(f.points(t, "pbs-main")) != want {
+ wantPoints := want
+ if phase == "missing-namespaces" || phase == "null-groups" || phase == "null-snapshots" {
+ // The accepted root advances, but an incomplete scan cannot delete
+ // its older historical point while preserving the unread tenant.
+ wantPoints = 3
+ }
+ if len(f.live()) != want || len(f.points(t, "pbs-main")) != wantPoints {
t.Fatalf("phase %s lost or invented backup facts", phase)
}
frames[phase] = map[string]any{"pbs": map[string]any{"data": map[string]any{"backups": f.m.state.GetSnapshot().PBSBackups}}, "postures": map[string]any{"data": postures, "policy": recovery.DefaultProtectionPosturePolicy.Payload()}, "points": f.points(t, "pbs-main")}
diff --git a/internal/monitoring/pbs_poll_posture_test.go b/internal/monitoring/pbs_poll_posture_test.go
index f89b1a5025..d5eb3d2858 100644
--- a/internal/monitoring/pbs_poll_posture_test.go
+++ b/internal/monitoring/pbs_poll_posture_test.go
@@ -76,7 +76,7 @@ func newPBSPosturePollFixture(t *testing.T, count int, backupTypes ...string) *p
http.Error(w, "denied", http.StatusForbidden)
return
}
- var groups []map[string]any
+ groups := make([]map[string]any, 0)
if mode != 1 {
for i := 0; i < count; i++ {
groups = append(groups, map[string]any{"backup-type": backupType, "backup-id": strconv.Itoa(100 + i), "last-backup": f.backupAt, "backup-count": 1})
diff --git a/pkg/pbs/client.go b/pkg/pbs/client.go
index 28bc0c7469..fabb015558 100644
--- a/pkg/pbs/client.go
+++ b/pkg/pbs/client.go
@@ -1465,8 +1465,6 @@ func (c *Client) getJobConfigMap(ctx context.Context, path string) (map[string]i
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, err
}
- // Match datastore discovery: missing/null data is unread, not an empty
- // scope that can authorize removal of retained backup history.
if result.Data == nil {
result.Data = map[string]interface{}{}
}
@@ -1966,6 +1964,8 @@ func (c *Client) ListNamespaces(ctx context.Context, datastore string, parentNam
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, err
}
+ // Match datastore discovery: missing/null data is unread, not an empty
+ // scope that can authorize removal of retained backup history.
if result.Data == nil {
return nil, fmt.Errorf("namespace list response contains no data array")
}