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.

Carry vSphere VM virtual disks

rcourtman10c3c66f9227
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 550c54a0af..38076262c2 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -736,7 +736,7 @@ a separate Docker-only or TrueNAS-local inventory path.
27. Keep alert-side recovery drill-ins on that same shared route-helper contract. When alert investigation surfaces such as resource-incident panels expose recovery follow-up links for TrueNAS or future API-backed platforms, they must route through the canonical `frontend-modern/src/routing/resourceLinks.ts` recovery builder instead of freezing alert-local recovery URLs or introducing another provider-shaped recovery handoff vocabulary.
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, poller-owned `poll` / `observed` summary payloads, 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, guest-detail, VM snapshot-tree, and VM hardware Ethernet 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, guest-IP, `vmware.currentSnapshotId`, `vmware.snapshotTree`, snapshot creation/state/quiesce/current markers, child snapshot metadata, `vmware.networkAdapters`, adapter MAC address/type, backing network id/name, backing type, connection state, or start-connected / guest-control flags onto canonical VMware `agent` / `vm` / `storage` resources, storage and recovery may use that detail for labeling, navigation, and VM investigation context only; they must not promote those topology, guest, snapshot-tree, or vNIC fields into recovery ownership, restore targeting, protection grouping, compliance scoring, or a VMware-local recovery taxonomy without a separately governed slice.
+30. Keep VMware placement, guest-detail, VM snapshot-tree, VM hardware Ethernet, and VM hardware disk 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, guest-IP, `vmware.currentSnapshotId`, `vmware.snapshotTree`, snapshot creation/state/quiesce/current markers, child snapshot metadata, `vmware.networkAdapters`, adapter MAC address/type, backing network id/name, backing type, connection state, start-connected / guest-control flags, `vmware.virtualDisks`, virtual disk label/type, IDE/SCSI/SATA/NVMe placement, VMDK path, backing type, datastore name, or capacity onto canonical VMware `agent` / `vm` / `storage` resources, storage and recovery may use that detail for labeling, navigation, and VM investigation context only; they must not promote those topology, guest, snapshot-tree, vNIC, or virtual disk fields into recovery ownership, restore targeting, protection grouping, compliance scoring, 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.
That same shared storage adapter boundary also owns canonical platform
family vocabulary through the governed platform manifest.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 811caf80cd..660c7dc869 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -1152,7 +1152,7 @@ That same topology contract now also has a concrete projection seam.
detail on the shared `vmware` facet only: hosts may carry datacenter,
compute-resource, cluster, folder, and attached-datastore metadata; VMs may
carry runtime-host, folder, resource-pool, datastore, guest-identity, and VM
-hardware Ethernet adapter metadata plus canonical parentage to the owning
+hardware Ethernet adapter plus VM hardware disk metadata plus canonical parentage to the owning
ESXi `agent`; datastores may
carry datacenter/folder placement plus shared storage-node and workload
consumer metadata through `storage.nodes`, `storage.consumerCount`, and
@@ -1165,6 +1165,10 @@ VM hardware Ethernet adapter context belongs under
type, MAC address/type, PCI slot, backing type, backing network id/name,
distributed switch/port or opaque-network references, connection state,
start-connected, guest-control, Wake-on-LAN, and UPT compatibility flags.
+VM hardware disk context belongs under `vmware.virtualDisks`, including the
+vCenter disk id, label, host-bus adapter type, IDE/SCSI/SATA/NVMe placement,
+backing type, VMDK file path, bracketed datastore name when the VMDK path
+provides it, and capacity in bytes.
Those enrichments must remain subordinate to shared `agent`, `vm`, and
`storage` resources rather than becoming a VMware-only topology graph, recovery
artifact, canonical identity alias, or separate provider detail drawer
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
index e620ba01c3..f74fd51138 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
@@ -322,6 +322,19 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
allowGuestControl: true,
},
],
+ virtualDisks: [
+ {
+ disk: '2000',
+ label: 'Hard disk 1',
+ type: 'SCSI',
+ scsiBus: 0,
+ scsiUnit: 1,
+ backingType: 'VMDK_FILE',
+ vmdkFile: '[shared-vsan] app-01/app-01.vmdk',
+ datastoreName: 'shared-vsan',
+ capacityBytes: 107374182400,
+ },
+ ],
activeAlarmCount: 1,
activeAlarmSummary: 'Host fan degraded',
recentTaskCount: 1,
@@ -376,6 +389,19 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
allowGuestControl: true,
},
],
+ virtualDisks: [
+ {
+ disk: '2000',
+ label: 'Hard disk 1',
+ type: 'SCSI',
+ scsiBus: 0,
+ scsiUnit: 1,
+ backingType: 'VMDK_FILE',
+ vmdkFile: '[shared-vsan] app-01/app-01.vmdk',
+ datastoreName: 'shared-vsan',
+ capacityBytes: 107374182400,
+ },
+ ],
activeAlarmCount: 1,
activeAlarmSummary: 'Host fan degraded',
recentTaskCount: 1,
@@ -411,7 +437,9 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByTestId('resource-vmware-details-section')).toBeInTheDocument();
expect(
- getByText('Lab VC · Read-only vCenter context · 2 snapshots · 1 vNIC · 1 alarm · 1 task'),
+ getByText(
+ 'Lab VC · Read-only vCenter context · 2 snapshots · 1 vNIC · 1 disk · 1 alarm · 1 task',
+ ),
).toBeInTheDocument();
expect(queryByText('Compute Cluster')).toBeNull();
expect(queryByText('Create snapshot (success)')).toBeNull();
@@ -426,6 +454,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(within(section).getByText('State')).toBeInTheDocument();
expect(within(section).getByText('Placement')).toBeInTheDocument();
expect(within(section).getByText('Guest')).toBeInTheDocument();
+ expect(within(section).getByText('Virtual disks')).toBeInTheDocument();
expect(within(section).getByText('Network')).toBeInTheDocument();
expect(within(section).getByText('Signals')).toBeInTheDocument();
expect(within(section).getByText('Snapshot tree')).toBeInTheDocument();
@@ -433,6 +462,8 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(within(section).getByText('Compute Cluster')).toBeInTheDocument();
expect(within(section).getByText('esxi-01.lab.local')).toBeInTheDocument();
expect(within(section).getByText('ubuntu64Guest')).toBeInTheDocument();
+ expect(within(section).getByText('Hard disk 1')).toBeInTheDocument();
+ expect(within(section).getByText(/SCSI 0:1 · 100 GB · shared-vsan/)).toBeInTheDocument();
expect(within(section).getByText('Network adapter 1')).toBeInTheDocument();
expect(within(section).getByText(/VMXNET3 · VM Network/)).toBeInTheDocument();
expect(within(section).getByText(/Create snapshot \(success\)/)).toBeInTheDocument();
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerVmwareModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerVmwareModel.test.ts
index 81778a46d5..07f1eff877 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerVmwareModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerVmwareModel.test.ts
@@ -24,6 +24,19 @@ describe('resourceDetailDrawerVmwareModel', () => {
allowGuestControl: true,
},
],
+ virtualDisks: [
+ {
+ disk: '2000',
+ label: 'Hard disk 1',
+ type: 'SCSI',
+ scsiBus: 0,
+ scsiUnit: 1,
+ backingType: 'VMDK_FILE',
+ vmdkFile: '[nvme-primary] app-01/app-01.vmdk',
+ datastoreName: 'nvme-primary',
+ capacityBytes: 107374182400,
+ },
+ ],
snapshotTree: [
{
snapshot: 'snapshot-201',
@@ -46,9 +59,19 @@ describe('resourceDetailDrawerVmwareModel', () => {
};
expect(buildVMwareDetailsSummary('vm', vmware)).toBe(
- 'Lab VC · Read-only vCenter context · 2 snapshots · 1 vNIC',
+ 'Lab VC · Read-only vCenter context · 2 snapshots · 1 vNIC · 1 disk',
);
+ const disks = buildVMwareDetailSections('vm', vmware).find((section) => section.id === 'disks');
+
+ expect(disks?.rows).toEqual([
+ {
+ label: 'Hard disk 1',
+ value: 'SCSI 0:1 · 100 GB · nvme-primary · VMDK_FILE · [nvme-primary] app-01/app-01.vmdk',
+ tone: 'default',
+ },
+ ]);
+
const network = buildVMwareDetailSections('vm', vmware).find(
(section) => section.id === 'network',
);
@@ -56,7 +79,8 @@ describe('resourceDetailDrawerVmwareModel', () => {
expect(network?.rows).toEqual([
{
label: 'Network adapter 1',
- value: 'VMXNET3 · VM Network · 00:50:56:aa:bb:cc · CONNECTED · starts connected · guest control',
+ value:
+ 'VMXNET3 · VM Network · 00:50:56:aa:bb:cc · CONNECTED · starts connected · guest control',
tone: 'default',
},
]);
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerVmwareModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerVmwareModel.ts
index 7c1893537f..195d34a48e 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerVmwareModel.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerVmwareModel.ts
@@ -3,6 +3,7 @@ import type {
ResourceVMwareMeta,
ResourceVMwareNetworkAdapter,
ResourceVMwareSnapshot,
+ ResourceVMwareVirtualDisk,
} from '@/types/resource';
export type ResourceDetailDrawerVMwareRowTone = 'default' | 'accent' | 'warning';
@@ -14,7 +15,7 @@ export type ResourceDetailDrawerVMwareRow = {
};
export type ResourceDetailDrawerVMwareSection = {
- id: 'state' | 'placement' | 'guest' | 'network' | 'signals' | 'snapshots';
+ id: 'state' | 'placement' | 'guest' | 'disks' | 'network' | 'signals' | 'snapshots';
label: string;
rows: ResourceDetailDrawerVMwareRow[];
};
@@ -29,6 +30,19 @@ const formatBoolLabel = (value?: boolean): string => {
return value ? 'Yes' : 'No';
};
+const formatCapacityBytes = (value?: number): string => {
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) return '';
+ const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
+ let size = value;
+ let unitIndex = 0;
+ while (size >= 1024 && unitIndex < units.length - 1) {
+ size /= 1024;
+ unitIndex += 1;
+ }
+ const precision = unitIndex === 0 || size >= 10 ? 0 : 1;
+ return `${size.toFixed(precision)} ${units[unitIndex]}`;
+};
+
const countSnapshotTree = (snapshots?: ResourceVMwareSnapshot[]): number =>
(snapshots ?? []).reduce(
(total, snapshot) => total + 1 + countSnapshotTree(snapshot.children),
@@ -131,6 +145,50 @@ const networkAdapterRows = (
}))
.filter((row) => row.value);
+const virtualDiskDisplayName = (disk: ResourceVMwareVirtualDisk): string =>
+ asTrimmedString(disk.label) || asTrimmedString(disk.disk) || 'Virtual disk';
+
+const formatVirtualDiskAddress = (disk: ResourceVMwareVirtualDisk): string => {
+ const type = asTrimmedString(disk.type).toUpperCase();
+ if (type === 'SCSI' && disk.scsiBus !== undefined && disk.scsiUnit !== undefined) {
+ return `SCSI ${disk.scsiBus}:${disk.scsiUnit}`;
+ }
+ if (type === 'SATA' && disk.sataBus !== undefined && disk.sataUnit !== undefined) {
+ return `SATA ${disk.sataBus}:${disk.sataUnit}`;
+ }
+ if (type === 'NVME' && disk.nvmeBus !== undefined && disk.nvmeUnit !== undefined) {
+ return `NVMe ${disk.nvmeBus}:${disk.nvmeUnit}`;
+ }
+ if (type === 'IDE' && disk.idePrimary !== undefined && disk.ideMaster !== undefined) {
+ return `IDE ${disk.idePrimary ? 'primary' : 'secondary'} ${
+ disk.ideMaster ? 'master' : 'slave'
+ }`;
+ }
+ return type;
+};
+
+const virtualDiskValue = (disk: ResourceVMwareVirtualDisk): string => {
+ const parts = [
+ formatVirtualDiskAddress(disk),
+ formatCapacityBytes(disk.capacityBytes),
+ asTrimmedString(disk.datastoreName),
+ asTrimmedString(disk.backingType),
+ asTrimmedString(disk.vmdkFile),
+ ].filter(Boolean);
+ return parts.join(' · ');
+};
+
+const virtualDiskRows = (
+ disks: ResourceVMwareVirtualDisk[] | undefined,
+): ResourceDetailDrawerVMwareRow[] =>
+ (disks ?? [])
+ .map((disk) => ({
+ label: virtualDiskDisplayName(disk),
+ value: virtualDiskValue(disk),
+ tone: 'default' as ResourceDetailDrawerVMwareRowTone,
+ }))
+ .filter((row) => row.value);
+
const vmwareEntityLabel = (entityType?: string): string => {
const normalized = asTrimmedString(entityType).toLowerCase();
switch (normalized) {
@@ -202,6 +260,10 @@ export const buildVMwareDetailsSummary = (
if (resourceType === 'vm' && networkAdapterCount > 0) {
parts.push(formatCount(networkAdapterCount, 'vNIC'));
}
+ const virtualDiskCount = vmware.virtualDisks?.length ?? 0;
+ if (resourceType === 'vm' && virtualDiskCount > 0) {
+ parts.push(formatCount(virtualDiskCount, 'disk'));
+ }
if ((vmware.activeAlarmCount ?? 0) > 0) {
parts.push(formatCount(vmware.activeAlarmCount ?? 0, 'alarm'));
}
@@ -329,6 +391,7 @@ export const buildVMwareDetailSections = (
]);
const networkRows = resourceType === 'vm' ? networkAdapterRows(vmware.networkAdapters) : [];
+ const diskRows = resourceType === 'vm' ? virtualDiskRows(vmware.virtualDisks) : [];
const signalRows = filterNonEmptyRows([
{
@@ -364,6 +427,7 @@ export const buildVMwareDetailSections = (
{ id: 'state', label: 'State', rows: stateRows },
{ id: 'placement', label: 'Placement', rows: placementRows },
{ id: 'guest', label: 'Guest', rows: guestRows },
+ { id: 'disks', label: 'Virtual disks', rows: diskRows },
{ id: 'network', label: 'Network', rows: networkRows },
{ id: 'signals', label: 'Signals', rows: signalRows },
{ id: 'snapshots', label: 'Snapshot tree', rows: snapshotRows },
diff --git a/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx b/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx
index 31f5de4065..d91f4851ae 100644
--- a/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx
@@ -37,6 +37,7 @@ import type {
Resource,
ResourceVMwareNetworkAdapter,
ResourceVMwareSnapshot,
+ ResourceVMwareVirtualDisk,
} from '@/types/resource';
import {
filterVmwareVirtualMachines,
@@ -169,6 +170,39 @@ const networkSummary = (
return { label: summary.label, title: title || summary.title };
};
+const virtualDiskAddress = (disk: ResourceVMwareVirtualDisk): string => {
+ const type = (asTrimmedString(disk.type) || '').toUpperCase();
+ if (type === 'SCSI' && disk.scsiBus !== undefined && disk.scsiUnit !== undefined) {
+ return `SCSI ${disk.scsiBus}:${disk.scsiUnit}`;
+ }
+ if (type === 'SATA' && disk.sataBus !== undefined && disk.sataUnit !== undefined) {
+ return `SATA ${disk.sataBus}:${disk.sataUnit}`;
+ }
+ if (type === 'NVME' && disk.nvmeBus !== undefined && disk.nvmeUnit !== undefined) {
+ return `NVMe ${disk.nvmeBus}:${disk.nvmeUnit}`;
+ }
+ return type;
+};
+
+const virtualDiskTitle = (disk: ResourceVMwareVirtualDisk): string =>
+ [
+ asTrimmedString(disk.label) || asTrimmedString(disk.disk),
+ virtualDiskAddress(disk),
+ typeof disk.capacityBytes === 'number' && Number.isFinite(disk.capacityBytes)
+ ? formatBytes(disk.capacityBytes)
+ : '',
+ asTrimmedString(disk.datastoreName),
+ asTrimmedString(disk.vmdkFile),
+ ]
+ .filter(Boolean)
+ .join(' · ');
+
+const virtualDiskCount = (disks: ResourceVMwareVirtualDisk[] | undefined): number =>
+ disks?.length ?? 0;
+
+const virtualDiskSummaryTitle = (disks: ResourceVMwareVirtualDisk[] | undefined): string =>
+ (disks ?? []).map(virtualDiskTitle).filter(Boolean).join(' | ');
+
const formatGuest = (resource: Resource): { label: string; detail: string; title: string } => {
const family = asTrimmedString(resource.vmware?.guestOsFamily);
const host = asTrimmedString(resource.vmware?.guestHostname);
@@ -298,7 +332,7 @@ export const VsphereVirtualMachinesTable: Component<{
>
<TableCard class={PLATFORM_TABLE_CARD_CLASS}>
<TableCardHeader title="Virtual Machines" />
- <Table class="min-w-full table-fixed text-xs md:min-w-[1520px]">
+ <Table class="min-w-full table-fixed text-xs md:min-w-[1580px]">
<TableHeader>
<TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
<TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[18%]`}>
@@ -343,6 +377,11 @@ export const VsphereVirtualMachinesTable: Component<{
>
Datastores
</TableHead>
+ <TableHead
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}
+ >
+ Disks
+ </TableHead>
<TableHead
class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}
>
@@ -354,11 +393,11 @@ export const VsphereVirtualMachinesTable: Component<{
</TableRow>
</TableHeader>
<TableBody class={PLATFORM_TABLE_BODY_CLASS}>
- <For each={groups()}>
- {(group) => (
- <>
- <TableRow class="bg-surface-alt/70 text-[11px] font-semibold text-base-content">
- <TableCell colSpan={12} class="px-2 py-1">
+ <For each={groups()}>
+ {(group) => (
+ <>
+ <TableRow class="bg-surface-alt/70 text-[11px] font-semibold text-base-content">
+ <TableCell colSpan={13} class="px-2 py-1">
<span>{group.label}</span>
<Show when={group.cluster}>
<span class="ml-2 rounded border border-border bg-surface px-1.5 py-0.5 text-[10px] font-medium text-muted">
@@ -387,6 +426,8 @@ export const VsphereVirtualMachinesTable: Component<{
const datastores = createMemo(() =>
summarizeValues(meta()?.datastoreNames ?? [], '-', 1),
);
+ const disks = () => virtualDiskCount(meta()?.virtualDisks);
+ const diskTitle = () => virtualDiskSummaryTitle(meta()?.virtualDisks);
const snapshots = () =>
Math.max(
0,
@@ -527,6 +568,12 @@ export const VsphereVirtualMachinesTable: Component<{
>
<span class="block truncate">{datastores().label}</span>
</TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content tabular-nums md:table-cell`}
+ title={diskTitle()}
+ >
+ {disks()}
+ </TableCell>
<TableCell
class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content tabular-nums md:table-cell`}
title={snapshotTitle()}
@@ -541,7 +588,7 @@ export const VsphereVirtualMachinesTable: Component<{
resource={vm}
open={isExpanded()}
detailRowId={detailRowId()}
- colSpan={12}
+ colSpan={13}
resolveResourceLabel={resolveResourceLabel}
onClose={() => drawer.close(vm)}
/>
diff --git a/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx b/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx
index f000badb12..3191f0e47b 100644
--- a/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx
+++ b/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx
@@ -44,6 +44,19 @@ const makeVM = (overrides: Partial<Resource> & Pick<Resource, 'id'>): Resource =
},
],
datastoreNames: ['nvme-primary', 'backup-nfs'],
+ virtualDisks: [
+ {
+ disk: '2000',
+ label: 'Hard disk 1',
+ type: 'SCSI',
+ scsiBus: 0,
+ scsiUnit: 1,
+ backingType: 'VMDK_FILE',
+ vmdkFile: '[nvme-primary] warehouse-api-01/warehouse-api-01.vmdk',
+ datastoreName: 'nvme-primary',
+ capacityBytes: 107374182400,
+ },
+ ],
snapshotTree: [
{
snapshot: 'snapshot-201',
@@ -98,6 +111,7 @@ describe('VsphereVirtualMachinesTable', () => {
expect(within(table).getByText('Pool')).toBeInTheDocument();
expect(within(table).getByText('Guest')).toBeInTheDocument();
expect(within(table).getByText('Network')).toBeInTheDocument();
+ expect(within(table).getByText('Disks')).toBeInTheDocument();
expect(within(table).getByText('Snapshots')).toBeInTheDocument();
expect(within(table).getByText('Health')).toBeInTheDocument();
expect(within(table).queryByRole('columnheader', { name: 'ID' })).not.toBeInTheDocument();
@@ -108,6 +122,9 @@ describe('VsphereVirtualMachinesTable', () => {
expect(screen.getByText('warehouse-api-01.internal')).toBeInTheDocument();
expect(screen.getByText('VM Network')).toBeInTheDocument();
expect(screen.getByText('nvme-primary +1')).toBeInTheDocument();
+ expect(screen.getByTitle(/Hard disk 1 · SCSI 0:1 · 100 GB · nvme-primary/)).toHaveTextContent(
+ '1',
+ );
expect(screen.getByText('Healthy')).toBeInTheDocument();
expect(screen.getByTitle('pre-upgrade, post-upgrade (current)')).toHaveTextContent('2');
diff --git a/frontend-modern/src/features/vmware/vmwarePageModel.ts b/frontend-modern/src/features/vmware/vmwarePageModel.ts
index a045d998d2..a70f2efd1d 100644
--- a/frontend-modern/src/features/vmware/vmwarePageModel.ts
+++ b/frontend-modern/src/features/vmware/vmwarePageModel.ts
@@ -721,6 +721,13 @@ const vmwareVirtualMachineSearchHaystack = (resource: Resource): string =>
.join(' '),
)
.join(' '),
+ resource.vmware?.virtualDisks
+ ?.map((disk) =>
+ [disk.disk, disk.label, disk.type, disk.backingType, disk.vmdkFile, disk.datastoreName]
+ .filter(Boolean)
+ .join(' '),
+ )
+ .join(' '),
resource.vmware?.activeAlarmSummary,
resource.vmware?.recentTaskSummary,
...(resource.tags ?? []),
diff --git a/frontend-modern/src/types/__tests__/resource.test.ts b/frontend-modern/src/types/__tests__/resource.test.ts
index a151af531b..7b1c840bcc 100644
--- a/frontend-modern/src/types/__tests__/resource.test.ts
+++ b/frontend-modern/src/types/__tests__/resource.test.ts
@@ -283,6 +283,19 @@ describe('Resource Helper Functions', () => {
allowGuestControl: true,
},
],
+ virtualDisks: [
+ {
+ disk: '2000',
+ label: 'Hard disk 1',
+ type: 'SCSI',
+ scsiBus: 0,
+ scsiUnit: 1,
+ backingType: 'VMDK_FILE',
+ vmdkFile: '[primary-vmfs] app-01/app-01.vmdk',
+ datastoreName: 'primary-vmfs',
+ capacityBytes: 107374182400,
+ },
+ ],
snapshotTree: [
{
snapshot: 'snapshot-101',
@@ -312,6 +325,8 @@ describe('Resource Helper Functions', () => {
expect(vmware.snapshotCount).toBe(3);
expect(vmware.currentSnapshotId).toBe('snapshot-103');
expect(vmware.networkAdapters?.[0]?.networkName).toBe('VM Network');
+ expect(vmware.virtualDisks?.[0]?.vmdkFile).toBe('[primary-vmfs] app-01/app-01.vmdk');
+ expect(vmware.virtualDisks?.[0]?.capacityBytes).toBe(107374182400);
expect(vmware.snapshotTree?.[0]?.children?.[0]?.current).toBe(true);
});
});
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 7fe7d8a4dd..12769905de 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -861,6 +861,24 @@ export interface ResourceVMwareNetworkAdapter {
uptV2CompatibilityEnabled?: boolean;
}
+export interface ResourceVMwareVirtualDisk {
+ disk?: string;
+ label?: string;
+ type?: string;
+ idePrimary?: boolean;
+ ideMaster?: boolean;
+ scsiBus?: number;
+ scsiUnit?: number;
+ sataBus?: number;
+ sataUnit?: number;
+ nvmeBus?: number;
+ nvmeUnit?: number;
+ backingType?: string;
+ vmdkFile?: string;
+ datastoreName?: string;
+ capacityBytes?: number;
+}
+
export interface ResourceVMwareMeta {
connectionId?: string;
connectionName?: string;
@@ -905,6 +923,7 @@ export interface ResourceVMwareMeta {
currentSnapshotId?: string;
snapshotTree?: ResourceVMwareSnapshot[];
networkAdapters?: ResourceVMwareNetworkAdapter[];
+ virtualDisks?: ResourceVMwareVirtualDisk[];
}
export interface ResourceAvailabilityMeta {
diff --git a/internal/unifiedresources/canonical_identity_test.go b/internal/unifiedresources/canonical_identity_test.go
index 011afa5e78..8a2f7ac6e0 100644
--- a/internal/unifiedresources/canonical_identity_test.go
+++ b/internal/unifiedresources/canonical_identity_test.go
@@ -467,6 +467,9 @@ func TestRefreshCanonicalIdentityScopesVMwareManagedObjectsByConnection(t *testi
}
func TestRefreshCanonicalIdentityIgnoresVMwarePlacementDetailAliases(t *testing.T) {
+ scsiBus := int64(0)
+ scsiUnit := int64(1)
+ capacityBytes := int64(107374182400)
resource := Resource{
ID: "vmware-vm-1",
Type: ResourceTypeVM,
@@ -504,6 +507,17 @@ func TestRefreshCanonicalIdentityIgnoresVMwarePlacementDetailAliases(t *testing.
StartConnected: true,
AllowGuestControl: true,
}},
+ VirtualDisks: []VMwareVirtualDiskData{{
+ Disk: "2000",
+ Label: "Hard disk 1",
+ Type: "SCSI",
+ SCSIBus: &scsiBus,
+ SCSIUnit: &scsiUnit,
+ BackingType: "VMDK_FILE",
+ VMDKFile: "[vmfs-prod-01] db-vm/db-vm.vmdk",
+ DatastoreName: "vmfs-prod-01",
+ CapacityBytes: &capacityBytes,
+ }},
SnapshotTree: []VMwareSnapshotData{{
Snapshot: "snapshot-201",
Name: "pre-upgrade",
@@ -572,6 +586,11 @@ func TestRefreshCanonicalIdentityIgnoresVMwarePlacementDetailAliases(t *testing.
"network-101",
"VM Network",
"CONNECTED",
+ "2000",
+ "Hard disk 1",
+ "SCSI",
+ "VMDK_FILE",
+ "[vmfs-prod-01] db-vm/db-vm.vmdk",
}
for _, disallowed := range disallowedAliases {
for _, alias := range resource.Canonical.Aliases {
diff --git a/internal/unifiedresources/clone.go b/internal/unifiedresources/clone.go
index c11a3e26f7..697810baa6 100644
--- a/internal/unifiedresources/clone.go
+++ b/internal/unifiedresources/clone.go
@@ -269,6 +269,7 @@ func cloneVMwareData(in *VMwareData) *VMwareData {
out.GuestIPAddresses = cloneStringSlice(in.GuestIPAddresses)
out.SnapshotTree = cloneVMwareSnapshotDataSlice(in.SnapshotTree)
out.NetworkAdapters = cloneVMwareNetworkAdapterDataSlice(in.NetworkAdapters)
+ out.VirtualDisks = cloneVMwareVirtualDiskDataSlice(in.VirtualDisks)
return &out
}
@@ -297,6 +298,26 @@ func cloneVMwareNetworkAdapterDataSlice(in []VMwareNetworkAdapterData) []VMwareN
return out
}
+func cloneVMwareVirtualDiskDataSlice(in []VMwareVirtualDiskData) []VMwareVirtualDiskData {
+ if in == nil {
+ return nil
+ }
+ out := make([]VMwareVirtualDiskData, len(in))
+ for i := range in {
+ out[i] = in[i]
+ out[i].IDEPrimary = cloneBoolPtr(in[i].IDEPrimary)
+ out[i].IDEMaster = cloneBoolPtr(in[i].IDEMaster)
+ out[i].SCSIBus = cloneInt64Ptr(in[i].SCSIBus)
+ out[i].SCSIUnit = cloneInt64Ptr(in[i].SCSIUnit)
+ out[i].SATABus = cloneInt64Ptr(in[i].SATABus)
+ out[i].SATAUnit = cloneInt64Ptr(in[i].SATAUnit)
+ out[i].NVMEBus = cloneInt64Ptr(in[i].NVMEBus)
+ out[i].NVMEUnit = cloneInt64Ptr(in[i].NVMEUnit)
+ out[i].CapacityBytes = cloneInt64Ptr(in[i].CapacityBytes)
+ }
+ return out
+}
+
func clonePMGRelayDomainMetaSlice(in []PMGRelayDomainMeta) []PMGRelayDomainMeta {
if in == nil {
return nil
diff --git a/internal/unifiedresources/clone_test.go b/internal/unifiedresources/clone_test.go
index 13e8cd6511..e0c173c0c5 100644
--- a/internal/unifiedresources/clone_test.go
+++ b/internal/unifiedresources/clone_test.go
@@ -152,6 +152,9 @@ func TestCloneResource_MutateParentBySource(t *testing.T) {
func TestCloneResource_MutateVMwareDetailSlices(t *testing.T) {
createdAt := time.Date(2026, time.March, 30, 18, 15, 0, 0, time.UTC)
pciSlot := int64(160)
+ scsiBus := int64(0)
+ scsiUnit := int64(1)
+ diskCapacity := int64(107374182400)
original := &Resource{
ID: "vmware-vm-1",
VMware: &VMwareData{
@@ -171,6 +174,17 @@ func TestCloneResource_MutateVMwareDetailSlices(t *testing.T) {
MACAddress: "00:50:56:aa:bb:cc",
PCISlotNumber: &pciSlot,
}},
+ VirtualDisks: []VMwareVirtualDiskData{{
+ Disk: "2000",
+ Label: "Hard disk 1",
+ Type: "SCSI",
+ SCSIBus: &scsiBus,
+ SCSIUnit: &scsiUnit,
+ BackingType: "VMDK_FILE",
+ VMDKFile: "[nvme-primary] app-01/app-01.vmdk",
+ DatastoreName: "nvme-primary",
+ CapacityBytes: &diskCapacity,
+ }},
},
}
@@ -180,6 +194,9 @@ func TestCloneResource_MutateVMwareDetailSlices(t *testing.T) {
*cloned.VMware.SnapshotTree[0].CreatedAt = createdAt.Add(time.Hour)
cloned.VMware.NetworkAdapters[0].NetworkName = "mutated-network"
*cloned.VMware.NetworkAdapters[0].PCISlotNumber = 161
+ cloned.VMware.VirtualDisks[0].DatastoreName = "mutated-datastore"
+ *cloned.VMware.VirtualDisks[0].SCSIUnit = 2
+ *cloned.VMware.VirtualDisks[0].CapacityBytes = 1
if original.VMware.SnapshotTree[0].Name != "pre-upgrade" {
t.Fatalf("mutating cloned VMware snapshot should not affect original: %+v", original.VMware.SnapshotTree)
@@ -196,6 +213,15 @@ func TestCloneResource_MutateVMwareDetailSlices(t *testing.T) {
if *original.VMware.NetworkAdapters[0].PCISlotNumber != 160 {
t.Fatalf("mutating cloned VMware adapter PCI slot should not affect original: %+v", original.VMware.NetworkAdapters[0].PCISlotNumber)
}
+ if original.VMware.VirtualDisks[0].DatastoreName != "nvme-primary" {
+ t.Fatalf("mutating cloned VMware disk should not affect original: %+v", original.VMware.VirtualDisks)
+ }
+ if *original.VMware.VirtualDisks[0].SCSIUnit != 1 {
+ t.Fatalf("mutating cloned VMware disk unit should not affect original: %+v", original.VMware.VirtualDisks[0].SCSIUnit)
+ }
+ if *original.VMware.VirtualDisks[0].CapacityBytes != 107374182400 {
+ t.Fatalf("mutating cloned VMware disk capacity should not affect original: %+v", original.VMware.VirtualDisks[0].CapacityBytes)
+ }
}
// --- cloneProxmoxData ---
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index 7edbea699c..aa5a30c840 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -2006,9 +2006,11 @@ func TestCloneVMwareDataKeepsNestedRuntimeDetailsIsolated(t *testing.T) {
requiredSnippets := []string{
"out.SnapshotTree = cloneVMwareSnapshotDataSlice(in.SnapshotTree)",
"out.NetworkAdapters = cloneVMwareNetworkAdapterDataSlice(in.NetworkAdapters)",
+ "out.VirtualDisks = cloneVMwareVirtualDiskDataSlice(in.VirtualDisks)",
"out[i].CreatedAt = cloneTimePtr(in[i].CreatedAt)",
"out[i].Children = cloneVMwareSnapshotDataSlice(in[i].Children)",
"out[i].PCISlotNumber = cloneInt64Ptr(in[i].PCISlotNumber)",
+ "out[i].CapacityBytes = cloneInt64Ptr(in[i].CapacityBytes)",
}
for _, snippet := range requiredSnippets {
if !strings.Contains(source, snippet) {
diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.go
index f4ae966fbf..546f81225c 100644
--- a/internal/unifiedresources/types.go
+++ b/internal/unifiedresources/types.go
@@ -1038,6 +1038,7 @@ type VMwareData struct {
CurrentSnapshotID string `json:"currentSnapshotId,omitempty"`
SnapshotTree []VMwareSnapshotData `json:"snapshotTree,omitempty"`
NetworkAdapters []VMwareNetworkAdapterData `json:"networkAdapters,omitempty"`
+ VirtualDisks []VMwareVirtualDiskData `json:"virtualDisks,omitempty"`
}
// VMwareSnapshotData contains one node in the vSphere VM snapshot tree. It is
@@ -1080,6 +1081,26 @@ type VMwareNetworkAdapterData struct {
UPTV2Compatibility bool `json:"uptV2CompatibilityEnabled,omitempty"`
}
+// VMwareVirtualDiskData contains vCenter VM hardware disk facts as read-only
+// workload context, not a Pulse storage/recovery model.
+type VMwareVirtualDiskData struct {
+ Disk string `json:"disk,omitempty"`
+ Label string `json:"label,omitempty"`
+ Type string `json:"type,omitempty"`
+ IDEPrimary *bool `json:"idePrimary,omitempty"`
+ IDEMaster *bool `json:"ideMaster,omitempty"`
+ SCSIBus *int64 `json:"scsiBus,omitempty"`
+ SCSIUnit *int64 `json:"scsiUnit,omitempty"`
+ SATABus *int64 `json:"sataBus,omitempty"`
+ SATAUnit *int64 `json:"sataUnit,omitempty"`
+ NVMEBus *int64 `json:"nvmeBus,omitempty"`
+ NVMEUnit *int64 `json:"nvmeUnit,omitempty"`
+ BackingType string `json:"backingType,omitempty"`
+ VMDKFile string `json:"vmdkFile,omitempty"`
+ DatastoreName string `json:"datastoreName,omitempty"`
+ CapacityBytes *int64 `json:"capacityBytes,omitempty"`
+}
+
// TrueNASData contains TrueNAS-specific metadata for TrueNAS resources.
type TrueNASData struct {
Hostname string `json:"hostname,omitempty"`
diff --git a/internal/vmware/client_test.go b/internal/vmware/client_test.go
index 498a83c93b..7cdc9926bf 100644
--- a/internal/vmware/client_test.go
+++ b/internal/vmware/client_test.go
@@ -91,6 +91,22 @@ func TestClientCollectInventoryEnrichesSignals(t *testing.T) {
if !adapter.StartConnected || !adapter.AllowGuestControl || !adapter.WakeOnLANEnabled {
t.Fatalf("expected VM network adapter connection flags, got %+v", adapter)
}
+ if len(vm.VirtualDisks) != 1 {
+ t.Fatalf("expected one VM virtual disk, got %+v", vm.VirtualDisks)
+ }
+ disk := vm.VirtualDisks[0]
+ if disk.Disk != "2000" || disk.Label != "Hard disk 1" || disk.Type != "SCSI" {
+ t.Fatalf("unexpected VM virtual disk identity: %+v", disk)
+ }
+ if disk.SCSIBus == nil || *disk.SCSIBus != 0 || disk.SCSIUnit == nil || *disk.SCSIUnit != 1 {
+ t.Fatalf("expected VM virtual disk SCSI address, got bus=%+v unit=%+v", disk.SCSIBus, disk.SCSIUnit)
+ }
+ if disk.BackingType != "VMDK_FILE" || disk.VMDKFile != "[nvme-primary] app-01/app-01.vmdk" || disk.DatastoreName != "nvme-primary" {
+ t.Fatalf("unexpected VM virtual disk backing: %+v", disk)
+ }
+ if disk.CapacityBytes == nil || *disk.CapacityBytes != 107374182400 {
+ t.Fatalf("expected VM virtual disk capacity, got %+v", disk.CapacityBytes)
+ }
if vm.SnapshotCount != 2 {
t.Fatalf("vm snapshot count = %d, want 2", vm.SnapshotCount)
}
@@ -187,6 +203,9 @@ func TestClientCollectInventoryPreservesBaseInventoryWhenOptionalEnrichmentDegra
if len(vm.NetworkAdapters) != 1 || vm.NetworkAdapters[0].NetworkName != "VM Network" {
t.Fatalf("expected network adapter enrichment to survive degraded guest read, got %+v", vm.NetworkAdapters)
}
+ if len(vm.VirtualDisks) != 1 || vm.VirtualDisks[0].DatastoreName != "nvme-primary" {
+ t.Fatalf("expected virtual disk enrichment to survive degraded guest read, got %+v", vm.VirtualDisks)
+ }
if vm.RuntimeHostName != "esxi-01.lab.local" || vm.ResourcePoolName != "Tier 1" {
t.Fatalf("expected other topology enrichment to survive degraded guest read, got host=%q pool=%q", vm.RuntimeHostName, vm.ResourcePoolName)
}
@@ -395,6 +414,26 @@ func newVMwareTestServer(t *testing.T, cfg vmwareTestServerConfig) *httptest.Ser
"allow_guest_control": true,
})
})
+ mux.HandleFunc("/api/vcenter/vm/vm-201/hardware/disk", func(w http.ResponseWriter, r *http.Request) {
+ requireAutomationSession(t, r)
+ writeJSON(w, []map[string]any{{"disk": "2000"}})
+ })
+ mux.HandleFunc("/api/vcenter/vm/vm-201/hardware/disk/2000", func(w http.ResponseWriter, r *http.Request) {
+ requireAutomationSession(t, r)
+ writeJSON(w, map[string]any{
+ "label": "Hard disk 1",
+ "type": "SCSI",
+ "scsi": map[string]any{
+ "bus": 0,
+ "unit": 1,
+ },
+ "backing": map[string]any{
+ "type": "VMDK_FILE",
+ "vmdk_file": "[nvme-primary] app-01/app-01.vmdk",
+ },
+ "capacity": 107374182400,
+ })
+ })
mux.HandleFunc("/sdk/vim25/9.0.0.0/ServiceInstance/ServiceInstance/content", func(w http.ResponseWriter, r *http.Request) {
writeJSON(w, map[string]any{
diff --git a/internal/vmware/client_topology.go b/internal/vmware/client_topology.go
index 8050057e98..22114d5d11 100644
--- a/internal/vmware/client_topology.go
+++ b/internal/vmware/client_topology.go
@@ -54,6 +54,36 @@ type vcenterVMHardwareEthernetInfo struct {
AllowGuestControl bool `json:"allow_guest_control"`
}
+type vcenterVMHardwareDiskSummary struct {
+ Disk string `json:"disk"`
+}
+
+type vcenterVMHardwareDiskBacking struct {
+ Type string `json:"type"`
+ VMDKFile string `json:"vmdk_file"`
+}
+
+type vcenterVMHardwareDiskIDEAddress struct {
+ Primary *bool `json:"primary"`
+ Master *bool `json:"master"`
+}
+
+type vcenterVMHardwareDiskBusUnitAddress struct {
+ Bus *int64 `json:"bus"`
+ Unit *int64 `json:"unit"`
+}
+
+type vcenterVMHardwareDiskInfo struct {
+ Label string `json:"label"`
+ Type string `json:"type"`
+ IDE *vcenterVMHardwareDiskIDEAddress `json:"ide"`
+ SCSI *vcenterVMHardwareDiskBusUnitAddress `json:"scsi"`
+ SATA *vcenterVMHardwareDiskBusUnitAddress `json:"sata"`
+ NVME *vcenterVMHardwareDiskBusUnitAddress `json:"nvme"`
+ Backing vcenterVMHardwareDiskBacking `json:"backing"`
+ Capacity *int64 `json:"capacity"`
+}
+
type viJSONVirtualMachineRuntimeInfo struct {
Host *viJSONReference `json:"host"`
}
@@ -311,6 +341,14 @@ func (c *Client) enrichVMTopology(
}
vm.NetworkAdapters = networkAdapters
+ virtualDisks, err := c.collectVMHardwareDisks(ctx, automationSessionID, vm.VM)
+ if issue, ok := classifyInventoryEnrichmentIssue("topology", "vm", vm.VM, err); ok {
+ recordIssue(issue)
+ } else if err != nil && !isAutomationNotFound(err) && !isAutomationUnavailable(err) {
+ return vm, nil, err
+ }
+ vm.VirtualDisks = virtualDisks
+
var placement vmwarePlacement
parentRef, err := c.collectEntityReference(ctx, release, sessionID, "VirtualMachine", vm.VM, "parent", "vm parent placement")
@@ -543,6 +581,70 @@ func (c *Client) collectVMEthernetAdapters(
return adapters, nil
}
+func (c *Client) collectVMHardwareDisks(
+ ctx context.Context,
+ automationSessionID string,
+ vmID string,
+) ([]InventoryVMVirtualDisk, error) {
+ vmID = strings.TrimSpace(vmID)
+ if vmID == "" || strings.TrimSpace(automationSessionID) == "" {
+ return nil, nil
+ }
+
+ escapedVMID := url.PathEscape(vmID)
+ var summaries []vcenterVMHardwareDiskSummary
+ path := fmt.Sprintf("/api/vcenter/vm/%s/hardware/disk", escapedVMID)
+ if err := c.getAutomationJSON(ctx, automationSessionID, path, "vm hardware disk list", &summaries); err != nil {
+ return nil, err
+ }
+ if len(summaries) == 0 {
+ return nil, nil
+ }
+
+ disks := make([]InventoryVMVirtualDisk, 0, len(summaries))
+ for _, summary := range summaries {
+ diskID := strings.TrimSpace(summary.Disk)
+ if diskID == "" {
+ continue
+ }
+ var info vcenterVMHardwareDiskInfo
+ path := fmt.Sprintf("/api/vcenter/vm/%s/hardware/disk/%s", escapedVMID, url.PathEscape(diskID))
+ if err := c.getAutomationJSON(ctx, automationSessionID, path, "vm hardware disk", &info); err != nil {
+ return nil, err
+ }
+ disk := InventoryVMVirtualDisk{
+ Disk: diskID,
+ Label: strings.TrimSpace(info.Label),
+ Type: strings.TrimSpace(info.Type),
+ BackingType: strings.TrimSpace(info.Backing.Type),
+ VMDKFile: strings.TrimSpace(info.Backing.VMDKFile),
+ DatastoreName: vmdkDatastoreName(info.Backing.VMDKFile),
+ CapacityBytes: cloneInt64Pointer(info.Capacity),
+ }
+ if info.IDE != nil {
+ disk.IDEPrimary = cloneBoolPointer(info.IDE.Primary)
+ disk.IDEMaster = cloneBoolPointer(info.IDE.Master)
+ }
+ if info.SCSI != nil {
+ disk.SCSIBus = cloneInt64Pointer(info.SCSI.Bus)
+ disk.SCSIUnit = cloneInt64Pointer(info.SCSI.Unit)
+ }
+ if info.SATA != nil {
+ disk.SATABus = cloneInt64Pointer(info.SATA.Bus)
+ disk.SATAUnit = cloneInt64Pointer(info.SATA.Unit)
+ }
+ if info.NVME != nil {
+ disk.NVMEBus = cloneInt64Pointer(info.NVME.Bus)
+ disk.NVMEUnit = cloneInt64Pointer(info.NVME.Unit)
+ }
+ disks = append(disks, disk)
+ }
+ sort.Slice(disks, func(i, j int) bool {
+ return vmwareSortKey(disks[i].Disk, disks[i].Label) < vmwareSortKey(disks[j].Disk, disks[j].Label)
+ })
+ return disks, nil
+}
+
func (c *Client) collectVMRuntimeHostReference(
ctx context.Context,
release string,
@@ -579,6 +681,18 @@ func (c *Client) collectDatastoreSummary(
return &summary, nil
}
+func vmdkDatastoreName(vmdkFile string) string {
+ value := strings.TrimSpace(vmdkFile)
+ if !strings.HasPrefix(value, "[") {
+ return ""
+ }
+ end := strings.Index(value, "]")
+ if end <= 1 {
+ return ""
+ }
+ return strings.TrimSpace(value[1:end])
+}
+
func (c *Client) collectEntityReference(
ctx context.Context,
release string,
diff --git a/internal/vmware/fixtures.go b/internal/vmware/fixtures.go
index 1d437aa7e2..0998ede268 100644
--- a/internal/vmware/fixtures.go
+++ b/internal/vmware/fixtures.go
@@ -209,6 +209,7 @@ func defaultFixturesPrimaryCluster(
SnapshotCount: 1,
CurrentSnapshotID: "snapshot-201",
NetworkAdapters: fixtureVMNetworkAdapters("vm-201", "VM Network", true),
+ VirtualDisks: fixtureVMVirtualDisks("vm-201", "nvme-primary", 128_000_000_000),
SnapshotTree: []InventoryVMSnapshot{{
Snapshot: "snapshot-201",
Name: "pre-deploy-checkpoint",
@@ -266,6 +267,7 @@ func defaultFixturesPrimaryCluster(
SnapshotCount: 3,
CurrentSnapshotID: "snapshot-213",
NetworkAdapters: fixtureVMNetworkAdapters("vm-202", "Database Network", true),
+ VirtualDisks: fixtureVMVirtualDisks("vm-202", "nvme-primary", 256_000_000_000),
SnapshotTree: []InventoryVMSnapshot{{
Snapshot: "snapshot-211",
Name: "baseline",
@@ -341,6 +343,7 @@ func defaultFixturesPrimaryCluster(
OverallStatus: "green",
SnapshotCount: 1,
NetworkAdapters: fixtureVMNetworkAdapters("vm-203", "Web Network", true),
+ VirtualDisks: fixtureVMVirtualDisks("vm-203", "analytics-vsan", 96_000_000_000),
Metrics: &InventoryMetrics{
CPUPercent: float64Ptr(22.1),
MemoryPercent: float64Ptr(51.2),
@@ -380,6 +383,7 @@ func defaultFixturesPrimaryCluster(
OverallStatus: "green",
SnapshotCount: 2,
NetworkAdapters: fixtureVMNetworkAdapters("vm-204", "Platform Network", true),
+ VirtualDisks: fixtureVMVirtualDisks("vm-204", "analytics-vsan", 192_000_000_000),
Metrics: &InventoryMetrics{
CPUPercent: float64Ptr(27.8),
MemoryPercent: float64Ptr(59.6),
@@ -419,6 +423,7 @@ func defaultFixturesPrimaryCluster(
OverallStatus: "green",
SnapshotCount: 0,
NetworkAdapters: fixtureVMNetworkAdapters("vm-205", "Utility Network", true),
+ VirtualDisks: fixtureVMVirtualDisks("vm-205", "analytics-vsan", 80_000_000_000),
Metrics: &InventoryMetrics{
CPUPercent: float64Ptr(16.8),
MemoryPercent: float64Ptr(46.1),
@@ -456,6 +461,7 @@ func defaultFixturesPrimaryCluster(
GuestHostname: "batch-worker-01.internal",
GuestIPAddresses: []string{},
OverallStatus: "gray",
+ VirtualDisks: fixtureVMVirtualDisks("vm-206", "archive-tier", 64_000_000_000),
},
},
Datastores: []InventoryDatastore{
@@ -722,6 +728,7 @@ func appendEdgeClusterFixtures(
GuestIPAddresses: guestIPs,
OverallStatus: v.Status,
NetworkAdapters: fixtureVMNetworkAdapters(v.ID, edgeVMNetworkName(v.Tier), v.PowerState == "POWERED_ON"),
+ VirtualDisks: fixtureVMVirtualDisks(v.ID, firstNonEmptyTrimmed(dsNames...), int64(v.MemMiB)*1024*1024*4),
}
if v.PowerState == "POWERED_ON" {
vm.Metrics = &InventoryMetrics{
@@ -830,6 +837,24 @@ func fixtureVMNetworkAdapters(vmID, networkName string, connected bool) []Invent
}}
}
+func fixtureVMVirtualDisks(vmID, datastoreName string, capacityBytes int64) []InventoryVMVirtualDisk {
+ if capacityBytes <= 0 {
+ capacityBytes = 64_000_000_000
+ }
+ datastoreName = firstNonEmptyTrimmed(datastoreName, "vmfs-primary")
+ return []InventoryVMVirtualDisk{{
+ Disk: "2000",
+ Label: "Hard disk 1",
+ Type: "SCSI",
+ SCSIBus: int64Ptr(0),
+ SCSIUnit: int64Ptr(0),
+ BackingType: "VMDK_FILE",
+ VMDKFile: fmt.Sprintf("[%s] %s/%s.vmdk", datastoreName, vmID, vmID),
+ DatastoreName: datastoreName,
+ CapacityBytes: int64Ptr(capacityBytes),
+ }}
+}
+
func fixtureVMMACAddress(vmID string) string {
var value int
for _, r := range vmID {
diff --git a/internal/vmware/provider.go b/internal/vmware/provider.go
index 6ed2e7c625..e253ca1bca 100644
--- a/internal/vmware/provider.go
+++ b/internal/vmware/provider.go
@@ -78,6 +78,26 @@ type InventoryVMNetworkAdapter struct {
UPTV2Compatibility bool `json:"upt_v2_compatibility_enabled,omitempty"`
}
+// InventoryVMVirtualDisk preserves vCenter VM hardware disk facts as read-only
+// workload context.
+type InventoryVMVirtualDisk struct {
+ Disk string `json:"disk,omitempty"`
+ Label string `json:"label,omitempty"`
+ Type string `json:"type,omitempty"`
+ IDEPrimary *bool `json:"ide_primary,omitempty"`
+ IDEMaster *bool `json:"ide_master,omitempty"`
+ SCSIBus *int64 `json:"scsi_bus,omitempty"`
+ SCSIUnit *int64 `json:"scsi_unit,omitempty"`
+ SATABus *int64 `json:"sata_bus,omitempty"`
+ SATAUnit *int64 `json:"sata_unit,omitempty"`
+ NVMEBus *int64 `json:"nvme_bus,omitempty"`
+ NVMEUnit *int64 `json:"nvme_unit,omitempty"`
+ BackingType string `json:"backing_type,omitempty"`
+ VMDKFile string `json:"vmdk_file,omitempty"`
+ DatastoreName string `json:"datastore_name,omitempty"`
+ CapacityBytes *int64 `json:"capacity_bytes,omitempty"`
+}
+
// InventoryMetrics captures the current runtime metric floor projected onto
// canonical Pulse metrics for VMware-backed hosts and VMs.
type InventoryMetrics struct {
@@ -162,6 +182,7 @@ type InventoryVM struct {
CurrentSnapshotID string `json:"current_snapshot_id,omitempty"`
SnapshotTree []InventoryVMSnapshot `json:"snapshot_tree,omitempty"`
NetworkAdapters []InventoryVMNetworkAdapter `json:"network_adapters,omitempty"`
+ VirtualDisks []InventoryVMVirtualDisk `json:"virtual_disks,omitempty"`
Metrics *InventoryMetrics `json:"metrics,omitempty"`
}
@@ -511,6 +532,7 @@ func vmwareRecordsFromSnapshot(snapshot *InventorySnapshot, now func() time.Time
CurrentSnapshotID: strings.TrimSpace(vm.CurrentSnapshotID),
SnapshotTree: vmwareSnapshotTreeData(vm.SnapshotTree),
NetworkAdapters: vmwareNetworkAdaptersData(vm.NetworkAdapters),
+ VirtualDisks: vmwareVirtualDisksData(vm.VirtualDisks),
},
Tags: filterNonEmptyStrings(
"vmware",
@@ -671,6 +693,7 @@ func cloneInventoryVMs(in []InventoryVM) []InventoryVM {
out[i].RecentEvents = cloneInventoryEvents(in[i].RecentEvents)
out[i].SnapshotTree = cloneInventoryVMSnapshots(in[i].SnapshotTree)
out[i].NetworkAdapters = cloneInventoryVMNetworkAdapters(in[i].NetworkAdapters)
+ out[i].VirtualDisks = cloneInventoryVMVirtualDisks(in[i].VirtualDisks)
out[i].Metrics = cloneInventoryMetrics(in[i].Metrics)
}
return out
@@ -748,6 +771,26 @@ func cloneInventoryVMNetworkAdapters(in []InventoryVMNetworkAdapter) []Inventory
return out
}
+func cloneInventoryVMVirtualDisks(in []InventoryVMVirtualDisk) []InventoryVMVirtualDisk {
+ if in == nil {
+ return nil
+ }
+ out := make([]InventoryVMVirtualDisk, len(in))
+ for i := range in {
+ out[i] = in[i]
+ out[i].IDEPrimary = cloneBoolPointer(in[i].IDEPrimary)
+ out[i].IDEMaster = cloneBoolPointer(in[i].IDEMaster)
+ out[i].SCSIBus = cloneInt64Pointer(in[i].SCSIBus)
+ out[i].SCSIUnit = cloneInt64Pointer(in[i].SCSIUnit)
+ out[i].SATABus = cloneInt64Pointer(in[i].SATABus)
+ out[i].SATAUnit = cloneInt64Pointer(in[i].SATAUnit)
+ out[i].NVMEBus = cloneInt64Pointer(in[i].NVMEBus)
+ out[i].NVMEUnit = cloneInt64Pointer(in[i].NVMEUnit)
+ out[i].CapacityBytes = cloneInt64Pointer(in[i].CapacityBytes)
+ }
+ return out
+}
+
func cloneInventoryEnrichmentIssues(in []InventoryEnrichmentIssue) []InventoryEnrichmentIssue {
if in == nil {
return nil
@@ -1113,6 +1156,34 @@ func vmwareNetworkAdaptersData(adapters []InventoryVMNetworkAdapter) []unifiedre
return out
}
+func vmwareVirtualDisksData(disks []InventoryVMVirtualDisk) []unifiedresources.VMwareVirtualDiskData {
+ if len(disks) == 0 {
+ return nil
+ }
+ out := make([]unifiedresources.VMwareVirtualDiskData, 0, len(disks))
+ for _, disk := range disks {
+ item := unifiedresources.VMwareVirtualDiskData{
+ Disk: strings.TrimSpace(disk.Disk),
+ Label: strings.TrimSpace(disk.Label),
+ Type: strings.TrimSpace(disk.Type),
+ IDEPrimary: cloneBoolPointer(disk.IDEPrimary),
+ IDEMaster: cloneBoolPointer(disk.IDEMaster),
+ SCSIBus: cloneInt64Pointer(disk.SCSIBus),
+ SCSIUnit: cloneInt64Pointer(disk.SCSIUnit),
+ SATABus: cloneInt64Pointer(disk.SATABus),
+ SATAUnit: cloneInt64Pointer(disk.SATAUnit),
+ NVMEBus: cloneInt64Pointer(disk.NVMEBus),
+ NVMEUnit: cloneInt64Pointer(disk.NVMEUnit),
+ BackingType: strings.TrimSpace(disk.BackingType),
+ VMDKFile: strings.TrimSpace(disk.VMDKFile),
+ DatastoreName: strings.TrimSpace(disk.DatastoreName),
+ CapacityBytes: cloneInt64Pointer(disk.CapacityBytes),
+ }
+ out = append(out, item)
+ }
+ return out
+}
+
func vmwareNetworkAdapterMACAddresses(adapters []InventoryVMNetworkAdapter) []string {
if len(adapters) == 0 {
return nil
diff --git a/internal/vmware/provider_test.go b/internal/vmware/provider_test.go
index b2fee1c831..13d0ae6cb4 100644
--- a/internal/vmware/provider_test.go
+++ b/internal/vmware/provider_test.go
@@ -141,6 +141,17 @@ func TestProviderRecords_ProjectCanonicalVMwareResources(t *testing.T) {
AllowGuestControl: true,
WakeOnLANEnabled: true,
}},
+ VirtualDisks: []InventoryVMVirtualDisk{{
+ Disk: "2000",
+ Label: "Hard disk 1",
+ Type: "SCSI",
+ SCSIBus: int64Ptr(0),
+ SCSIUnit: int64Ptr(1),
+ BackingType: "VMDK_FILE",
+ VMDKFile: "[nvme-primary] app-01/app-01.vmdk",
+ DatastoreName: "nvme-primary",
+ CapacityBytes: int64Ptr(107374182400),
+ }},
}},
Datastores: []InventoryDatastore{{
Datastore: "datastore-11",
@@ -253,6 +264,15 @@ func TestProviderRecords_ProjectCanonicalVMwareResources(t *testing.T) {
if got := vmRecord.Resource.VMware.NetworkAdapters[0].PCISlotNumber; got == nil || *got != 160 {
t.Fatalf("vm network adapter pci slot = %+v, want 160", got)
}
+ if got := vmRecord.Resource.VMware.VirtualDisks; len(got) != 1 || got[0].Label != "Hard disk 1" || got[0].VMDKFile != "[nvme-primary] app-01/app-01.vmdk" {
+ t.Fatalf("vm virtual disk projection = %+v, want hard disk backing on nvme-primary", got)
+ }
+ if got := vmRecord.Resource.VMware.VirtualDisks[0].SCSIUnit; got == nil || *got != 1 {
+ t.Fatalf("vm virtual disk scsi unit = %+v, want 1", got)
+ }
+ if got := vmRecord.Resource.VMware.VirtualDisks[0].CapacityBytes; got == nil || *got != 107374182400 {
+ t.Fatalf("vm virtual disk capacity = %+v, want 107374182400", got)
+ }
if got := vmRecord.Resource.ParentName; got != "esxi-01.lab.local" {
t.Fatalf("vm parent name = %q, want esxi-01.lab.local", got)
}