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(proxmox): stabilize storage inventory refreshes

pulse-triage[bot]4f91232cc6dc
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index dd8396d11e..cc7314f00d 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,11 +1,15 @@
{
"version": 1,
- "base_sha": "325ff793c88c193431b76a9ae8c25d375504a3cd",
- "verified_at": "2026-08-27T00:41:31Z",
+ "base_sha": "96add5d57a2b703e756eb7157b4faa2f7db37c55",
+ "verified_at": "2026-08-27T10:04:09Z",
"result": "passed",
- "changed_paths": [],
- "content_sha256": {},
- "routes": ["/proxmox/backups"],
+ "changed_paths": [
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx": "8fb34851a8bcc32c67a4f4f156fdc32f62236a0fa8c5e2aa8b3d4dfcc8ecd47f"
+ },
+ "routes": ["/proxmox/backups/date"],
"viewports": [
{
"width": 1280,
@@ -17,16 +21,16 @@
}
],
"states": [
- "mock-mode Proxmox Backups loaded with standalone PBS server and datastore rows",
- "the backup-vault PBS row expanded into the canonical resource detail drawer",
- "Platform details expanded to expose provider context and PBS service context",
- "the canonical PBS detail drawer collapsed back to its originating row control"
+ "mock-mode Proxmox Backups loaded with backup-vault offsite-vault, backup-vault primary-vault, and dr-vault primary-vault rows in deterministic server and datastore order",
+ "the backup-vault primary-vault row expanded into the canonical resource detail drawer",
+ "the primary-vault row remained expanded after multiple two-second mock provider refreshes while row order remained unchanged",
+ "the same deterministic order and expanded primary-vault row rendered in the compact phone table"
],
"interactions": [
- "expanded backup-vault from the Backup servers table and confirmed Overview, History, and Manage sections were available",
- "expanded Platform details and confirmed provider context and PBS service context remained available in the shared drawer",
- "collapsed the drawer and confirmed keyboard focus returned to the matching backup-vault expansion control",
- "repeated the expand, Platform details, and collapse flow at 390x844 and confirmed document and body scroll widths remained equal to the 390px viewport",
- "confirmed the browser console contained no errors during the final desktop and phone verification flows"
+ "expanded the backup-vault primary-vault row and confirmed the matching detail drawer appeared",
+ "waited across multiple live mock refresh intervals and confirmed offsite-vault remained before primary-vault and the expanded row did not reset",
+ "resized from 1280x720 to 390x844 and confirmed the row stayed expanded with compact Server, State, Store, Used, and Backups columns",
+ "confirmed document and body scroll widths matched both viewports with no horizontal page overflow",
+ "confirmed the browser console contained no errors during the final desktop and phone verification flow"
]
}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
index b74b1a4672..90cd83968a 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
@@ -121,8 +121,14 @@ export function buildBackupServerRows(
// *datastore* storage resources (type 'storage', sources ['pbs']). This table
// is about the server, so keep only actual PBS server instances — otherwise a
// datastore renders as a phantom offline "server" row.
- for (const server of servers.filter((resource) => resource.type === 'pbs')) {
- const datastores = server.pbs?.datastores ?? [];
+ const sortedServers = servers
+ .filter((resource) => resource.type === 'pbs')
+ .slice()
+ .sort((left, right) => left.name.localeCompare(right.name) || left.id.localeCompare(right.id));
+ for (const server of sortedServers) {
+ const datastores = (server.pbs?.datastores ?? [])
+ .slice()
+ .sort((left, right) => left.name.localeCompare(right.name));
const memoryTotal = server.memory?.total ?? 0;
const host = {
resource: server,
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.test.ts b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.test.ts
index 595e280afb..1b52113f04 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.test.ts
@@ -41,7 +41,52 @@ describe('buildBackupServerRows', () => {
expect(row.memoryTotal).toBe(8_000);
expect(row.uptimeSeconds).toBe(1_036_800);
}
- expect(rows.map((row) => row.datastore?.name)).toEqual(['tank', 'offsite']);
+ expect(rows.map((row) => row.datastore?.name)).toEqual(['offsite', 'tank']);
+ });
+
+ it('keeps server and datastore rows stable when provider order changes', () => {
+ const firstServer = makePbsResource({
+ id: 'pbs-zulu',
+ name: 'zulu',
+ pbs: {
+ instanceId: 'zulu',
+ datastores: [
+ { name: 'tank', total: 1_000, used: 400, available: 600 },
+ { name: 'archive', total: 2_000, used: 500, available: 1_500 },
+ ],
+ },
+ });
+ const secondServer = makePbsResource({
+ id: 'pbs-alpha',
+ name: 'alpha',
+ pbs: {
+ instanceId: 'alpha',
+ datastores: [
+ { name: 'fast', total: 1_000, used: 200, available: 800 },
+ { name: 'bulk', total: 4_000, used: 1_000, available: 3_000 },
+ ],
+ },
+ });
+
+ const orderedKeys = buildBackupServerRows([firstServer, secondServer]).map((row) => row.key);
+ const reorderedKeys = buildBackupServerRows([
+ {
+ ...secondServer,
+ pbs: { ...secondServer.pbs!, datastores: [...secondServer.pbs!.datastores!].reverse() },
+ },
+ {
+ ...firstServer,
+ pbs: { ...firstServer.pbs!, datastores: [...firstServer.pbs!.datastores!].reverse() },
+ },
+ ]).map((row) => row.key);
+
+ expect(orderedKeys).toEqual([
+ 'pbs-alpha:bulk',
+ 'pbs-alpha:fast',
+ 'pbs-zulu:archive',
+ 'pbs-zulu:tank',
+ ]);
+ expect(reorderedKeys).toEqual(orderedKeys);
});
it('keeps the reachability row when a server reports no datastores or metrics', () => {
diff --git a/internal/monitoring/monitor_pve.go b/internal/monitoring/monitor_pve.go
index 7e552149e7..f6903e7a35 100644
--- a/internal/monitoring/monitor_pve.go
+++ b/internal/monitoring/monitor_pve.go
@@ -1067,6 +1067,13 @@ func (m *Monitor) maybePollPhysicalDisksAsync(
// Record each disk; alert evaluation happens after host-agent SMART merges
// so the canonical disk view includes post-merge health/wearout data.
for _, disk := range disks {
+ if fsfilters.IsVirtualBlockDevice(disk.DevPath) {
+ log.Debug().
+ Str("node", node.Node).
+ Str("device", disk.DevPath).
+ Msg("Skipping non-physical device reported by Proxmox disk inventory")
+ continue
+ }
diskID := unifiedresources.ProxmoxPhysicalDiskSourceID(
inst,
node.Node,
@@ -1213,7 +1220,7 @@ func physicalDisksFromHostAgentSMART(inst, nodeName string, smartEntries []model
disks := make([]models.PhysicalDisk, 0, len(smartEntries))
for _, smart := range smartEntries {
device := strings.TrimSpace(smart.Device)
- if device == "" {
+ if device == "" || fsfilters.IsVirtualBlockDevice(device) {
continue
}
devPath := device
diff --git a/internal/monitoring/monitor_pve_disk_fallback_test.go b/internal/monitoring/monitor_pve_disk_fallback_test.go
index 95ad533534..ec43665b34 100644
--- a/internal/monitoring/monitor_pve_disk_fallback_test.go
+++ b/internal/monitoring/monitor_pve_disk_fallback_test.go
@@ -40,6 +40,12 @@ func TestPhysicalDisksFromHostAgentSMART_BuildsDisks(t *testing.T) {
// Entries without a device name cannot form a stable ID.
Device: " ",
},
+ {
+ // Older agents may report optical drives as SMART inventory.
+ Device: "/dev/sr0",
+ Model: "DVD-ROM",
+ Type: "sata",
+ },
}
disks := physicalDisksFromHostAgentSMART("pve1", "node1", entries)
@@ -95,6 +101,17 @@ func (client *permissionDeniedDisksPVEClient) GetDisks(context.Context, string)
return nil, fmt.Errorf("403 permission check failed")
}
+type opticalDiskPVEClient struct {
+ fakeStorageClient
+}
+
+func (*opticalDiskPVEClient) GetDisks(context.Context, string) ([]proxmox.Disk, error) {
+ return []proxmox.Disk{
+ {DevPath: "/dev/sda", Model: "Samsung SSD", Serial: "REAL-DISK", Type: "sata", Health: "PASSED"},
+ {DevPath: "/dev/sr0", Model: "DVD-ROM", Type: "sata"},
+ }, nil
+}
+
// A node whose Proxmox disks/list query fails (wide nodes can exceed the API
// window) must still populate its Physical Disks view from the linked host
// agent's SMART inventory instead of silently emptying (#1516).
@@ -157,6 +174,44 @@ func TestMaybePollPhysicalDisksAsync_AgentFallbackWhenDiskQueryFails(t *testing.
}
}
+func TestMaybePollPhysicalDisksAsync_SkipsOpticalProxmoxDevices(t *testing.T) {
+ m := &Monitor{
+ state: models.NewState(),
+ lastPhysicalDiskPoll: make(map[string]time.Time),
+ alertManager: alerts.NewManager(),
+ }
+ m.state.UpdateNodesForInstance("pve1", []models.Node{{
+ ID: "pve1-node1",
+ Name: "node1",
+ Instance: "pve1",
+ }})
+
+ m.maybePollPhysicalDisksAsync(
+ context.Background(),
+ "pve1",
+ &config.PVEInstance{},
+ &opticalDiskPVEClient{},
+ []proxmox.Node{{Node: "node1", Status: "online"}},
+ map[string]string{"node1": "online"},
+ []models.Node{{Name: "node1", Instance: "pve1"}},
+ )
+
+ deadline := time.Now().Add(3 * time.Second)
+ for {
+ disks := m.state.GetSnapshot().PhysicalDisks
+ if len(disks) == 1 && disks[0].Serial == "REAL-DISK" {
+ if disks[0].DevPath != "/dev/sda" {
+ t.Fatalf("unexpected physical disk: %+v", disks[0])
+ }
+ return
+ }
+ if time.Now().After(deadline) {
+ t.Fatalf("expected optical device to be excluded, got %+v", disks)
+ }
+ time.Sleep(10 * time.Millisecond)
+ }
+}
+
func TestMaybePollPhysicalDisksAsync_PermissionFailurePreservesPreviousInventory(t *testing.T) {
m := &Monitor{
state: models.NewState(),
diff --git a/internal/unifiedresources/registry.go b/internal/unifiedresources/registry.go
index e8ca9bcb4d..a0752e604d 100644
--- a/internal/unifiedresources/registry.go
+++ b/internal/unifiedresources/registry.go
@@ -1966,6 +1966,9 @@ func pbsStorageInstance(storage models.Storage) bool {
}
func (rr *ResourceRegistry) ingestPhysicalDisk(disk models.PhysicalDisk) {
+ if fsfilters.IsVirtualBlockDevice(disk.DevPath) {
+ return
+ }
resource, identity := resourceFromPhysicalDisk(disk)
parentSourceID := proxmoxNodeSourceID(disk.Instance, disk.Node)
if parentID, ok := rr.bySource[SourceProxmox][parentSourceID]; ok {
diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.go
index bca28fafa3..38a5c1ef55 100644
--- a/internal/unifiedresources/registry_test.go
+++ b/internal/unifiedresources/registry_test.go
@@ -2363,6 +2363,25 @@ func TestResourceRegistry_IngestSnapshotSkipsVirtualBlockDevicesFromHostSMART(t
}
}
+func TestResourceRegistry_IngestSnapshotSkipsOpticalProxmoxDisks(t *testing.T) {
+ rr := NewRegistry(nil)
+
+ rr.IngestSnapshot(models.StateSnapshot{
+ PhysicalDisks: []models.PhysicalDisk{
+ {ID: "pve-disk", Instance: "pve-main", Node: "pve-1", DevPath: "/dev/sda", Serial: "REAL-DISK"},
+ {ID: "pve-optical", Instance: "pve-main", Node: "pve-1", DevPath: "/dev/sr0", Model: "DVD-ROM", Type: "sata"},
+ },
+ })
+
+ disks := rr.ListByType(ResourceTypePhysicalDisk)
+ if len(disks) != 1 {
+ t.Fatalf("expected only the real Proxmox disk, got %d: %+v", len(disks), disks)
+ }
+ if disks[0].PhysicalDisk == nil || disks[0].PhysicalDisk.Serial != "REAL-DISK" {
+ t.Fatalf("expected only the real Proxmox disk, got %+v", disks[0].PhysicalDisk)
+ }
+}
+
func TestResourceRegistry_IngestSnapshotMergesAgentAndProxmoxPhysicalDisksByIdentity(t *testing.T) {
rr := NewRegistry(nil)
now := time.Date(2026, 3, 7, 12, 0, 0, 0, time.UTC)
diff --git a/pkg/fsfilters/filters.go b/pkg/fsfilters/filters.go
index 03e74b94df..ed58b7b395 100644
--- a/pkg/fsfilters/filters.go
+++ b/pkg/fsfilters/filters.go
@@ -256,8 +256,8 @@ func MatchesDiskInclude(device, mountpoint string, includePatterns []string) boo
return MatchesDiskExclude(device, mountpoint, includePatterns)
}
-// virtualBlockDevicePrefixes are device-name prefixes for virtual or
-// pseudo block devices that should never be treated as physical disks.
+// virtualBlockDevicePrefixes are device-name prefixes for virtual, pseudo,
+// or non-disk block devices that should never be treated as physical disks.
// The list is shared between the host agent (which skips these during
// SMART collection) and the server-side resource registry (which refuses
// to surface them as physical_disk resources even if an older agent
@@ -271,6 +271,7 @@ var virtualBlockDevicePrefixes = []string{
"pmem",
"ram",
"rbd",
+ "sr",
"vd",
"xvd",
"zd",
@@ -315,9 +316,9 @@ func IsNonPhysicalDiskIODevice(name string) bool {
return false
}
-// IsVirtualBlockDevice reports whether a block-device name (with or
-// without the /dev/ prefix) looks like a virtual or pseudo device that
-// cannot provide SMART data or meaningful physical-disk metrics.
+// IsVirtualBlockDevice reports whether a block-device name (with or without
+// the /dev/ prefix) cannot provide SMART data or meaningful physical-disk
+// metrics. This includes virtual/pseudo devices and optical drives.
func IsVirtualBlockDevice(name string) bool {
trimmed := strings.ToLower(strings.TrimSpace(name))
trimmed = strings.TrimPrefix(trimmed, "/dev/")
diff --git a/pkg/fsfilters/filters_test.go b/pkg/fsfilters/filters_test.go
index d190c7dd26..4b6bf0e92d 100644
--- a/pkg/fsfilters/filters_test.go
+++ b/pkg/fsfilters/filters_test.go
@@ -347,6 +347,8 @@ func TestIsVirtualBlockDevice(t *testing.T) {
{"raid md", "md0", true},
{"virtio disk", "vda", true},
{"xen disk", "xvda", true},
+ {"optical drive", "sr0", true},
+ {"optical drive with dev prefix", "/dev/sr1", true},
{"with dev prefix", "/dev/zram0", true},
{"uppercase prefix", "/DEV/ZD0", true},
{"sata disk", "sda", false},