Skip to main content
Glama

VMware Storage

作者: Wei Zhou, VMware by Broadcom — wei-wz.zhou@broadcom.com 这是一个由 VMware 工程师驱动的社区项目,并非 VMware 官方产品。 如需官方 VMware 开发工具,请访问 developer.broadcom.com。

English | 中文

VMware vSphere 存储管理:数据存储、iSCSI、vSAN — 11 个 MCP 工具,专注于领域且轻量化。

从 vmware-aiops 中拆分出来,以获得更轻量的上下文和本地模型兼容性。

License: MIT

配套技能

技能

范围

工具

安装

vmware-aiops ⭐ 入口点

虚拟机生命周期、部署、客户机操作、集群

31

uv tool install vmware-aiops

vmware-monitor

只读监控、警报、事件、虚拟机信息

8

uv tool install vmware-monitor

vmware-vks

Tanzu 命名空间、TKC 集群生命周期

20

uv tool install vmware-vks

vmware-nsx

NSX 网络:网段、网关、NAT、IPAM

31

uv tool install vmware-nsx-mgmt

vmware-nsx-security

DFW 微分段、安全组、Traceflow

20

uv tool install vmware-nsx-security

vmware-aria

Aria Ops 指标、警报、容量规划

18

uv tool install vmware-aria

Related MCP server: vmware-nsx

快速安装

# Via PyPI
uv tool install vmware-storage

# Or pip
pip install vmware-storage

配置

mkdir -p ~/.vmware-storage
cp config.example.yaml ~/.vmware-storage/config.yaml
# Edit with your vCenter/ESXi credentials

echo "VMWARE_MY_VCENTER_PASSWORD=your_password" > ~/.vmware-storage/.env
chmod 600 ~/.vmware-storage/.env

# Verify
vmware-storage doctor

MCP 工具 (11)

类别

工具

类型

数据存储

list_all_datastores, browse_datastore, scan_datastore_images, list_cached_images

读取

iSCSI

storage_iscsi_enable, storage_iscsi_status, storage_iscsi_add_target, storage_iscsi_remove_target, storage_rescan

读/写

vSAN

vsan_health, vsan_capacity

读取

常见工作流

在主机上设置 iSCSI 存储

  1. 启用 iSCSI 适配器: vmware-storage iscsi enable esxi-01

  2. 添加目标: vmware-storage iscsi add-target esxi-01 10.0.0.100

  3. 验证: vmware-storage iscsi status esxi-01

add-target 命令会自动重新扫描存储。请先使用 --dry-run 预览任何写入命令。

跨数据存储查找可部署镜像

  1. 列出所有数据存储: vmware-storage datastore list

  2. 扫描镜像: vmware-storage datastore scan-images datastore01

  3. 使用模式浏览: vmware-storage datastore browse datastore01 --pattern "*.iso"

vSAN 健康状况评估

  1. 检查健康状况: vmware-storage vsan health Cluster-Prod

  2. 检查容量: vmware-storage vsan capacity Cluster-Prod

  3. 如果发现问题,请使用 vmware-monitor 调查警报和事件

CLI

# Datastore
vmware-storage datastore list
vmware-storage datastore browse datastore01
vmware-storage datastore scan-images datastore01

# iSCSI
vmware-storage iscsi status esxi-01
vmware-storage iscsi enable esxi-01
vmware-storage iscsi add-target esxi-01 192.168.1.100
vmware-storage iscsi remove-target esxi-01 192.168.1.100
vmware-storage iscsi rescan esxi-01

# vSAN
vmware-storage vsan health Cluster-Prod
vmware-storage vsan capacity Cluster-Prod

# Diagnostics
vmware-storage doctor

MCP 服务器

在执行 uv tool install vmware-storage 后,使用一条命令启动 MCP 服务器 (v1.5.15+):

# Recommended — single command, no network re-resolve
vmware-storage mcp

# With a custom config path
VMWARE_STORAGE_CONFIG=/path/to/config.yaml vmware-storage mcp

# Or via Docker
docker compose up -d

代理配置

添加到您的 AI 代理的 MCP 配置中:

