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.

Classify VMware datastores on storage route

rcourtman548ea76b96f6
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 9bd0bf94f1..cbbf71fa79 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -9,7 +9,7 @@
"contract_file": "docs/release-control/v6/internal/subsystems/frontend-primitives.md",
"status_file": "docs/release-control/v6/internal/status.json",
"registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
- "dependency_subsystem_ids": ["agent-lifecycle"]
+ "dependency_subsystem_ids": ["agent-lifecycle", "storage-recovery"]
}
```
@@ -143,6 +143,7 @@ work extends shared components instead of creating new local variants.
3. Add feature-specific presentation only when no shared primitive should own it
4. Add guardrail tests when a new shared pattern is introduced
5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.
+6. Keep shared storage feature presenters on canonical platform truth. When reusable storage presenters under `frontend-modern/src/features/storageBackups/` classify canonical resources for the shared storage route, API-backed virtualization datastores such as VMware must stay inventory-only datastores instead of inheriting PBS-specific backup-repository or protected-target copy from older fallback branches.
## Forbidden Paths
@@ -258,6 +259,12 @@ work extends shared components instead of creating new local variants.
“IPs are never seen,” the summary copy in
`GeneralSettingsPanel.tsx` must state those facts plainly instead of
reverting to a stronger but inaccurate shorthand.
+16. Keep shared storage-route feature presentation on neutral capability truth.
+ Reusable mappers and presenters in `frontend-modern/src/features/storageBackups/`
+ must distinguish inventory datastores from backup repositories so VMware
+ rows on the shared storage route stay canonical to the admitted phase-1 floor instead of
+ reviving backup-target, protected-target, or recovery-local semantics on a
+ shared page.
16. Keep infrastructure settings-shell API alternatives on the shared shell
contract. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
`frontend-modern/src/components/Settings/settingsHeaderMeta.ts`,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index a736c4ac16..7b7fd60de4 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -94,6 +94,7 @@ querying, and the operator-facing storage health presentation layer.
28. Keep VMware onboarding runtime and recovery semantics separate on that same adjacent platform-connections contract. When `internal/api/router.go`, `internal/api/router_routes_registration.go`, or `internal/api/vmware_handlers.go` evolve VMware connection CRUD, saved-test refresh, or observed datastore/VM snapshot visibility, storage and recovery may consume the resulting shared context but must not treat those onboarding/runtime payloads as canonical recovery artifacts, restore capability, or recovery-local control transport.
29. Keep VMware datastore projection on the shared unified-resource and storage-source contracts. When `frontend-modern/src/hooks/useUnifiedResources.ts` or shared `internal/api/router.go` wiring starts surfacing VMware-backed canonical `storage` resources, storage and recovery may expose those datastores through the owned `vmware-vsphere` source/platform vocabulary for inventory, capacity, and handoff flows only; they must not reinterpret that projection as VMware recovery support, restore semantics, or a provider-local protection surface.
30. Keep VMware placement and guest-detail enrichment descriptive on that same shared unified-resource contract. When `internal/vmware/provider.go`, `internal/unifiedresources/types.go`, and `frontend-modern/src/hooks/useUnifiedResources.ts` project datacenter, cluster, folder, runtime-host, datastore-attachment, guest-hostname, or guest-IP metadata onto canonical VMware `agent` / `vm` / `storage` resources, storage and recovery may use that detail for labeling and navigation only; they must not promote those topology or guest fields into recovery ownership, restore targeting, protection grouping, or a VMware-local recovery taxonomy without a separately governed slice.
+31. Keep VMware datastore classification neutral on the shared storage adapter contract. When `frontend-modern/src/features/storageBackups/resourceStorageMapping.ts`, `frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts`, and `frontend-modern/src/features/storageBackups/storageAdapters.ts` evolve canonical storage-record mapping, VMware-backed datastores must continue to land on the shared storage route as inventory-only datastores with neutral protection fallback, not as backup repositories, backup targets, or recovery-protected resources.
## Forbidden Paths
@@ -1652,6 +1653,12 @@ adapter floor. `frontend-modern/src/hooks/useUnifiedResources.ts`,
may surface VMware-backed datastores as canonical `storage` resources under
the shared `vmware-vsphere` source/platform vocabulary, but that operator-
facing storage visibility still ends at inventory, capacity, and navigation.
+That same shared storage adapter must classify those VMware-backed records as
+inventory-only datastores on `/storage`, not as backup repositories or
+recovery-protected targets. Shared storage rows may show datastore topology,
+capacity, accessibility, and multi-host context, but they must keep fallback
+protection semantics neutral unless a separately governed recovery slice adds
+real VMware protection contracts.
Storage and recovery must not infer VMware restore support, recovery rollups,
or VMware-local protection semantics from the presence of those datastores or
VM snapshot-read context on the shared pages.
diff --git a/frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts b/frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts
index 80def3c448..b424d94402 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/resourceStorageMapping.test.ts
@@ -22,6 +22,8 @@ describe('resourceStorageMapping', () => {
const resource = makeResource({
storage: {
type: 'rbd',
+ platform: 'proxmox-pve',
+ topology: 'pool',
contentTypes: ['images', 'rootdir'],
shared: false,
isCeph: true,
@@ -29,6 +31,8 @@ describe('resourceStorageMapping', () => {
platformData: {
storage: {
type: 'dir',
+ platform: 'proxmox-pbs',
+ topology: 'backup-target',
shared: true,
},
},
@@ -36,6 +40,8 @@ describe('resourceStorageMapping', () => {
expect(readResourceStorageMeta(resource, resource.platformData as Record<string, unknown>)).toEqual({
type: 'rbd',
+ platform: 'proxmox-pve',
+ topology: 'pool',
content: undefined,
contentTypes: ['images', 'rootdir'],
shared: false,
@@ -76,8 +82,22 @@ describe('resourceStorageMapping', () => {
isCeph: true,
}),
).toEqual(['capacity', 'health', 'replication', 'multi-node']);
+ expect(
+ getStorageCapabilitiesForResource('vmfs', {
+ platform: 'vmware-vsphere',
+ topology: 'datastore',
+ shared: true,
+ }),
+ ).toEqual(['capacity', 'health', 'multi-node']);
expect(getStorageCategoryFromType('zfs-pool')).toBe('pool');
expect(getStorageCategoryFromType('pbs')).toBe('backup-repository');
+ expect(
+ getStorageCategoryFromType('vmfs', {
+ platform: 'vmware-vsphere',
+ topology: 'datastore',
+ entityType: 'datastore',
+ }),
+ ).toBe('datastore');
expect(getStorageCategoryFromType('filesystem')).toBe('filesystem');
});
});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/resourceStoragePresentation.test.ts b/frontend-modern/src/features/storageBackups/__tests__/resourceStoragePresentation.test.ts
index 5758f35b8a..4dbd77c3fc 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/resourceStoragePresentation.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/resourceStoragePresentation.test.ts
@@ -32,9 +32,34 @@ describe('resourceStoragePresentation', () => {
});
it('derives canonical topology labels for storage resources', () => {
- expect(getResourceStorageTopologyLabel(makeResource({ type: 'datastore' }), 'pbs')).toBe(
- 'Backup Target',
- );
+ expect(
+ getResourceStorageTopologyLabel(
+ makeResource({
+ type: 'datastore',
+ platformType: 'proxmox-pbs',
+ storage: {
+ platform: 'proxmox-pbs',
+ type: 'pbs',
+ },
+ }),
+ 'pbs',
+ ),
+ ).toBe('Backup Target');
+ expect(
+ getResourceStorageTopologyLabel(
+ makeResource({
+ platformType: 'vmware-vsphere',
+ storage: {
+ platform: 'vmware-vsphere',
+ type: 'vmfs',
+ },
+ vmware: {
+ entityType: 'datastore',
+ },
+ }),
+ 'vmfs',
+ ),
+ ).toBe('Datastore');
expect(getResourceStorageTopologyLabel(makeResource(), 'rbd')).toBe('Cluster Storage');
expect(
getResourceStorageTopologyLabel(makeResource(), 'ignored', 'rebuild target'),
@@ -72,6 +97,7 @@ describe('resourceStoragePresentation', () => {
const resource = makeResource({
type: 'pbs',
storage: {
+ platform: 'proxmox-pbs',
protection: 'mirrored cache',
},
});
@@ -82,4 +108,20 @@ describe('resourceStoragePresentation', () => {
expect(getResourceStorageActionSummary(resource)).toBe('Monitor');
expect(getResourceStorageProtectionLabel(resource)).toBe('Mirrored Cache');
});
+
+ it('keeps VMware datastore protection copy neutral on the shared storage path', () => {
+ const resource = makeResource({
+ platformType: 'vmware-vsphere',
+ storage: {
+ platform: 'vmware-vsphere',
+ type: 'vmfs',
+ topology: 'datastore',
+ },
+ vmware: {
+ entityType: 'datastore',
+ },
+ });
+
+ expect(getResourceStorageProtectionLabel(resource)).toBe('Healthy');
+ });
});
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts
index e1a87b6d1a..2aa6ae86aa 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storageAdapters.test.ts
@@ -339,6 +339,57 @@ describe('storageAdapters', () => {
expect(records[0].details?.protectionReduced).toBe(true);
});
+ it('maps VMware datastores as shared storage inventory instead of backup repositories', () => {
+ const records = buildStorageRecords({
+ state: baseState(),
+ resources: [
+ makeResourceStorage({
+ id: 'vmware-datastore-1',
+ name: 'shared-vmfs',
+ displayName: 'shared-vmfs',
+ platformId: 'datastore-11',
+ platformType: 'vmware-vsphere',
+ sourceType: 'api',
+ parentId: '',
+ parentName: '',
+ storage: {
+ type: 'vmfs',
+ platform: 'vmware-vsphere',
+ topology: 'datastore',
+ shared: true,
+ nodes: ['esxi-01.lab.local', 'esxi-02.lab.local'],
+ },
+ vmware: {
+ entityType: 'datastore',
+ connectionId: 'vc-1',
+ connectionName: 'vc.lab.local',
+ datastoreAccessible: true,
+ multipleHostAccess: true,
+ },
+ platformData: {
+ sources: ['vmware-vsphere'],
+ },
+ }),
+ ],
+ });
+
+ expect(records).toHaveLength(1);
+ expect(records[0].category).toBe('datastore');
+ expect(records[0].platformLabel).toBe('vSphere');
+ expect(records[0].topologyLabel).toBe('Datastore');
+ expect(records[0].protectionLabel).toBe('Healthy');
+ expect(records[0].location.label).toBe('esxi-01.lab.local');
+ expect(records[0].location.scope).toBe('cluster');
+ expect(records[0].capabilities).toEqual(
+ expect.arrayContaining(['capacity', 'health', 'multi-node']),
+ );
+ expect(records[0].capabilities).not.toEqual(
+ expect.arrayContaining(['backup-repository', 'deduplication', 'namespaces']),
+ );
+ expect(records[0].details?.platform).toBe('vmware-vsphere');
+ expect(records[0].details?.topology).toBe('datastore');
+ });
+
it('normalizes storage source and platform keys to canonical v6 platform types', () => {
const records = buildStorageRecords({
state: baseState(),
diff --git a/frontend-modern/src/features/storageBackups/resourceStorageMapping.ts b/frontend-modern/src/features/storageBackups/resourceStorageMapping.ts
index d9a881c4d8..750d0105e5 100644
--- a/frontend-modern/src/features/storageBackups/resourceStorageMapping.ts
+++ b/frontend-modern/src/features/storageBackups/resourceStorageMapping.ts
@@ -3,6 +3,8 @@ import type { StorageCapability, StorageCategory } from './models';
export type ResourceStorageMeta = {
type?: string;
+ platform?: string;
+ topology?: string;
content?: string;
contentTypes?: string[];
shared?: boolean;
@@ -16,6 +18,17 @@ type ResourceWithStorageMeta = Resource & {
const dedupe = <T>(values: T[]): T[] => Array.from(new Set(values));
+export type StorageClassificationContext = {
+ resourceType?: string;
+ platform?: string;
+ topology?: string;
+ entityType?: string;
+ shared?: boolean;
+};
+
+const normalizeClassificationValue = (value: string | undefined | null): string =>
+ (value || '').trim().toLowerCase();
+
const normalizeStorageMeta = (value: unknown): ResourceStorageMeta | null => {
if (!value || typeof value !== 'object') return null;
const candidate = value as Record<string, unknown>;
@@ -27,6 +40,8 @@ const normalizeStorageMeta = (value: unknown): ResourceStorageMeta | null => {
return {
type: typeof candidate.type === 'string' ? candidate.type : undefined,
+ platform: typeof candidate.platform === 'string' ? candidate.platform : undefined,
+ topology: typeof candidate.topology === 'string' ? candidate.topology : undefined,
content: typeof candidate.content === 'string' ? candidate.content : undefined,
contentTypes,
shared: typeof candidate.shared === 'boolean' ? candidate.shared : undefined,
@@ -57,13 +72,55 @@ export const resolveResourceStorageContent = (
return platformContent || fallback;
};
+export const isBackupRepositoryStorageResource = (
+ type: string | undefined,
+ storageMeta?: ResourceStorageMeta,
+ context?: StorageClassificationContext,
+): boolean => {
+ const value = normalizeClassificationValue(type);
+ const resourceType = normalizeClassificationValue(context?.resourceType);
+ const platform = normalizeClassificationValue(context?.platform || storageMeta?.platform);
+ const topology = normalizeClassificationValue(context?.topology || storageMeta?.topology);
+
+ return (
+ resourceType === 'pbs' ||
+ value.includes('pbs') ||
+ platform.includes('pbs') ||
+ topology === 'backup-target'
+ );
+};
+
+export const isCanonicalDatastoreStorageResource = (
+ type: string | undefined,
+ storageMeta?: ResourceStorageMeta,
+ context?: StorageClassificationContext,
+): boolean => {
+ if (isBackupRepositoryStorageResource(type, storageMeta, context)) {
+ return false;
+ }
+
+ const value = normalizeClassificationValue(type);
+ const resourceType = normalizeClassificationValue(context?.resourceType);
+ const platform = normalizeClassificationValue(context?.platform || storageMeta?.platform);
+ const topology = normalizeClassificationValue(context?.topology || storageMeta?.topology);
+ const entityType = normalizeClassificationValue(context?.entityType);
+
+ return (
+ resourceType === 'datastore' ||
+ topology === 'datastore' ||
+ entityType === 'datastore' ||
+ (platform.includes('vmware') && value.length > 0)
+ );
+};
+
export const getStorageCapabilitiesForResource = (
type: string | undefined,
storageMeta?: ResourceStorageMeta,
+ context?: StorageClassificationContext,
): StorageCapability[] => {
const value = (type || '').toLowerCase();
const caps: StorageCapability[] = ['capacity', 'health'];
- if (value.includes('pbs')) {
+ if (isBackupRepositoryStorageResource(type, storageMeta, context)) {
caps.push('backup-repository', 'deduplication', 'namespaces');
}
if (storageMeta?.isZfs || value.includes('zfs')) {
@@ -72,13 +129,20 @@ export const getStorageCapabilitiesForResource = (
if (storageMeta?.isCeph || value.includes('ceph')) {
caps.push('replication', 'multi-node');
}
+ if ((context?.shared ?? storageMeta?.shared) === true) {
+ caps.push('multi-node');
+ }
return dedupe(caps);
};
-export const getStorageCategoryFromType = (type: string | undefined): StorageCategory => {
+export const getStorageCategoryFromType = (
+ type: string | undefined,
+ context?: StorageClassificationContext,
+): StorageCategory => {
const value = (type || '').toLowerCase();
if (!value) return 'other';
- if (value.includes('pbs')) return 'backup-repository';
+ if (isBackupRepositoryStorageResource(type, undefined, context)) return 'backup-repository';
+ if (isCanonicalDatastoreStorageResource(type, undefined, context)) return 'datastore';
if (
value.includes('zfs') ||
value.includes('lvm') ||
diff --git a/frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts b/frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts
index a163603750..0e357a6a33 100644
--- a/frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts
+++ b/frontend-modern/src/features/storageBackups/resourceStoragePresentation.ts
@@ -1,6 +1,7 @@
import type { Resource } from '@/types/resource';
import { getSourcePlatformLabel, normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
import type { StorageBackupPlatform } from './models';
+import { isBackupRepositoryStorageResource } from './resourceStorageMapping';
const titleize = (value: string | undefined | null): string =>
(value || '')
@@ -22,6 +23,22 @@ export const getCanonicalStoragePlatformKey = (
export const getResourceStoragePlatformLabel = (platform: StorageBackupPlatform): string =>
getSourcePlatformLabel(platform);
+const getStorageClassificationContext = (resource: Resource) => {
+ const storage = (resource.storage as Record<string, unknown> | undefined) || {};
+ const platformData = (resource.platformData as Record<string, unknown> | undefined) || {};
+ return {
+ resourceType: resource.type,
+ platform:
+ (typeof storage.platform === 'string' ? storage.platform : undefined) ||
+ (typeof platformData.platform === 'string' ? platformData.platform : undefined) ||
+ resource.platformType,
+ topology:
+ (typeof storage.topology === 'string' ? storage.topology : undefined) ||
+ (typeof platformData.topology === 'string' ? platformData.topology : undefined),
+ entityType: resource.vmware?.entityType,
+ };
+};
+
export const getResourceStorageTopologyLabel = (
resource: Resource,
storageType: string,
@@ -31,7 +48,25 @@ export const getResourceStorageTopologyLabel = (
if (normalized) {
return titleize(normalized);
}
- if (resource.type === 'datastore') return 'Backup Target';
+ const classification = getStorageClassificationContext(resource);
+ if (
+ isBackupRepositoryStorageResource(
+ storageType,
+ {
+ platform: classification.platform,
+ topology: classification.topology,
+ },
+ classification,
+ )
+ ) {
+ return 'Backup Target';
+ }
+ if (
+ resource.type === 'datastore' ||
+ (classification.entityType || '').trim().toLowerCase() === 'datastore'
+ ) {
+ return 'Datastore';
+ }
switch ((storageType || '').trim().toLowerCase()) {
case 'zfspool':
case 'zfs-pool':
@@ -104,7 +139,20 @@ export const getResourceStorageProtectionLabel = (resource: Resource): string =>
if (resource.storage?.protection?.trim()) {
return titleize(resource.storage.protection.trim());
}
- if (resource.type === 'datastore' || resource.type === 'pbs') {
+ const storageType =
+ resource.storage?.type ||
+ ((resource.platformData as Record<string, unknown> | undefined)?.type as string | undefined);
+ const classification = getStorageClassificationContext(resource);
+ if (
+ isBackupRepositoryStorageResource(
+ storageType,
+ {
+ platform: classification.platform,
+ topology: classification.topology,
+ },
+ classification,
+ )
+ ) {
return 'Protected';
}
return 'Healthy';
diff --git a/frontend-modern/src/features/storageBackups/storageAdapters.ts b/frontend-modern/src/features/storageBackups/storageAdapters.ts
index 6cd52b2662..b3bde80c01 100644
--- a/frontend-modern/src/features/storageBackups/storageAdapters.ts
+++ b/frontend-modern/src/features/storageBackups/storageAdapters.ts
@@ -17,6 +17,8 @@ import {
import {
getStorageCapabilitiesForResource,
getStorageCategoryFromType,
+ isBackupRepositoryStorageResource,
+ isCanonicalDatastoreStorageResource,
readResourceStorageMeta,
resolveResourceStorageContent,
} from './resourceStorageMapping';
@@ -35,22 +37,48 @@ const mapResourceStorageRecord = (resource: Resource, adapterId: string): Storag
const platformData = (resource.platformData as Record<string, unknown> | undefined) || {};
const storageMeta = readResourceStorageMeta(resource, platformData);
const resourceType = (resource.type || '').toLowerCase();
- const isDatastore = resourceType === 'datastore';
+ const storageTypeHint =
+ storageMeta?.type || (platformData.type as string | undefined) || undefined;
+ const storagePlatform =
+ storageMeta?.platform ||
+ (platformData.platform as string | undefined) ||
+ resource.storage?.platform ||
+ resource.platformType;
+ const storageTopology =
+ storageMeta?.topology ||
+ (platformData.topology as string | undefined) ||
+ resource.storage?.topology;
const storageType =
- storageMeta?.type ||
- (platformData.type as string | undefined) ||
- (isDatastore ? 'pbs' : resourceType);
- const content = resolveResourceStorageContent(
- storageMeta,
- platformData,
- isDatastore ? 'backup' : '',
- );
+ storageTypeHint ||
+ (resourceType === 'pbs' ? 'pbs' : resourceType);
const shared =
typeof storageMeta?.shared === 'boolean'
? storageMeta.shared
: typeof platformData.shared === 'boolean'
? platformData.shared
: undefined;
+ const classificationContext = {
+ resourceType,
+ platform: storagePlatform,
+ topology: storageTopology,
+ entityType: resource.vmware?.entityType,
+ shared,
+ };
+ const isBackupRepository = isBackupRepositoryStorageResource(
+ storageType,
+ storageMeta,
+ classificationContext,
+ );
+ const isDatastore = isCanonicalDatastoreStorageResource(
+ storageType,
+ storageMeta,
+ classificationContext,
+ );
+ const content = resolveResourceStorageContent(
+ storageMeta,
+ platformData,
+ isBackupRepository ? 'backup' : '',
+ );
const proxmoxNode =
resource.proxmox?.node ||
((platformData.proxmox as Record<string, unknown> | undefined)?.nodeName as string | undefined);
@@ -67,7 +95,7 @@ const mapResourceStorageRecord = (resource: Resource, adapterId: string): Storag
resource.platformId,
].filter((value): value is string => typeof value === 'string' && value.trim().length > 0),
);
- const locationLabel = isDatastore
+ const locationLabel = isBackupRepository
? resource.parentName ||
(platformData.pbsInstanceName as string | undefined) ||
resource.parentId ||
@@ -102,11 +130,9 @@ const mapResourceStorageRecord = (resource: Resource, adapterId: string): Storag
return {
id: resource.id,
name: resource.name,
- category: isDatastore
- ? 'backup-repository'
- : storageMeta?.isCeph || storageMeta?.isZfs
+ category: storageMeta?.isCeph || storageMeta?.isZfs
? 'pool'
- : getStorageCategoryFromType(storageType),
+ : getStorageCategoryFromType(storageType, classificationContext),
health: normalizeStorageResourceHealth(resource.status, resource.tags, resource.incidentSeverity),
statusLabel: resource.status,
hostLabel,
@@ -128,12 +154,10 @@ const mapResourceStorageRecord = (resource: Resource, adapterId: string): Storag
affectedDatastoreCount: resource.pbs?.affectedDatastoreCount || 0,
location: {
label: locationLabel,
- scope: isDatastore ? 'cluster' : 'node',
+ scope: isBackupRepository ? 'cluster' : isDatastore ? (shared ? 'cluster' : 'host') : 'node',
},
capacity: buildStorageCapacity(totalBytes, usedBytes, freeBytes, usagePercent),
- capabilities: isDatastore
- ? dedupe(['capacity', 'health', 'backup-repository', 'deduplication', 'namespaces'])
- : getStorageCapabilitiesForResource(storageType, storageMeta),
+ capabilities: getStorageCapabilitiesForResource(storageType, storageMeta, classificationContext),
source: buildStorageSource(canonicalPlatform, adapterId),
observedAt:
typeof resource.lastSeen === 'number' && Number.isFinite(resource.lastSeen)
@@ -164,6 +188,8 @@ const mapResourceStorageRecord = (resource: Resource, adapterId: string): Storag
protectionLabel,
protectionReduced: resource.storage?.protectionReduced,
rebuildInProgress: resource.storage?.rebuildInProgress,
+ platform: storagePlatform,
+ topology: storageTopology,
content,
contentTypes: storageMeta?.contentTypes,
shared,
diff --git a/tests/integration/tests/40-vmware-storage-source-filter.spec.ts b/tests/integration/tests/40-vmware-storage-source-filter.spec.ts
new file mode 100644
index 0000000000..0eedc41a2a
--- /dev/null
+++ b/tests/integration/tests/40-vmware-storage-source-filter.spec.ts
@@ -0,0 +1,183 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { test as base, expect } from '@playwright/test';
+import { createAuthenticatedStorageState } from './helpers';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+type WorkerFixtures = {
+ authStorageStatePath: string;
+};
+
+const SCREENSHOT_PATH = '/tmp/vmware-storage-source-filter.png';
+
+const test = base.extend<{}, WorkerFixtures>({
+ storageState: async ({ authStorageStatePath }, use) => {
+ await use(authStorageStatePath);
+ },
+ authStorageStatePath: [async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'tmp',
+ 'playwright-auth',
+ `vmware-storage-source-filter-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ }, { scope: 'worker' }],
+});
+
+test.describe('VMware storage source filter', () => {
+ test.setTimeout(180_000);
+
+ test('surfaces VMware datastores on the shared storage route without backup semantics', async ({
+ page,
+ }) => {
+ let unexpectedVmwareApiCall: string | null = null;
+
+ await page.route('**/api/vmware/**', async (route) => {
+ unexpectedVmwareApiCall = route.request().url();
+ await route.abort();
+ });
+
+ await page.route('**/api/resources**', async (route) => {
+ const requestUrl = new URL(route.request().url());
+ if (requestUrl.pathname !== '/api/resources') {
+ await route.continue();
+ return;
+ }
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ data: [
+ {
+ id: 'storage-vmware-1',
+ type: 'storage',
+ name: 'shared-vmfs',
+ displayName: 'shared-vmfs',
+ platformId: 'datastore-11',
+ platformType: 'vmware-vsphere',
+ sourceType: 'api',
+ sources: ['vmware-vsphere'],
+ status: 'online',
+ lastSeen: '2026-03-30T20:00:00Z',
+ canonicalIdentity: {
+ displayName: 'shared-vmfs',
+ platformId: 'datastore-11',
+ primaryId: 'vmware:vc-1:datastore:datastore-11',
+ },
+ disk: {
+ total: 4_000 * 1024 * 1024 * 1024,
+ used: 1_500 * 1024 * 1024 * 1024,
+ free: 2_500 * 1024 * 1024 * 1024,
+ current: 37.5,
+ },
+ storage: {
+ platform: 'vmware-vsphere',
+ type: 'vmfs',
+ topology: 'datastore',
+ shared: true,
+ nodes: ['esxi-01.lab.local', 'esxi-02.lab.local'],
+ },
+ vmware: {
+ connectionId: 'vc-1',
+ connectionName: 'Lab VC',
+ vcenterHost: 'vc.lab.local',
+ managedObjectId: 'datastore-11',
+ entityType: 'datastore',
+ datastoreType: 'VMFS',
+ datastoreAccessible: true,
+ multipleHostAccess: true,
+ datastoreUrl: '/vmfs/volumes/shared-vmfs',
+ },
+ platformData: {
+ sources: ['vmware-vsphere'],
+ },
+ },
+ {
+ id: 'storage-truenas-1',
+ type: 'storage',
+ name: 'tank',
+ displayName: 'tank',
+ parentId: 'truenas-main',
+ parentName: 'truenas-main',
+ platformId: 'truenas-1',
+ platformType: 'truenas',
+ sourceType: 'api',
+ sources: ['truenas'],
+ status: 'online',
+ lastSeen: '2026-03-30T20:00:00Z',
+ canonicalIdentity: {
+ displayName: 'tank',
+ platformId: 'truenas-1',
+ },
+ disk: {
+ total: 2_000 * 1024 * 1024 * 1024,
+ used: 1_000 * 1024 * 1024 * 1024,
+ free: 1_000 * 1024 * 1024 * 1024,
+ current: 50,
+ },
+ storage: {
+ platform: 'truenas',
+ type: 'zfs-pool',
+ topology: 'pool',
+ isZfs: true,
+ },
+ platformData: {
+ sources: ['truenas'],
+ },
+ },
+ ],
+ meta: {
+ page: 1,
+ limit: 100,
+ total: 2,
+ totalPages: 1,
+ },
+ }),
+ });
+ });
+
+ await page.goto('/storage?source=vmware-vsphere', {
+ waitUntil: 'domcontentloaded',
+ });
+
+ await expect(page).toHaveURL(/\/storage\?source=vmware-vsphere/);
+ await expect(page.locator('#storage-source-filter')).toHaveValue('vmware-vsphere');
+
+ const sourceOptions = await page.locator('#storage-source-filter option').evaluateAll((options) =>
+ options.map((option) => ({
+ value: option.getAttribute('value'),
+ label: option.textContent?.trim(),
+ })),
+ );
+ expect(sourceOptions).toEqual([
+ { value: 'all', label: 'All Sources' },
+ { value: 'truenas', label: 'TrueNAS' },
+ { value: 'vmware-vsphere', label: 'vSphere' },
+ ]);
+
+ const storageTable = page.locator('table').first();
+ await expect(storageTable).toContainText('shared-vmfs');
+ await expect(storageTable).toContainText('vSphere');
+ await expect(storageTable).toContainText('Datastore');
+ await expect(storageTable).toContainText('esxi-01.lab.local');
+ await expect(storageTable).not.toContainText('tank');
+ await expect(storageTable).not.toContainText('Backup Target');
+ await expect(storageTable).not.toContainText('Protected');
+
+ expect(unexpectedVmwareApiCall).toBeNull();
+
+ await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
+ });
+});