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.

fix(alerts): preserve empty PVE disk alert reference

pulse-triage[bot]e85f1a4eedb5
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index f54532363e..667324a2ef 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -4489,7 +4489,9 @@ canonical aliases include the persisted PVE disk-alert reference
one constructor for that legacy reference. It is a lookup alias, never the
disk's primary canonical ID or source ID, and must not leak across nodes,
instances or non-disk resources. Ambiguous alias claims still fail closed under
-normal reference resolution. `TestProxmoxDiskAlertAliasIsScopedAndNotPrimaryIdentity`
+normal reference resolution. An absent device path retains the historical
+empty-key alert reference, distinct from the root-device key, but cannot be
+claimed as a disk alias without a device path. `TestProxmoxDiskAlertAliasIsScopedAndNotPrimaryIdentity`
pins the identity boundary, and the registry-backed monitoring mute test pins
its operator-state consumer.
When host-agent SMART and Proxmox physical-disk rows merge, the unified
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.go
index 257841ce14..46bc008b69 100644
--- a/internal/alerts/alerts_test.go
+++ b/internal/alerts/alerts_test.go
@@ -429,6 +429,7 @@ func TestProxmoxDiskCanonicalResourceIDTrimsIdentity(t *testing.T) {
{"trimmed source identity", " inst ", " node ", "/dev/sda", "inst:node:disk:dev-sda"},
{"nested device path", "inst", "node", "/dev/disk/by-id/ATA_DISK", "inst:node:disk:dev-disk-by-id-ata-disk"},
{"root path", "inst", "node", "/", "inst:node:disk:root"},
+ {"missing path keeps legacy identity", "inst", "node", "", "inst:node:disk:"},
} {
t.Run(tt.name, func(t *testing.T) {
if got := proxmoxDiskCanonicalResourceID(tt.instance, tt.node, tt.path); got != tt.want {
diff --git a/internal/unifiedresources/canonical_identity_test.go b/internal/unifiedresources/canonical_identity_test.go
index b99ed9bfae..bd3ed50a21 100644
--- a/internal/unifiedresources/canonical_identity_test.go
+++ b/internal/unifiedresources/canonical_identity_test.go
@@ -171,6 +171,18 @@ func TestProxmoxDiskAlertAliasIsScopedAndNotPrimaryIdentity(t *testing.T) {
assertAlias(ProxmoxPhysicalDiskAlertResourceID("pve-a", "node-2", "/dev/sda"), true)
resource.Type = ResourceTypeStorage
assertAlias(ProxmoxPhysicalDiskAlertResourceID("pve-a", "node-2", "/dev/sda"), false)
+ resource.Type = ResourceTypePhysicalDisk
+ resource.PhysicalDisk.DevPath = ""
+ assertAlias(ProxmoxPhysicalDiskAlertResourceID("pve-a", "node-2", ""), false)
+}
+
+func TestProxmoxPhysicalDiskAlertResourceIDPreservesEmptyDevicePath(t *testing.T) {
+ if got, want := ProxmoxPhysicalDiskAlertResourceID("pve-a", "node-1", ""), "pve-a:node-1:disk:"; got != want {
+ t.Fatalf("empty device path reference = %q, want %q", got, want)
+ }
+ if got, want := ProxmoxPhysicalDiskAlertResourceID("pve-a", "node-1", "/"), "pve-a:node-1:disk:root"; got != want {
+ t.Fatalf("root device path reference = %q, want %q", got, want)
+ }
}
func TestUnavailableMemoryFacetsDoNotChangeCanonicalIdentity(t *testing.T) {
diff --git a/internal/unifiedresources/physical_disk_ids.go b/internal/unifiedresources/physical_disk_ids.go
index 517a8bb8f2..45ef9ce537 100644
--- a/internal/unifiedresources/physical_disk_ids.go
+++ b/internal/unifiedresources/physical_disk_ids.go
@@ -74,6 +74,11 @@ func ProxmoxPhysicalDiskAlertResourceID(instance, node, device string) string {
func physicalDiskAlertKey(device string) string {
trimmed := strings.TrimSpace(device)
+ // Persisted alert references used an empty key when the device path was
+ // absent. Keep that spelling distinct from the root-device key.
+ if trimmed == "" {
+ return ""
+ }
if trimmed == "/" {
return "root"
}