{
  "mcpServers": {
    "vmware-storage": {
      "command": "vmware-storage",
      "args": ["mcp"],
      "env": {
        "VMWARE_STORAGE_CONFIG": "~/.vmware-storage/config.yaml"
      }
    }
  }
}
# Run without installing (requires PyPI access each launch)
uvx --from vmware-storage vmware-storage mcp

# Legacy entry point (still works, kept for backward compatibility)
vmware-storage-mcp

位于企业 TLS 代理之后? uvx 可能会因 invalid peer certificate: UnknownIssuer 而失败。 请使用上述推荐的 vmware-storage mcp 形式(无需网络),或设置 UV_NATIVE_TLS=true。

为什么要单独作为一个技能?

vmware-aiops 拥有 33 个 MCP 工具 — 对于本地 LLM (7B-14B) 来说太重了。通过将存储拆分为独立的技能:

  • 11 个工具 — 完美适配小型模型的上下文窗口

  • 领域专注 — 存储管理员只需他们需要的功能

  • 可组合 — 可根据需要与 vmware-monitor 或 vmware-aiops 一起使用

版本兼容性

vSphere

支持

说明

8.0

完全支持

vSAN SDK 内置于 pyVmomi 8.0.3+

7.0

完全支持

所有存储 API 均可工作

6.7

兼容

iSCSI + 数据存储功能可用;vSAN 功能受限

安全性

功能

描述

读取密集型

11 个工具中有 6 个是只读的

输入验证

在 iSCSI 操作前验证 IP 地址和端口

审计日志

所有操作均记录到 ~/.vmware-storage/audit.log

无虚拟机操作

无法创建、删除或修改虚拟机

凭据安全

密码仅从环境变量获取,从不从配置文件获取

故障排除

问题

原因与修复

iSCSI 启用失败,提示 "already enabled"

这不是错误 — 适配器已处于活动状态。运行 iscsi status 查看已配置的目标。

浏览时提示 "Datastore not found"

数据存储名称区分大小写。运行 datastore list 获取确切名称。

vSAN 健康状况显示 "unknown"

vSAN 健康状况检查需要 vCenter 连接,而非独立的 ESXi。

重新扫描未发现新 LUN

添加目标后等待 15-30 秒,然后再次重新扫描。验证 ESXi 是否可达目标 IP。

"Password not found" 错误

变量名遵循 VMWARE_<TARGET_UPPER>_PASSWORD (连字符 → 下划线)。检查 ~/.vmware-storage/.env。

连接 vCenter 超时

在高延迟网络上,使用 vmware-storage doctor --skip-auth 跳过身份验证检查。

许可证

MIT

Available Tools

16 tools
add_iscsi_targetA

[WRITE] Add an iSCSI send (dynamic discovery) target to an ESXi host's software iSCSI adapter, then automatically rescan all HBAs and VMFS volumes to discover new LUNs.

Without confirm=True this only previews: it returns blast_radius (the adapter, the send targets configured now, and the adapters the rescan touches) and changes nothing. Show it to the user. Do not set confirm=True on your own because the user asked earlier — they have not seen the preview yet. Refused when software iSCSI is not enabled (run enable_iscsi first) or the host's storage view cannot be read. A duplicate address:port returns action "noop". No separate rescan_storage call is needed afterwards. Returns a dict.

Inputs: address (required), host_name (required), port, target, +1 more.

browse_datastoreA
Read-onlyIdempotent

[READ] Search a datastore folder and all its subfolders for files.

Use this for arbitrary files or a glob; prefer scan_datastore_images for deployable images. datastore_name comes from list_all_datastores.

Returns the list envelope: 'items' holds one row per file, and 'returned'/'total'/'truncated' state whether the listing is complete. All matches are returned, so truncated is always false.

Inputs: datastore_name (required), path, target, pattern.

enable_iscsiA

[WRITE] Enable the software iSCSI adapter (vmhba) on an ESXi host.

Required prerequisite before add_iscsi_target. Without confirm=True this only previews: it returns blast_radius (the host, its current adapters, whether the software adapter already exists) and changes nothing. Show it to the user. Do not set confirm=True on your own because the user asked earlier — they have not seen the preview yet. Already enabled returns action "noop" with the HBA device and IQN. Non-disruptive (no reboot, no impact on existing datastores). Refused when the host's storage view cannot be read. Returns a dict; check state first with get_iscsi_status.

