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.

Match nvme-eui zpool member references to physical disks

rcourtman4dcc18fbd41e
diff --git a/internal/monitoring/physical_disk_pool_membership.go b/internal/monitoring/physical_disk_pool_membership.go
index 1d4add882d..209317309f 100644
--- a/internal/monitoring/physical_disk_pool_membership.go
+++ b/internal/monitoring/physical_disk_pool_membership.go
@@ -74,6 +74,7 @@ func (a *diskPoolAssignment) lookup(disk models.PhysicalDisk) string {
}
wwn := strings.ToLower(strings.TrimSpace(disk.WWN))
wwn = strings.TrimPrefix(wwn, "0x")
+ wwn = strings.TrimPrefix(wwn, "eui.")
if wwn != "" {
if pool, ok := a.serialPool[wwn]; ok {
return pool
@@ -197,6 +198,12 @@ func serialFromByID(raw string) string {
if idx := strings.LastIndex(name, "-part"); idx > 0 {
name = name[:idx]
}
+ // NVMe pools are often built from nvme-eui.<hex> references (the
+ // installer's pick when identical models share a box); the hex is the
+ // device's WWN/EUI, which smartctl reports as "eui.<hex>" or "0x<hex>".
+ if strings.HasPrefix(name, "nvme-eui.") {
+ return strings.TrimPrefix(name, "nvme-eui.")
+ }
// The last underscore-separated token is typically the serial.
if idx := strings.LastIndex(name, "_"); idx > 0 {
return name[idx+1:]
diff --git a/internal/monitoring/physical_disk_pool_membership_test.go b/internal/monitoring/physical_disk_pool_membership_test.go
index 7addc6d505..4cebdf6cc3 100644
--- a/internal/monitoring/physical_disk_pool_membership_test.go
+++ b/internal/monitoring/physical_disk_pool_membership_test.go
@@ -34,6 +34,12 @@ func TestDiskPoolAssignmentLookup(t *testing.T) {
{Name: "wwn-0x50014ee2123456ab", Leaf: 1},
},
},
+ {
+ Name: "flash",
+ Devices: []proxmox.ZFSPoolDevice{
+ {Name: "/dev/disk/by-id/nvme-eui.0025385b91501234-part3", Leaf: 1},
+ },
+ },
}
assignment := buildDiskPoolAssignment(pools)
@@ -48,6 +54,16 @@ func TestDiskPoolAssignmentLookup(t *testing.T) {
disk: models.PhysicalDisk{DevPath: "/dev/sda", Serial: "S5Y2NX0R500001Z"},
want: "rpool",
},
+ {
+ label: "nvme-eui by-id leaf matches disk WWN in eui form",
+ disk: models.PhysicalDisk{DevPath: "/dev/nvme0n1", WWN: "eui.0025385B91501234"},
+ want: "flash",
+ },
+ {
+ label: "nvme-eui by-id leaf matches disk WWN in 0x form",
+ disk: models.PhysicalDisk{DevPath: "/dev/nvme0n1", WWN: "0x0025385b91501234"},
+ want: "flash",
+ },
{
label: "short leaf name matches partition-stripped devpath",
disk: models.PhysicalDisk{DevPath: "/dev/sdc"},