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.

Require a current useful fallback read before claiming QGA availability

pulse-triage[bot]3407978164ed
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index f032c6fece..4b1b9fa17b 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -28,7 +28,9 @@ their receipt once; expired, missing and future origins cannot admit a fallback.
The existing ten-minute boundary, authoritative unavailable status, metadata
backoff and every-command backup-lock/shared uncertainty fences remain intact.
Cached display identity remains available, but cannot upgrade a failed/empty
-refresh to current availability. Linked Pulse-agent disks remain independent.
+refresh to current availability: a fallback needs a usable filesystem or useful
+metadata observed in that cycle to claim availability. Linked Pulse-agent disks
+remain independent.
`TestGuestAgentAdmissionEvidenceContract` checks the original-age boundaries,
repeated canonical replacement and both cluster/node collectors through a
cancelled detail cycle, unavailable status, missing status and ordinary recovery
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 82801de37c..1973469f3c 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -32,7 +32,9 @@ time for the monitor's previous-state input. Resource/VM JSON, identity,
correlation and linked Pulse-agent precedence do not change.
`TestGuestAgentEvidenceDoesNotChangeWireOrIdentity` and
`TestGuestAgentEvidenceMergeAndCloneKeepsOriginalAge` check wire equality,
-identity equality, clone isolation and loss/recovery replacement.
+identity equality, clone isolation and loss/recovery replacement. The full-wire
+comparison fixes the independent construction clock for otherwise identical
+inputs; it does not omit a changed public field.
### Internal guest disk observation provenance
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index 6a8ab57e5e..089e4b4bc1 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -1135,6 +1135,7 @@ func TestGuestAgentAdmissionEvidenceContract(t *testing.T) {
t.Run("retained-identity-cannot-renew", testGuestAgentRetainedIdentityCannotRenewAdmission)
t.Run("original-age", testGuestAgentEvidenceOriginalAge)
t.Run("canonical-continuity", testGuestAgentEvidenceCanonicalContinuity)
+ t.Run("accepted-read-origins", testGuestAgentEvidenceAcceptedReadOrigins)
}
func TestProxmoxGuestDiskInventoryPrefersCanonicalLinkedHostAgentSource(t *testing.T) {
diff --git a/internal/monitoring/guest_agent_evidence_age_test.go b/internal/monitoring/guest_agent_evidence_age_test.go
index 74a710f00c..0909ef85b3 100644
--- a/internal/monitoring/guest_agent_evidence_age_test.go
+++ b/internal/monitoring/guest_agent_evidence_age_test.go
@@ -93,6 +93,50 @@ func testGuestAgentEvidenceCanonicalContinuity(t *testing.T) {
}
}
+type guestEvidencePollClient struct {
+ metadataObservationClient
+ filesystems []proxmox.VMFileSystem
+}
+
+func (c *guestEvidencePollClient) GetVMStatus(context.Context, string, int) (*proxmox.VMStatus, error) {
+ return nil, nil
+}
+
+func (c *guestEvidencePollClient) GetVMFSInfo(context.Context, string, int) ([]proxmox.VMFileSystem, error) {
+ return c.filesystems, nil
+}
+
+func testGuestAgentEvidenceAcceptedReadOrigins(t *testing.T) {
+ for _, kind := range []string{"cached-metadata-empty-filesystem", "new-useful-metadata", "new-zero-filesystem"} {
+ t.Run(kind, func(t *testing.T) {
+ origin := time.Now().Add(-time.Minute)
+ cached := metadataObservationFixture(origin)
+ client := &guestEvidencePollClient{}
+ if kind == "new-useful-metadata" {
+ cached.fetchedAt = origin.Add(-20 * time.Minute)
+ client.version = "2.0"
+ }
+ if kind == "new-zero-filesystem" {
+ client.filesystems = []proxmox.VMFileSystem{{Mountpoint: "/", Type: "ext4", TotalBytes: 1000}}
+ }
+ m := &Monitor{rateTracker: NewRateTracker(), guestMetadataCache: map[string]guestMetadataCacheEntry{guestMetadataCacheKey("pve", "node", 105): cached}}
+ prev := models.VM{Type: "qemu", LastSeen: time.Now(), AgentVersion: "cached", GuestAgentEvidence: models.GuestAgentEvidence{Explicit: true, ObservedAt: origin}}
+ before := time.Now()
+ vm, _, _, _, _, ok := m.buildVMFromClusterResource(context.Background(), "pve", proxmox.ClusterResource{Type: "qemu", Node: "node", VMID: 105, Status: "running", MaxMem: 8000, MaxDisk: 1000}, client, "pve:node:105", nil, &prev)
+ if !ok {
+ t.Fatal("guest disappeared")
+ }
+ if kind == "cached-metadata-empty-filesystem" {
+ if vm.GuestAgentStatus == "available" || vm.GuestAgentEvidence.ObservedAt != origin || vm.AgentVersion != "1.0" || client.calls != 0 {
+ t.Fatalf("cached metadata renewed eligibility or availability: %+v / calls=%d", vm, client.calls)
+ }
+ } else if vm.GuestAgentStatus != "available" || vm.GuestAgentEvidence.ObservedAt.Before(before) || !hasRecentGuestAgentEvidence(&vm, time.Now()) {
+ t.Fatalf("current useful read did not restore its original eligibility time: %+v", vm)
+ }
+ })
+ }
+}
+
// This body also runs on the exact parent: optional identity preservation is
// not a new guest-agent observation. All HTTP endpoints here are synthetic.
func testGuestAgentRetainedIdentityCannotRenewAdmission(t *testing.T) {
diff --git a/internal/monitoring/monitor_pve_guest_builders.go b/internal/monitoring/monitor_pve_guest_builders.go
index 8424b2c405..f5ce2b4ef2 100644
--- a/internal/monitoring/monitor_pve_guest_builders.go
+++ b/internal/monitoring/monitor_pve_guest_builders.go
@@ -335,7 +335,9 @@ func (m *Monitor) buildVMFromClusterResource(
state.guestAgentExpected = true
// Cached strings are display continuity, not a new successful read.
- if state.guestAgentStatus != "deferred" && (state.diskFromAgent || m.hasRecentGuestMetadataEvidence(instanceName, res.Node, res.VMID, time.Now())) {
+ metadataAt := m.guestMetadataEvidenceTime(instanceName, res.Node, res.VMID)
+ metadataObserved := !metadataAt.Before(prePollTime) && !metadataAt.After(time.Now())
+ if state.guestAgentStatus != "deferred" && (state.diskFromAgent || metadataObserved) {
state.guestAgentStatus = "available"
}
}
diff --git a/internal/unifiedresources/canonical_identity_test.go b/internal/unifiedresources/canonical_identity_test.go
index 6d6a58ef96..26ef04fd68 100644
--- a/internal/unifiedresources/canonical_identity_test.go
+++ b/internal/unifiedresources/canonical_identity_test.go
@@ -37,6 +37,9 @@ func TestGuestAgentEvidenceDoesNotChangeWireOrIdentity(t *testing.T) {
}
vm.GuestAgentEvidence = models.GuestAgentEvidence{}
legacyResource, legacyIdentity := resourceFromVM(vm)
+ // Construction captures the wall clock independently; hold that unrelated
+ // timestamp fixed while comparing every public byte of these same inputs.
+ legacyResource.UpdatedAt = resource.UpdatedAt
legacyWire, err := json.Marshal(legacyResource)
if err != nil || string(wire) != string(legacyWire) || !reflect.DeepEqual(identity, legacyIdentity) {
t.Fatal("internal admission evidence changed guest identity or public bytes")