Inputs: host_name (required), target, confirm.

get_access_infoA
Read-onlyIdempotent

[READ] Which account this server uses, and whether it holds each tool's vSphere privileges.

Use this when a tool fails with NoPermission, or before a write, to check what the configured account may do. Asks vCenter/ESXi about the current session (needs only System.View, so any account can ask about itself). Returns target, account, the privilege states, and for one tool its requires/verdict/meaning; without tool, every tool grouped by verdict. Gotchas: privileges are checked on the root folder only. A verdict of not_granted_at_root is NOT "no access" — the privilege may be granted on a specific cluster, host or datastore, where the tool then works. undetermined means vCenter did not answer; never read it as granted.

Inputs: tool, target.

get_datastore_vm_usageA
Read-onlyIdempotent

[READ] Which VMs take the space on one datastore, largest first.

Use this for "is this datastore filling up, and who is using it?". datastore_name comes from list_all_datastores. Reads vCenter's own per-VM accounting (storage.perDatastoreUsage), so it is space on disk, not the provisioned VMDK sizes browse_datastore shows.

Returns {datastore: {name, type, total_gb, used_gb, free_gb, usage_pct}, items, returned, total, truncated, attributed_gb, unattributed_gb, unmeasured_vms, note}. Each item: name, vm_id, template, committed_gb (on disk), uncommitted_gb (thin headroom it may still grow into), unshared_gb, measured_at. unattributed_gb is used space no VM accounts for: unregistered VMs, orphaned disks, ISOs; find those files with browse_datastore. unmeasured_vms list the datastore but have no usage row, so their space is unknown, not zero.

Inputs: datastore_name (required), top_n, target.

get_iscsi_statusA
Read-onlyIdempotent

[READ] Get the software iSCSI adapter state and configured send targets for an ESXi host.

Returns {host, enabled, hba_device, iqn, send_targets: [{address, port}]}; when the adapter is disabled, enabled=false with null device/IQN and an empty target list. Use this before enable_iscsi / add_iscsi_target / remove_iscsi_target to check prerequisites, and afterwards to verify the change took effect.

Inputs: host_name (required), target.

get_vsan_capacityA
Read-onlyIdempotent

[READ] Get space usage of a cluster's vSAN datastore for capacity planning.

Returns {cluster_name, vsan_enabled, datastore_name, accessible, total_gb, used_gb, free_gb, usage_pct}. When the vSAN datastore is inaccessible (accessible=false) the four figures are null with a message, not 0 — vCenter answers 0 for a datastore it cannot reach, and 0 GB used reads as a healthy empty datastore. accessible=null means the summary did not say. If vSAN is not enabled on the cluster, returns vsan_enabled=false with an explanatory message rather than an error; errors only if the cluster name is not found. Use get_vsan_health for disk-group layout and host details; use list_all_datastores for non-vSAN (VMFS/NFS) datastore usage. No side effects.

Inputs: cluster_name (required), target.

get_vsan_efficiencyA
Read-onlyIdempotent

[READ] Get vSAN data-efficiency (deduplication + compression) status for a cluster.

Returns {cluster_name, vsan_enabled, dedup_enabled, compression_enabled}. Reads it via the vSAN Management SDK (VsanVcClusterConfigSystem), not base pyVmomi. When vSAN reports no data-efficiency config (space efficiency off, or an OSA cluster without it), dedup_enabled/compression_enabled come back null with a message rather than a fabricated false. Errors only if the cluster name is not found. Use get_vsan_capacity for space usage and get_vsan_health for disk-group layout. No side effects.

Note: vSAN Global Deduplication and vSAN-to-vSAN replication are NOT exposed here — neither has a verified SDK object (global dedup has no distinct field; v2v replication lives in the separate vSAN Data Protection plane). Use the vCenter/vSAN UI for those.

Inputs: cluster_name (required), target.

get_vsan_healthA
Read-onlyIdempotent

