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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
storage(pools): collapse duplicate Ceph rows and lift cluster health onto the mount
rcourtmane6250fe697b8
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 802d3c025f..6da080b973 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -1480,6 +1480,13 @@ not a replacement status card, CTA band, or page-local nested card.`platformData.zfsPool` fallback) when building pool detail and barsummaries, rather than re-deriving device-level health from risk-reasonstrings or presenting flattened pool-state scalars as the full report.+ Ceph dedup is part of the same shared-presenter truth: cluster-internal+ pool rows must be consolidated into their mounting storage rows through+ `consolidateCephClusterPoolRecords` in+ `frontend-modern/src/features/storageBackups/cephRecordPresentation.ts`+ (lifting worse health onto the survivor) before shared storage tables+ render, instead of each table double-listing the same Ceph storage with+ conflicting raw-pool versus mounted-capacity accounting.30. Keep infrastructure settings-shell API alternatives on the shared shellcontract. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,`frontend-modern/src/components/Settings/settingsHeaderMeta.ts`, anddiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex ea19b65c9b..36180e25a1 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -1514,6 +1514,19 @@ the record's `details.zfsPool`, which`frontend-modern/src/components/Storage/StoragePoolDetail.tsx` renders thatreport inside the row expansion so degraded pools name the failing device andrunning scrub/resilver without re-promoting per-device noise into table rows.+The pools table must not double-list Ceph-backed storage. Cluster-internal+pool rows synthesized from Ceph cluster telemetry (`models.StorageFromCephPool`:+type `ceph` homed on the `cluster` pseudo-node) are consolidated into the PVE+storage rows that mount them by+`consolidateCephClusterPoolRecords` in+`frontend-modern/src/features/storageBackups/cephRecordPresentation.ts`,+applied by `frontend-modern/src/components/Storage/useStorageModel.ts` before+filtering, sorting, and summary. The pool row's worse health is lifted onto+the surviving mount row (state, status detail, issue summary) so a degraded+cluster stays visible, and pool rows with no mounting sibling are kept so+clusters monitored without PVE storage entries do not lose their only+capacity row. Raw pool accounting stays on the Ceph tab's cluster drawer,+which remains the canonical home for per-pool stored/available bytes.Shared chart transport that storage and recovery coexist with must also stayon rendered-metric budgets. When `internal/api/router.go` batches workloadhistory for adjacent overview or shared summary cards, it may parallelize thediff --git a/frontend-modern/src/components/Storage/code_standards.test.ts b/frontend-modern/src/components/Storage/code_standards.test.tsindex 4c9b9b88c5..f7576b9d00 100644--- a/frontend-modern/src/components/Storage/code_standards.test.ts+++ b/frontend-modern/src/components/Storage/code_standards.test.ts@@ -46,4 +46,15 @@ describe('Storage code standards guardrails', () => {expect(violations).toEqual([]);});++ it('keeps the pools table on consolidated ceph records', () => {+ const source = readFileSync(path.resolve(storageDir, 'useStorageModel.ts'), 'utf-8');++ expect(source).toContain(+ "import { consolidateCephClusterPoolRecords } from '@/features/storageBackups/cephRecordPresentation';",+ );+ expect(source).toContain('consolidateCephClusterPoolRecords(options.records())');+ expect(source).toContain('buildStorageSourceOptions(consolidatedRecords())');+ expect(source).toContain('filterStorageRecords(consolidatedRecords()');+ });});diff --git a/frontend-modern/src/components/Storage/useStorageModel.ts b/frontend-modern/src/components/Storage/useStorageModel.tsindex 2b3de424bb..88ec7dfeb9 100644--- a/frontend-modern/src/components/Storage/useStorageModel.ts+++ b/frontend-modern/src/components/Storage/useStorageModel.ts@@ -1,6 +1,7 @@import { Accessor, createMemo } from 'solid-js';import type { StorageHealthFilter, StorageRecord } from '@/features/storageBackups/models';import type { StorageCapacityDeltaPresentation } from '@/features/storageBackups/storageCapacityDeltaPresentation';+import { consolidateCephClusterPoolRecords } from '@/features/storageBackups/cephRecordPresentation';import {buildStorageSourceOptions,filterStorageRecords,@@ -41,10 +42,14 @@ export const useStorageModel = (options: UseStorageModelOptions) => {findSelectedStorageNode(options.selectedNodeId(), options.nodeOptions()),);- const sourceOptions = createMemo(() => buildStorageSourceOptions(options.records()));+ const consolidatedRecords = createMemo(() =>+ consolidateCephClusterPoolRecords(options.records()),+ );++ const sourceOptions = createMemo(() => buildStorageSourceOptions(consolidatedRecords()));const filteredRecords = createMemo(() => {- return filterStorageRecords(options.records(), {+ return filterStorageRecords(consolidatedRecords(), {search: options.search(),sourceFilter: options.sourceFilter(),healthFilter: options.healthFilter(),diff --git a/frontend-modern/src/features/storageBackups/__tests__/cephRecordPresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/cephRecordPresentation.test.tsindex b029b32792..e916593f59 100644--- a/frontend-modern/src/features/storageBackups/__tests__/cephRecordPresentation.test.ts+++ b/frontend-modern/src/features/storageBackups/__tests__/cephRecordPresentation.test.ts@@ -3,9 +3,11 @@ import type { CephCluster } from '@/types/api';import type { StorageRecord } from '@/features/storageBackups/models';import {collectCephClusterNodes,+ consolidateCephClusterPoolRecords,getCephClusterKeyFromStorageRecord,getCephPoolsText,getCephSummaryText,+ isCephClusterPoolStorageRecord,isCephStorageRecord,} from '@/features/storageBackups/cephRecordPresentation';@@ -84,4 +86,100 @@ describe('cephRecordPresentation', () => {).toBe('rbd: 75%');expect(getCephPoolsText(makeRecord({ name: 'ceph-a' }), null)).toBe('ceph-a: 40%');});++ it('classifies cluster-internal ceph pool rows by their synthesis signature', () => {+ const poolRecord = makeRecord({+ id: 'pool-1',+ name: 'cephfs-data',+ details: { type: 'ceph', node: 'cluster' },+ });+ expect(isCephClusterPoolStorageRecord(poolRecord)).toBe(true);+ expect(isCephClusterPoolStorageRecord(makeRecord())).toBe(false);+ expect(+ isCephClusterPoolStorageRecord(makeRecord({ details: { type: 'cephfs', node: 'cluster' } })),+ ).toBe(false);+ });++ it('collapses cluster pool rows into the PVE storage rows that mount them', () => {+ const poolRecord = makeRecord({+ id: 'pool-1',+ name: 'cephfs-data',+ health: 'warning',+ details: { type: 'ceph', node: 'cluster', status: 'degraded' },+ });+ const mountRecord = makeRecord({+ id: 'mount-1',+ name: 'cephfs-data',+ health: 'healthy',+ details: { type: 'cephfs', node: 'shared', status: 'online' },+ });+ const unrelated = makeRecord({+ id: 'other-1',+ name: 'local-zfs',+ details: { type: 'zfspool', node: 'pve1' },+ capabilities: ['capacity'],+ source: {+ platform: 'proxmox-pve',+ family: 'virtualization',+ origin: 'resource',+ adapterId: 'resource-storage',+ },+ });++ const consolidated = consolidateCephClusterPoolRecords([poolRecord, mountRecord, unrelated]);++ expect(consolidated.map((record) => record.id)).toEqual(['mount-1', 'other-1']);+ const survivor = consolidated[0];+ expect(survivor.health).toBe('warning');+ expect(survivor.statusLabel).toBe('degraded');+ expect(survivor.details?.status).toBe('degraded');+ expect(survivor.issueSummary).toBe('Ceph reports pool cephfs-data degraded');+ });++ it('matches pool rows to mounts via the backing pool detail', () => {+ const poolRecord = makeRecord({+ id: 'pool-1',+ name: 'vm-pool',+ health: 'critical',+ issueSummary: 'Ceph cluster HEALTH_ERR',+ details: { type: 'ceph', node: 'cluster', status: 'unavailable' },+ });+ const mountRecord = makeRecord({+ id: 'mount-1',+ name: 'fast-rbd',+ health: 'healthy',+ details: { type: 'rbd', node: 'shared', pool: 'vm-pool', status: 'online' },+ });++ const consolidated = consolidateCephClusterPoolRecords([poolRecord, mountRecord]);++ expect(consolidated.map((record) => record.id)).toEqual(['mount-1']);+ expect(consolidated[0].health).toBe('critical');+ expect(consolidated[0].issueSummary).toBe('Ceph cluster HEALTH_ERR');+ });++ it('keeps unmounted pool rows and never downgrades a sicker mount', () => {+ const orphanPool = makeRecord({+ id: 'pool-1',+ name: 'standalone-pool',+ details: { type: 'ceph', node: 'cluster' },+ });+ expect(consolidateCephClusterPoolRecords([orphanPool])).toEqual([orphanPool]);++ const healthyPool = makeRecord({+ id: 'pool-2',+ name: 'cephfs-data',+ health: 'healthy',+ details: { type: 'ceph', node: 'cluster', status: 'available' },+ });+ const sickMount = makeRecord({+ id: 'mount-2',+ name: 'cephfs-data',+ health: 'critical',+ statusLabel: 'unavailable',+ details: { type: 'cephfs', node: 'shared', status: 'unavailable' },+ });+ const consolidated = consolidateCephClusterPoolRecords([healthyPool, sickMount]);+ expect(consolidated).toEqual([sickMount]);+ });});diff --git a/frontend-modern/src/features/storageBackups/cephRecordPresentation.ts b/frontend-modern/src/features/storageBackups/cephRecordPresentation.tsindex 1fe18eaaa9..70ff10fc3e 100644--- a/frontend-modern/src/features/storageBackups/cephRecordPresentation.ts+++ b/frontend-modern/src/features/storageBackups/cephRecordPresentation.ts@@ -13,6 +13,87 @@ export const isCephStorageRecord = (record: StorageRecord): boolean => {return record.capabilities.includes('replication') && record.source.platform.includes('proxmox');};+// Signature of the cluster-internal pool rows synthesized from Ceph cluster+// telemetry (models.StorageFromCephPool): type "ceph" homed on the "cluster"+// pseudo-node, as opposed to the rbd/cephfs storage entries PVE mounts.+export const isCephClusterPoolStorageRecord = (record: StorageRecord): boolean => {+ if (getStorageRecordType(record) !== 'ceph') return false;+ const details = (record.details || {}) as Record<string, unknown>;+ return details.node === 'cluster';+};++const STORAGE_HEALTH_SEVERITY_RANK: Record<string, number> = {+ critical: 4,+ offline: 3,+ warning: 2,+ unknown: 1,+ healthy: 0,+};++const storageHealthRank = (health: string): number => STORAGE_HEALTH_SEVERITY_RANK[health] ?? 0;++const getRecordPoolDetail = (record: StorageRecord): string => {+ const pool = ((record.details || {}) as Record<string, unknown>).pool;+ return typeof pool === 'string' ? pool.trim() : '';+};++const getRecordStatusDetail = (record: StorageRecord): string => {+ const status = ((record.details || {}) as Record<string, unknown>).status;+ return typeof status === 'string' ? status.trim() : '';+};++/**+ * Collapse cluster-internal Ceph pool rows into the PVE storage rows that+ * mount them, so the same storage does not appear twice with conflicting+ * usage accounting (raw pool bytes vs PVE-visible bytes). The pool row's+ * health is lifted onto the surviving row when it is worse, so a degraded+ * cluster stays visible on the storage table. Pool rows with no mounting+ * sibling are kept: hiding them would hide the only capacity row for+ * clusters monitored without PVE storage entries.+ */+export const consolidateCephClusterPoolRecords = (records: StorageRecord[]): StorageRecord[] => {+ const poolRecords = records.filter(isCephClusterPoolStorageRecord);+ if (poolRecords.length === 0) return records;++ const consumedPoolIds = new Set<string>();+ const liftBySiblingId = new Map<string, StorageRecord>();++ for (const pool of poolRecords) {+ const sibling = records.find(+ (candidate) =>+ candidate !== pool &&+ !isCephClusterPoolStorageRecord(candidate) &&+ isCephStorageRecord(candidate) &&+ (getRecordPoolDetail(candidate) === pool.name || candidate.name === pool.name),+ );+ if (!sibling) continue;+ consumedPoolIds.add(pool.id);+ const existing = liftBySiblingId.get(sibling.id);+ if (!existing || storageHealthRank(pool.health) > storageHealthRank(existing.health)) {+ liftBySiblingId.set(sibling.id, pool);+ }+ }++ if (consumedPoolIds.size === 0) return records;++ return records+ .filter((record) => !consumedPoolIds.has(record.id))+ .map((record) => {+ const pool = liftBySiblingId.get(record.id);+ if (!pool) return record;+ if (storageHealthRank(pool.health) <= storageHealthRank(record.health)) return record;+ const poolStatus = getRecordStatusDetail(pool) || pool.statusLabel || pool.health;+ return {+ ...record,+ health: pool.health,+ statusLabel: poolStatus,+ issueSummary:+ pool.issueSummary?.trim() || `Ceph reports pool ${pool.name} ${poolStatus}`,+ details: { ...(record.details || {}), status: poolStatus },+ };+ });+};+export const getCephClusterKeyFromStorageRecord = (record: StorageRecord): string => {const details = (record.details || {}) as Record<string, unknown>;const parent = typeof details.parentId === 'string' ? details.parentId : '';