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.

Exercise accepted poll publication in disk fallback lifecycle proof

pulse-triage[bot]32342c32c9d6
diff --git a/internal/models/models.go b/internal/models/models.go
index 604f44c486..2cac70203e 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -3228,7 +3228,6 @@ func (i GuestNetworkInterface) NormalizeCollections() GuestNetworkInterface {
return i
}
-// Disk represents disk usage
// GuestDiskObservation keeps a QEMU filesystem reading's original source time
// through internal snapshots. DiskStatusReason owns current/retained display
// state; a linked Pulse agent remains a separate source. This is not wire data.
@@ -3237,6 +3236,7 @@ type GuestDiskObservation struct {
ObservedAt time.Time
}
+// Disk represents disk usage
type Disk struct {
Total int64 `json:"total"`
Used int64 `json:"used"`
diff --git a/internal/monitoring/guest_disk_expiry_test.go b/internal/monitoring/guest_disk_expiry_test.go
index 8576f6987c..53c860aa51 100644
--- a/internal/monitoring/guest_disk_expiry_test.go
+++ b/internal/monitoring/guest_disk_expiry_test.go
@@ -192,7 +192,10 @@ func testGuestDiskOrdinaryDeferralExpiryAndRecovery(t *testing.T) {
res := proxmox.ClusterResource{Type: "qemu", Node: "node", Name: "windows", VMID: 105, Status: "running", MaxMem: 8 * mib, Mem: 2 * mib, MaxDisk: 1000 * mib, CPU: .2}
id := makeGuestID("disk-expiry", "node", 105)
publish := func(vm models.VM) {
- registry.IngestSnapshot(models.StateSnapshot{VMs: []models.VM{vm}})
+ // An accepted poll owns publication. Read hydration may reuse a
+ // recent generation and is not an ingestion boundary.
+ m.state.UpdateVMs([]models.VM{vm})
+ m.updateResourceStore(m.currentStateWithScope())
}
build := func(ctx context.Context) models.VM {
t.Helper()
@@ -214,7 +217,7 @@ func testGuestDiskOrdinaryDeferralExpiryAndRecovery(t *testing.T) {
}
publish(vm)
m.recordGuestMetrics([]models.VM{vm}, nil, time.Now().Add(-time.Second))
- view := registry.VMs()[0]
+ view := m.currentModeReadState().VMs()[0]
if view.DiskStatusReason() != vm.DiskStatusReason || view.DiskObservation() != vm.DiskObservation {
t.Fatal("source disk observation changed at canonical read boundary")
}
@@ -225,7 +228,7 @@ func testGuestDiskOrdinaryDeferralExpiryAndRecovery(t *testing.T) {
}
var served []struct{ Proxmox unifiedresources.ProxmoxData }
if err := json.Unmarshal(wire, &served); err != nil || len(served) != 1 || served[0].Proxmox.DiskStatusReason != vm.DiskStatusReason {
- t.Fatal("served source reason differs from the observed poll")
+ t.Fatalf("served source reason differs from poll %q: %s / %v", vm.DiskStatusReason, wire, err)
}
return vm
}