[READ] Get vSAN overall health, per-check-group health, and per-host disk-group layout for a cluster.

Returns {cluster_name, vsan_enabled, overall_health, overall_health_description, health_queried, health_not_queried_reason, health_checked_at, test_groups: [{group_id, group_name, group_health}], host_count, hosts_read, hosts_not_read: [{host, reason}], disk_groups_complete, disk_groups: [{host, cache_disk, cache_size_gb, capacity_disks}]}. overall_health is what vSAN reports — green / yellow / red, and sometimes "unknown", which is vSAN's own answer. When the health service could not be asked at all, overall_health is null and health_queried is false with the reason: a null is "not measured", never a measurement. health_checked_at is the age of vCenter's cached summary (the same one Skyline Health shows); this tool reads the cache rather than triggering a full health run. Check disk_groups_complete before treating disk_groups as the cluster's inventory: vCenter cannot read a disconnected or notResponding host, and an empty disk_groups on such a cluster does NOT mean it has none — the unread hosts are named in hosts_not_read and in the message. If vSAN is not enabled, returns vsan_enabled=false with a message rather than an error. Use get_vsan_capacity for space usage instead. No side effects.

Inputs: cluster_name (required), target.

list_all_datastoresA
Read-onlyIdempotent

[READ] List all datastores with capacity, usage percentage, and accessibility.

Use this first for the datastore_name that browse_datastore and scan_datastore_images require.

Returns the list envelope: 'items' holds one row per datastore, and 'returned'/'total'/'truncated' state whether the listing is complete. Every datastore is enumerated before limit is applied, so total is the real count and truncated is true only when limit cut rows off.

Inputs: limit, target.

list_cached_imagesA
Read-onlyIdempotent

[READ] List deployable images (OVA/OVF/ISO/VMDK) from the local cache registry — instant, no vCenter connection or datastore I/O.

Reads ~/.vmware-storage/image_registry.json, which scan_datastore_images fills; results may be stale, and are empty until a scan has run. For a live listing use scan_datastore_images instead. Returns the list envelope: 'items' holds {target, datastore, name, ds_path, size_mb, type, modified} and is empty if nothing matches, while 'returned'/'total'/'truncated' state whether the listing is complete. The whole registry is filtered in memory, so truncated is always false.

Inputs: target, datastore, image_type.

list_fc_adaptersA
Read-onlyIdempotent

[READ] List Fibre Channel HBAs (FC and FCoE) per ESXi host: vmhba, model, driver, status, port type, WWPN/WWNN and reported link speed.

Use this for "which FC adapters does each host have" or to find a host's WWPNs; use list_storage_device_paths for devices and paths behind them. Scope with cluster OR host; with neither, every host on the target is read (only the adapter list is fetched, so this stays cheap).

Returns the list envelope ('items', 'returned', 'total', 'truncated', 'next_offset') plus hosts_without_fc (read, no FC HBA) and hosts_not_read [{host, reason}]. A host in hosts_not_read was NOT read — never report it as having no FC adapters. speed_reported is the raw vSphere value: the API documents bits per second, but hosts commonly report Gbit/s, so it is not converted. Reads host config only; no rescans.

Inputs: host, limit, offset, target, +1 more.

list_storage_device_pathsA
Read-onlyIdempotent

[READ] SCSI multipath state per device (NAA) across the hosts of one scope: which hosts see it, path counts and states, working paths, adapters, target WWPN, PSP/SATP policy, and the VMFS datastores on it.

Use for: "does datastore X have dead or disabled paths on any host" (datastore=X), "which hosts see naa.… and through which adapters" (cluster + device), "do hosts see different numbers of paths" (cluster + only_differences=true), "which devices and datastores depend on vmhba2" (host + adapter). Exactly one of cluster, host or datastore is required — this tool will not read every host at once.

Per device: shared (reached over FC/iSCSI or seen by 2+ hosts), seen_by, not_seen_on (hosts that WERE read and do not see a shared device; a disk inside one host is never listed), path_count_differs, states_needing_attention (dead/disabled only) and per-host {paths_total, by_state, working_paths, policy, satp, adapters}; with adapter set, also paths_via_adapter and only_paths_via_adapter (matched by vmhba name, which can be a different card on each host of a cluster). Per-path detail is included when device or datastore is given. Devices needing attention sort first; 'summary' counts the whole result, not just this page.

Gotchas: hosts in hosts_not_read were NOT read (refused, not connected — vCenter's copy of a lost host's config may be stale — or missing from the reply) and are never in not_seen_on — when complete is false, say which hosts are unknown instead of concluding a device is missing. States are as vSphere reports them: 'standby' can be normal (active/passive arrays), and a path count does not prove independent fabrics. NFS/vSAN/vVol datastores have no SCSI paths (scope_note says so). NVMe-oF namespaces may not appear. No rescans.

Inputs: host, limit, device, offset, +5 more.

remove_iscsi_targetA
Destructive

[WRITE] Remove an iSCSI send target from an ESXi host's software iSCSI adapter, then rescan all HBAs and VMFS volumes.

Destructive: LUNs served only through this target become inaccessible after the rescan. Without confirm=True this only previews: it returns blast_radius (the static targets it discovered, the paths that go with them, the devices and VMFS datastores that lose all or some paths) and changes nothing. Show that to the user and get their explicit decision. Do not set confirm=True on your own because the user asked earlier — they have not seen what it cuts off yet. Refused when a datastore would lose every path (unmount it first), when the address:port is not configured or software iSCSI is disabled, and when any path or static target cannot be attributed. Reversible only by re-adding via add_iscsi_target. Returns a dict.

Inputs: address (required), host_name (required), port, target, +1 more.

rescan_storageA

[WRITE] Rescan all HBAs and VMFS volumes on an ESXi host to discover newly presented LUNs and datastores.

Use this when a storage array presents new LUNs, or after out-of-band SAN changes. Not needed after add_iscsi_target / remove_iscsi_target — those rescan automatically. Without confirm=True this only previews: it returns blast_radius (the host, every adapter the rescan touches, the mounted VMFS volumes) and changes nothing. Show it to the user. Do not set confirm=True on your own because the user asked earlier — they have not seen the preview yet. Deletes nothing, but it is I/O-visible on the host and may take a minute or two with many paths. Refused when the host's storage view cannot be read. Returns a dict.

Inputs: host_name (required), target, confirm.

scan_datastore_imagesA
Read-onlyIdempotent

[READ] Scan a datastore for deployable images (OVA, ISO, OVF, VMDK).

Use this for a live scan of one datastore; prefer list_cached_images for a cached answer. datastore_name comes from list_all_datastores.

Returns the list envelope: 'items' holds one row per image, and 'returned'/'total'/'truncated' state whether the listing is complete. All patterns are browsed, so truncated is always false.

Inputs: datastore_name (required), path, target.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 16 tools

    Disambiguation4/5

    Each tool targets a distinct resource/action, and the descriptions explicitly cross-reference neighbors (browse_datastore vs scan_datastore_images vs list_cached_images; get_vsan_health vs capacity vs efficiency). The only mild overlap is between enumeration-style reads (list_all_datastores vs list_fc_adapters vs get_datastore_vm_usage), but the scoping text makes selection straightforward.

    Naming Consistency4/5

    Everything is snake_case verb_noun, which is a consistent, predictable pattern. Minor deviation: the verbs get_ vs list_ are used somewhat arbitrarily for enumeration results (list_fc_adapters vs get_vsan_health both return lists), and list_all_datastores carries a stray 'all' infix.

    Tool Count4/5

    16 tools for a broad storage domain (iSCSI, datastores, images, vSAN, FC, multipath, permissions) is defensible and each tool maps to a real task. It is at the upper edge of comfortable without feeling padded.

    Completeness3/5

    Read coverage is strong (iSCSI, datastores, images, vSAN trio, FC, paths, access), and the iSCSI write path is coherent. However, the write surface is asymmetric: enable_iscsi has no disable_iscsi, and remove_iscsi_target explicitly refuses when a datastore would lose every path ('unmount it first') yet no unmount/rescan-datastore tool exists — a hard dead end for the agent.

    Maintenance

    ActivityActive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers