vmware-privateai 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. vmware_privateai-1.0.0/.gitignore +8 -0
  2. vmware_privateai-1.0.0/LICENSE +21 -0
  3. vmware_privateai-1.0.0/PKG-INFO +42 -0
  4. vmware_privateai-1.0.0/README-CN.md +82 -0
  5. vmware_privateai-1.0.0/README.md +19 -0
  6. vmware_privateai-1.0.0/RELEASE_NOTES.md +74 -0
  7. vmware_privateai-1.0.0/SECURITY.md +75 -0
  8. vmware_privateai-1.0.0/pyproject.toml +64 -0
  9. vmware_privateai-1.0.0/server.json +21 -0
  10. vmware_privateai-1.0.0/skills/vmware-privateai/SKILL.md +213 -0
  11. vmware_privateai-1.0.0/skills/vmware-privateai/references/capabilities.md +77 -0
  12. vmware_privateai-1.0.0/skills/vmware-privateai/references/cli-reference.md +112 -0
  13. vmware_privateai-1.0.0/skills/vmware-privateai/references/setup-guide.md +141 -0
  14. vmware_privateai-1.0.0/tests/eval/regression/test_assign.py +161 -0
  15. vmware_privateai-1.0.0/tests/eval/regression/test_config.py +106 -0
  16. vmware_privateai-1.0.0/tests/eval/regression/test_endpoint_gate.py +86 -0
  17. vmware_privateai-1.0.0/tests/eval/regression/test_gpu.py +158 -0
  18. vmware_privateai-1.0.0/tests/eval/regression/test_pais.py +134 -0
  19. vmware_privateai-1.0.0/tests/eval/regression/test_sanitize.py +58 -0
  20. vmware_privateai-1.0.0/tests/eval/regression/test_utilization.py +132 -0
  21. vmware_privateai-1.0.0/tests/eval/regression/test_vgpu_profiles.py +168 -0
  22. vmware_privateai-1.0.0/tests/eval/spec/privateai_endpoints.py +157 -0
  23. vmware_privateai-1.0.0/uv.lock +1147 -0
  24. vmware_privateai-1.0.0/vmware_privateai/__init__.py +8 -0
  25. vmware_privateai-1.0.0/vmware_privateai/cli/__init__.py +38 -0
  26. vmware_privateai-1.0.0/vmware_privateai/cli/_common.py +68 -0
  27. vmware_privateai-1.0.0/vmware_privateai/cli/gpu.py +157 -0
  28. vmware_privateai-1.0.0/vmware_privateai/cli/pais.py +61 -0
  29. vmware_privateai-1.0.0/vmware_privateai/cli/vgpu.py +59 -0
  30. vmware_privateai-1.0.0/vmware_privateai/config.py +245 -0
  31. vmware_privateai-1.0.0/vmware_privateai/connection.py +178 -0
  32. vmware_privateai-1.0.0/vmware_privateai/mcp_server/__init__.py +1 -0
  33. vmware_privateai-1.0.0/vmware_privateai/mcp_server/_shared.py +64 -0
  34. vmware_privateai-1.0.0/vmware_privateai/mcp_server/server.py +29 -0
  35. vmware_privateai-1.0.0/vmware_privateai/mcp_server/tools/__init__.py +1 -0
  36. vmware_privateai-1.0.0/vmware_privateai/mcp_server/tools/gpu.py +187 -0
  37. vmware_privateai-1.0.0/vmware_privateai/mcp_server/tools/pais.py +72 -0
  38. vmware_privateai-1.0.0/vmware_privateai/mcp_server/tools/vgpu_profiles.py +76 -0
  39. vmware_privateai-1.0.0/vmware_privateai/notify/__init__.py +1 -0
  40. vmware_privateai-1.0.0/vmware_privateai/notify/audit.py +53 -0
  41. vmware_privateai-1.0.0/vmware_privateai/ops/__init__.py +8 -0
  42. vmware_privateai-1.0.0/vmware_privateai/ops/_errors.py +19 -0
  43. vmware_privateai-1.0.0/vmware_privateai/ops/_paging.py +23 -0
  44. vmware_privateai-1.0.0/vmware_privateai/ops/_sanitize.py +27 -0
  45. vmware_privateai-1.0.0/vmware_privateai/ops/assign.py +152 -0
  46. vmware_privateai-1.0.0/vmware_privateai/ops/gpu.py +194 -0
  47. vmware_privateai-1.0.0/vmware_privateai/ops/pais.py +90 -0
  48. vmware_privateai-1.0.0/vmware_privateai/ops/utilization.py +141 -0
  49. vmware_privateai-1.0.0/vmware_privateai/ops/vgpu_profiles.py +154 -0
  50. vmware_privateai-1.0.0/vmware_privateai/pais/__init__.py +6 -0
  51. vmware_privateai-1.0.0/vmware_privateai/pais/client.py +89 -0
  52. vmware_privateai-1.0.0/vmware_privateai/pais/config.py +76 -0
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wei Zhou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: vmware-privateai
3
+ Version: 1.0.0
4
+ Summary: VMware Private AI Foundation with NVIDIA ops — GPU inventory, vGPU/DirectPath profiles, utilization, model-serving (MCP + CLI)
5
+ Author-email: Wei Zhou <wei-wz.zhou@broadcom.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: ai-ops,gpu,mcp,nvidia,private-ai,vcf,vgpu,vmware
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: System :: Systems Administration
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: httpx<1.0,>=0.27
15
+ Requires-Dist: mcp[cli]<2.0,>=1.10
16
+ Requires-Dist: python-dotenv<2.0,>=1.0
17
+ Requires-Dist: pyvmomi<10.0,>=8.0.3.0
18
+ Requires-Dist: pyyaml<7.0,>=6.0
19
+ Requires-Dist: rich<15.0,>=13.0
20
+ Requires-Dist: typer<1.0,>=0.12
21
+ Requires-Dist: vmware-policy<2.0,>=1.8.8
22
+ Description-Content-Type: text/markdown
23
+
24
+ <!-- mcp-name: io.github.vmware-skills/vmware-privateai -->
25
+
26
+ # VMware Private AI (Foundation with NVIDIA) — GPU & Model-Serving Ops
27
+
28
+ > **Disclaimer**: This is a community-maintained open-source project and is **not affiliated with,
29
+ > endorsed by, or sponsored by VMware, Inc., Broadcom Inc., or NVIDIA Corporation.** "VMware", "vSphere",
30
+ > and "VCF" are trademarks of Broadcom; "NVIDIA" is a trademark of NVIDIA. Source is auditable at
31
+ > [github.com/vmware-skills/VMware-PrivateAI](https://github.com/vmware-skills/VMware-PrivateAI) under the MIT license.
32
+
33
+ > **Status: pre-MVP skeleton (2026-08-06).** Skill #15 of the VMware family. Manages the **GPU / AI-infrastructure
34
+ > layer** of VMware Private AI Foundation with NVIDIA (PAIF-N) on vSphere 9.x / VCF 9.1 — GPU host/device
35
+ > inventory, vGPU & DirectPath profiles, GPU consumers and utilization, vGPU assignment, and Private AI
36
+ > Service (PAIS) model serving. Independent 1.x version line.
37
+
38
+ Companion of **vmware-aiops** (the vCenter VMs behind AI workloads), **vmware-vks** (GPU-enabled Kubernetes),
39
+ and **vmware-monitor** (read-only health). This skill is the GPU lens over all three.
40
+
41
+ Every API path is verified against official Broadcom/NVIDIA docs before use (see
42
+ `tests/eval/spec/privateai_endpoints.py`) — no endpoints written from memory.
@@ -0,0 +1,82 @@
1
+ <!-- mcp-name: io.github.vmware-skills/vmware-privateai -->
2
+
3
+ # VMware Private AI(Foundation with NVIDIA)—— GPU 与模型服务运维
4
+
5
+ VMware skill 家族的 **GPU / AI 基础设施** 视角 —— GPU 主机与设备清点、vGPU 消费者、实时 GPU 利用率、
6
+ vGPU / DirectPath 配置目录、vGPU 分配,以及 **Private AI Service(PAIS)** 的已服务模型与知识库,
7
+ 覆盖 **vSphere 9.x / VCF 9.1** Web Services API(pyVmomi)与 PAIS REST API。MCP server + CLI。
8
+
9
+ > **声明**:社区维护的开源项目,**与 VMware, Inc.、Broadcom Inc.、NVIDIA Corporation 无任何隶属、背书或
10
+ > 赞助关系。** "VMware"、"vSphere"、"VCF" 为 Broadcom 商标;"NVIDIA"、"vGPU" 为 NVIDIA 商标。源码遵循
11
+ > MIT 许可,公开可审计:[github.com/vmware-skills/VMware-PrivateAI](https://github.com/vmware-skills/VMware-PrivateAI)。
12
+
13
+ > **状态:v1.0.0(beta)。** 家族第 15 个 skill,走独立 1.x 版本线。每条 API 路径在使用前都对照官方
14
+ > Broadcom/NVIDIA 资料核实(见 `tests/eval/spec/privateai_endpoints.py`)——不凭记忆编写端点。GET 响应
15
+ > **字段名** 与 PAIS 的确切路径为防御式,待真机 9.x 硬件验证(见下方 beta 活口)。由家族 harness 治理
16
+ > (审计 + 策略 + 教学性错误);读写授权交由 vCenter 服务账号的 RBAC 角色。
17
+
18
+ ## 能力(10 工具:9 读 / 1 写)
19
+
20
+ | 类别 | 工具 | 读/写 |
21
+ |------|------|:----:|
22
+ | **GPU 清点** | 主机 列表/详情、设备列表、vGPU 消费者列表 | 4 读 |
23
+ | **GPU 利用率** | 每台 vGPU 虚机实时利用率(GPU %、显存 %、温度) | 1 读 |
24
+ | **配置目录** | vGPU 配置列表、DirectPath 配置列表 | 2 读 |
25
+ | **vGPU 分配** | 设置虚机 vGPU 配置(虚机须已关机) | 1 写 |
26
+ | **Private AI Service** | 已服务模型列表、知识库列表 | 2 读 |
27
+
28
+ 读操作严格无破坏性。唯一的写(`vgpu_assign`)会预览爆炸半径、拒绝已开机虚机、**绝不自行关机**、
29
+ CLI 双重确认、统一审计到 `~/.vmware/audit.db`。
30
+
31
+ ## 快速开始
32
+
33
+ ```bash
34
+ uv tool install vmware-privateai
35
+ vmware-privateai version
36
+ vmware-privateai gpu host-list # 第一条读命令 —— 列出有 GPU 的主机
37
+ ```
38
+
39
+ 配置位于 `~/.vmware-privateai/config.yaml`(targets + 可选 `pais:` 段);密码与 PAIS bearer token 存于
40
+ `~/.vmware-privateai/.env`(chmod 600)。详见 `skills/vmware-privateai/references/setup-guide.md`。
41
+
42
+ ## 典型工作流
43
+
44
+ **1. 找空闲 GPU 并给虚机换 vGPU 配置**
45
+ ```bash
46
+ vmware-privateai gpu device-list --vendor NVIDIA # vm_count 0 = 空闲
47
+ vmware-privateai gpu consumer-list # 谁持有 vGPU、什么配置
48
+ vmware-privateai vgpu profile-list --host esx-07 # 该主机可分配的配置
49
+ vmware-privateai gpu vgpu-assign fin-train-01 grid_a100-4c --dry-run # 预览
50
+ # 先用 vmware-aiops 关机,再:
51
+ vmware-privateai gpu vgpu-assign fin-train-01 grid_a100-4c # 双重确认 + 审计
52
+ ```
53
+ *失败分支*:提示 "VM is powered on" 时,先 `vmware-aiops vm_power_off 'fin-train-01'`;提示配置不被主机
54
+ 提供 / 显存不足时,`vmware-privateai gpu host-get <该主机>` 查看有效配置。
55
+
56
+ **2. 全域 GPU 利用率巡检**
57
+ ```bash
58
+ vmware-privateai gpu utilization --top 10
59
+ ```
60
+ *失败分支*:显示 `metrics unavailable` 不是错误 —— NVIDIA 主机 GPU 驱动未暴露该虚机的计数器。更深的
61
+ per-SM / MIG-slice 遥测 vSphere 不提供(需 NVIDIA DCGM)。
62
+
63
+ **3. 查看 PAIS 正在服务什么**
64
+ ```bash
65
+ vmware-privateai pais model-list
66
+ vmware-privateai pais kb-list
67
+ ```
68
+ *失败分支*:HTTP 404 通常是 base-URL 不匹配(`/api/v1` 前缀随部署而异、beta 未确认),查 `pais.endpoint`;
69
+ HTTP 401/403 表示 `VMWARE_PRIVATEAI_PAIS_TOKEN` 过期或缺权限,重新取 token。
70
+
71
+ ## Companion Skills
72
+ - [vmware-aiops](https://github.com/vmware-skills/VMware-AIops) —— AI 负载背后的 vCenter 虚机(开关机/快照/克隆/迁移)
73
+ - [vmware-vks](https://github.com/vmware-skills/VMware-VKS) —— GPU 使能的 Tanzu Kubernetes
74
+ - [vmware-monitor](https://github.com/vmware-skills/VMware-Monitor) —— 只读 vSphere 健康
75
+
76
+ ## 安全
77
+ 详见仓库根目录 `SECURITY.md`。要点:凭据仅存 `.env`(chmod 600、`b64:` 混淆);默认开启 TLS 校验;
78
+ 所有 vSphere/PAIS 文本经 `vmware_policy.sanitize()` 防注入;读写授权交由 vCenter RBAC;
79
+ `vgpu_assign` 关机门控 + 双重确认 + 审计。
80
+
81
+ ## License
82
+ MIT
@@ -0,0 +1,19 @@
1
+ <!-- mcp-name: io.github.vmware-skills/vmware-privateai -->
2
+
3
+ # VMware Private AI (Foundation with NVIDIA) — GPU & Model-Serving Ops
4
+
5
+ > **Disclaimer**: This is a community-maintained open-source project and is **not affiliated with,
6
+ > endorsed by, or sponsored by VMware, Inc., Broadcom Inc., or NVIDIA Corporation.** "VMware", "vSphere",
7
+ > and "VCF" are trademarks of Broadcom; "NVIDIA" is a trademark of NVIDIA. Source is auditable at
8
+ > [github.com/vmware-skills/VMware-PrivateAI](https://github.com/vmware-skills/VMware-PrivateAI) under the MIT license.
9
+
10
+ > **Status: pre-MVP skeleton (2026-08-06).** Skill #15 of the VMware family. Manages the **GPU / AI-infrastructure
11
+ > layer** of VMware Private AI Foundation with NVIDIA (PAIF-N) on vSphere 9.x / VCF 9.1 — GPU host/device
12
+ > inventory, vGPU & DirectPath profiles, GPU consumers and utilization, vGPU assignment, and Private AI
13
+ > Service (PAIS) model serving. Independent 1.x version line.
14
+
15
+ Companion of **vmware-aiops** (the vCenter VMs behind AI workloads), **vmware-vks** (GPU-enabled Kubernetes),
16
+ and **vmware-monitor** (read-only health). This skill is the GPU lens over all three.
17
+
18
+ Every API path is verified against official Broadcom/NVIDIA docs before use (see
19
+ `tests/eval/spec/privateai_endpoints.py`) — no endpoints written from memory.
@@ -0,0 +1,74 @@
1
+ # Release Notes — vmware-privateai
2
+
3
+ ## v1.0.0 (beta) — 2026-08-06
4
+
5
+ First release. Skill #15 of the VMware skill family; the **GPU / AI-infrastructure lens** for VMware
6
+ Private AI Foundation with NVIDIA (PAIF-N) on vSphere 9.x / VCF 9.1. Independent 1.x version line (a new
7
+ skill starts at its own 1.0.0, not the family 1.8.x).
8
+
9
+ ### MCP tools — 10 (9 read, 1 write)
10
+
11
+ GPU inventory (read):
12
+ - `gpu_host_list` — ESXi hosts that have at least one GPU (filter name / vendor).
13
+ - `gpu_host_get` — full per-GPU detail for one host (device, type, memory, consumers).
14
+ - `gpu_device_list` — flattened physical GPU devices across hosts (`vm_count 0` = idle).
15
+ - `gpu_consumer_list` — VMs consuming a vGPU and the profile each holds.
16
+
17
+ GPU utilization (read):
18
+ - `gpu_utilization` — real-time per-vGPU-VM utilization (gpu %, mem %, mem_used_kb, temp), busiest first.
19
+
20
+ Profile catalog (read):
21
+ - `vgpu_profile_list` — the vGPU profile catalog aggregated across hosts (framebuffer, class, sharing).
22
+ - `directpath_profile_list` — vCenter-level DirectPath (dynamic passthrough) profiles, vSphere 9.0+.
23
+
24
+ Private AI Service (read):
25
+ - `pais_model_list` — models served by PAIS (OpenAI-compatible `/models`).
26
+ - `pais_knowledge_base_list` — PAIS knowledge bases (RAG vector stores).
27
+
28
+ vGPU assignment (write):
29
+ - `vgpu_assign` — set/replace a VM's vGPU profile via ReconfigVM. Previews by default; requires the VM
30
+ powered off; never powers it off itself; double-confirmed at the CLI; audited.
31
+
32
+ A matching CLI ships for all ten (`gpu`, `vgpu`, `pais` command groups) plus `version` and `mcp`.
33
+
34
+ ### Governed-ops harness
35
+
36
+ - Every tool is wrapped by `vmware-policy`'s `@vmware_tool` (MCP) / `@guarded` (CLI write) — pre-checks,
37
+ policy engine, audit to `~/.vmware/audit.db`, teaching-error formatting.
38
+ - All vSphere- and PAIS-supplied text passes through `vmware_policy.sanitize()` (≤500-char truncation +
39
+ C0/C1 control-char stripping) before reaching the model.
40
+ - REST error translation is centralized in the PAIS client's `_request` (踩坑 #37); vSphere connection
41
+ errors become teaching `ConfigError` / `ConnectionError` messages, not tracebacks.
42
+ - Reads paginate at 50 with a `{items, returned, limit, offset, total, truncated, hint}` envelope
43
+ (empty items + `truncated:false` = checked-and-none, never read as "no problem").
44
+ - **Anti-phantom-endpoint gate**: every runtime pyVmomi path, perf counter, and PAIS REST path is pinned
45
+ in `tests/eval/spec/privateai_endpoints.py` and asserted by a regression test — no endpoint written
46
+ from model memory (踩坑 #36). MCP server lives under `vmware_privateai.mcp_server` (namespaced, never a
47
+ top-level `mcp_server` — 踩坑 #41); tool signatures use `Optional[X]`, not PEP 604 (踩坑 #33).
48
+
49
+ ### Beta activation caveats (honest, pending first real-hardware run)
50
+
51
+ This release is functionally complete and import-clean, with regression coverage over its error paths,
52
+ but has **not yet been exercised against live 9.x GPU hardware**. Before relying on it in production,
53
+ run the read tools once against a real target and confirm:
54
+
55
+ - **GET-response field names are INFERRED / defensive.** vGPU-profile, GPU-device, and consumer
56
+ projections read every field with `getattr` / `.get()` and degrade an absent field to empty rather than
57
+ crashing. A field that a live build names differently will surface as a blank column, not an error —
58
+ file an issue with the raw `gpu host-get` / `vgpu profile-list` output so the projection can be pinned.
59
+ - **PAIS exact paths are INFERRED_EXACT.** The `/api/v1` prefix and the JSON response shape are
60
+ corroborated by the rendered Broadcom developer portal, **not** by a downloaded OpenAPI JSON or a live
61
+ deployment. A 404 usually means a base-URL mismatch (check `pais.endpoint`), not a bug; the response
62
+ parser accepts both a bare array and a `{data|items|models|knowledge_bases|…}` envelope.
63
+ - **`gpu.*` perf counters may be host-level on some builds.** The four `gpu.*` counters are verified to
64
+ exist, but whether they report per-VM or per-host on a given ESXi build must be confirmed on real
65
+ hardware — verify the entity type before reading per-VM utilization as authoritative.
66
+ - **MIG has no vSphere API.** MIG mode set, GPU driver version, and deep per-SM / per-process / MIG-slice
67
+ telemetry are **not** available through vCenter (use `nvidia-smi` / NVIDIA DCGM on the host). The code
68
+ lists these under `NO_API` and deliberately invents no endpoint for them.
69
+
70
+ ### Security
71
+
72
+ - Passwords and the PAIS bearer token live only in `~/.vmware-privateai/.env` (chmod 600, `b64:`
73
+ obfuscated at rest). Read-vs-write authorization is delegated to the vCenter RBAC role.
74
+ - `bandit -r vmware_privateai/`: target 0 Medium+ issues. See `SECURITY.md`.
@@ -0,0 +1,75 @@
1
+ # Security Policy
2
+
3
+ ## Disclaimer
4
+ Community-maintained open-source project, **not affiliated with, endorsed by, or sponsored by VMware,
5
+ Inc., Broadcom Inc., or NVIDIA Corporation.** "VMware", "vSphere", and "VCF" are trademarks of Broadcom;
6
+ "NVIDIA" and "vGPU" are trademarks of NVIDIA Corporation.
7
+
8
+ ## Reporting Vulnerabilities
9
+ Please open a GitHub private security advisory at
10
+ https://github.com/vmware-skills/VMware-PrivateAI/security/advisories or email the maintainer. Do not
11
+ file public issues for security reports.
12
+
13
+ ## Security Design
14
+
15
+ ### Credential Management
16
+ - vCenter/ESXi passwords and the PAIS bearer token live only in `~/.vmware-privateai/.env` (chmod 600),
17
+ obfuscated to `b64:` at rest (obfuscation, not encryption; it defeats casual grep / shoulder-surfing,
18
+ not a determined reader). Config files hold host / username / port and the `pais.endpoint` only.
19
+ - Per-target env vars `VMWARE_PRIVATEAI_<TARGET>_PASSWORD` (and the `VMWARE_PRIVATEAI_PAIS_TOKEN` bearer
20
+ token) can be injected from a secret manager (Vault / CyberArk / AWS SM / Kubernetes Secret) instead
21
+ of `.env` — the code reads the environment either way.
22
+ - Username + password are resolved together on every call (both are lazily-read properties) so a
23
+ rotating credential sidecar never half-updates the pair.
24
+
25
+ ### Authorization — delegated to vCenter RBAC
26
+ The skill ships full read + one write and does not gate read-vs-write itself. Point a target at a
27
+ read-only vCenter service account and the single write (`vgpu_assign`'s `ReconfigVM_Task`) is refused at
28
+ vCenter, un-bypassably — the one place the control cannot be stepped around by a shell. Recommend a
29
+ dedicated service account scoped to the GPU clusters.
30
+
31
+ ### `vgpu_assign` write safety
32
+ `vgpu_assign` is the only state-changing tool. Its safety model:
33
+ - **Power-off gate.** A vGPU change requires the VM to be powered **off** (no hot-add, no vMotion for
34
+ passthrough — VERIFIED). `confirm=false` (the default) previews only — current profile, target
35
+ profile, power state, and `requires_power_off` — without acting. `confirm=true` applies it but refuses
36
+ a powered-on VM with a teaching error.
37
+ - **Never powers the VM off itself.** Powering the VM off is `vmware-aiops`'s job, kept separate so this
38
+ tool's blast radius stays "one VM, when it is already off". The refusal routes the operator to
39
+ `vmware-aiops vm_power_off`.
40
+ - **Edits only the existing vGPU device.** The reconfigure targets the VM's existing vGPU device
41
+ (selected by the same `backing.vgpu` predicate the preview uses), never a plain DirectPath / SR-IOV
42
+ `VirtualPCIPassthrough`, so it cannot silently convert a full-GPU passthrough into a vGPU device.
43
+ - **Honest outcome.** It waits for the real `ReconfigVM_Task` to finish and reports/audits the actual
44
+ result (a bad profile or insufficient framebuffer fails asynchronously) — never a premature "ok".
45
+ - **CLI double-confirm + `--dry-run`.** The CLI `gpu vgpu-assign` command requires two confirmations and
46
+ supports `--dry-run`.
47
+ - **Audited.** Every applied change (and every error) is recorded to `~/.vmware/audit.db` via the
48
+ `@vmware_tool` harness, and to the CLI companion `~/.vmware-privateai/audit.log`.
49
+
50
+ ### PAIS response sanitization
51
+ Private AI Service REST responses are the highest-value prompt-injection surface in this skill — a
52
+ knowledge-base description is operator/attacker-authored free text. All PAIS-supplied strings (model ids,
53
+ `owned_by`, KB id/name/status/description), and all vSphere-supplied strings (device / vendor / VM /
54
+ vGPU-profile names), pass through `vmware_policy.sanitize()` (≤500-char truncation + C0/C1 control-char
55
+ stripping) at projection time before they reach the model.
56
+
57
+ ### SSL/TLS Verification
58
+ On by default. `verify_ssl: false` (per vCenter/ESXi target) and `pais.verify_ssl: false` are intended
59
+ only for self-signed lab certificates. The PAIS client centralizes all HTTP / transport error
60
+ translation in one place (`_request`) so a bad token or 404 surfaces a teaching message, not a raw
61
+ traceback (踩坑 #37).
62
+
63
+ ### Transitive Dependencies
64
+ Runtime deps: pyvmomi, httpx, typer, rich, pyyaml, python-dotenv, mcp, and `vmware-policy` (the family's
65
+ shared audit/policy/sanitize harness). No urllib3, no requests.
66
+
67
+ ## Static Analysis
68
+ ```bash
69
+ uvx bandit -r vmware_privateai/ # target: 0 Medium+ issues
70
+ ```
71
+
72
+ ## Supported Versions
73
+ | Version | Supported |
74
+ |---------|-----------|
75
+ | 1.0.x | ✅ (beta) |
@@ -0,0 +1,64 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vmware-privateai"
7
+ version = "1.0.0"
8
+ description = "VMware Private AI Foundation with NVIDIA ops — GPU inventory, vGPU/DirectPath profiles, utilization, model-serving (MCP + CLI)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "Wei Zhou", email = "wei-wz.zhou@broadcom.com" }]
13
+ keywords = ["vmware", "vcf", "gpu", "nvidia", "vgpu", "private-ai", "mcp", "ai-ops"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: System :: Systems Administration",
19
+ ]
20
+ dependencies = [
21
+ "pyvmomi>=8.0.3.0,<10.0",
22
+ "httpx>=0.27,<1.0",
23
+ "typer>=0.12,<1.0",
24
+ "rich>=13.0,<15.0",
25
+ "pyyaml>=6.0,<7.0",
26
+ "python-dotenv>=1.0,<2.0",
27
+ "mcp[cli]>=1.10,<2.0",
28
+ "vmware-policy>=1.8.8,<2.0",
29
+ ]
30
+
31
+ [project.scripts]
32
+ vmware-privateai = "vmware_privateai.cli:app"
33
+ vmware-privateai-mcp = "vmware_privateai.mcp_server.server:main"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["vmware_privateai"]
37
+
38
+ [tool.pytest.ini_options]
39
+ testpaths = ["tests"]
40
+ markers = [
41
+ "capability: Capability evals — scored trends, not pass/fail gates. Excluded from the default run. Run with: pytest -m capability",
42
+ ]
43
+ addopts = "-m 'not capability'"
44
+
45
+ [dependency-groups]
46
+ dev = [
47
+ "pytest>=8.0,<10.0",
48
+ "pytest-cov>=5.0,<8.0",
49
+ "ruff>=0.5,<1.0",
50
+ ]
51
+
52
+ [tool.ruff]
53
+ line-length = 120
54
+ target-version = "py311"
55
+
56
+ [tool.ruff.lint]
57
+ select = ["E", "F", "I", "N", "W", "UP"]
58
+
59
+ [tool.ruff.lint.per-file-ignores]
60
+ # 踩坑 #33: MCP-server modules are reflected by FastMCP/Pydantic at import time.
61
+ # Tool-signature annotations must stay `Optional[X]` — the PEP 604 `X | None` form
62
+ # can raise `subclass() arg 1 must be a class` under older interpreters. Never let
63
+ # pyupgrade (UP007/UP045) rewrite them in the reflected files.
64
+ "vmware_privateai/mcp_server/**/*.py" = ["UP007", "UP045"]
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.vmware-skills/vmware-privateai",
4
+ "title": "VMware Private AI (GPU & Model Serving)",
5
+ "description": "VMware Private AI Foundation with NVIDIA ops: GPU inventory, vGPU/DirectPath profiles, utilization, vGPU assignment, PAIS model serving — 10 MCP tools.",
6
+ "repository": {
7
+ "url": "https://github.com/vmware-skills/VMware-PrivateAI",
8
+ "source": "github"
9
+ },
10
+ "version": "1.0.0",
11
+ "packages": [
12
+ {
13
+ "registryType": "pypi",
14
+ "identifier": "vmware-privateai",
15
+ "version": "1.0.0",
16
+ "transport": {
17
+ "type": "stdio"
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: vmware-privateai
3
+ description: >
4
+ Use this skill whenever the user needs the GPU / AI-infrastructure layer of VMware Private AI
5
+ Foundation with NVIDIA (PAIF-N) on vSphere 9.x / VCF 9.1: inventory GPU hosts and physical GPU
6
+ devices, see which VMs consume a vGPU and the profile each holds, read real-time GPU utilization,
7
+ list the vGPU and DirectPath profile catalog, assign a VM's vGPU profile, and list Private AI
8
+ Service (PAIS) served models and knowledge bases. Always use this skill for "list GPU hosts",
9
+ "which VMs are using a vGPU", "GPU utilization", "assign a vGPU profile", "list vGPU profiles",
10
+ "list served models" when the context is explicitly VMware / vSphere / VCF Private AI / NVIDIA
11
+ vGPU. Do NOT use for the backing VM's power/snapshot/clone/migrate (use vmware-aiops), read-only
12
+ vSphere inventory/alarms/host health (use vmware-monitor), or GPU-enabled Tanzu Kubernetes
13
+ (use vmware-vks). This skill is the GPU lens; vmware-aiops owns the VM lifecycle behind it.
14
+ installer:
15
+ kind: uv
16
+ package: vmware-privateai
17
+ allowed-tools:
18
+ - Bash
19
+ metadata: {"openclaw":{"requires":{"env":["VMWARE_PRIVATEAI_CONFIG"],"bins":["vmware-privateai"],"config":["~/.vmware-privateai/config.yaml"]},"primaryEnv":"VMWARE_PRIVATEAI_CONFIG"}}
20
+ ---
21
+
22
+ # VMware Private AI (Foundation with NVIDIA) — GPU & Model-Serving Ops
23
+
24
+ > **Disclaimer**: Community-maintained open-source project, **not affiliated with, endorsed by, or
25
+ > sponsored by VMware, Inc., Broadcom Inc., or NVIDIA Corporation.** "VMware", "vSphere", and "VCF"
26
+ > are trademarks of Broadcom; "NVIDIA" and "vGPU" are trademarks of NVIDIA. Source is publicly
27
+ > auditable under the MIT license.
28
+
29
+ The GPU / AI-infrastructure lens for the VMware skill family — GPU host & device inventory, vGPU
30
+ consumers, real-time GPU utilization, the vGPU / DirectPath profile catalog, vGPU assignment, and
31
+ **Private AI Service (PAIS)** served models and knowledge bases — over the **vSphere 9.x / VCF 9.1**
32
+ Web Services API (pyVmomi) plus the PAIS REST API.
33
+
34
+ > **Companion skills**: [vmware-aiops](https://github.com/vmware-skills/VMware-AIops) (the vCenter VMs
35
+ > behind AI workloads — power/snapshot/clone), [vmware-vks](https://github.com/vmware-skills/VMware-VKS)
36
+ > (GPU-enabled Tanzu Kubernetes), [vmware-monitor](https://github.com/vmware-skills/VMware-Monitor)
37
+ > (read-only vSphere health).
38
+
39
+ > **Status: v1.0.0 (beta).** Skill #15 of the family; independent 1.x version line. Every API path is
40
+ > verified against official Broadcom/NVIDIA sources before use (`tests/eval/spec/privateai_endpoints.py`)
41
+ > — no endpoints written from memory. GET-response *field names* and the exact PAIS paths are
42
+ > defensive and pending validation against live 9.x hardware (see Troubleshooting). Governed by the
43
+ > family harness (audit + policy + teaching errors); read-vs-write authorization is delegated to the
44
+ > vCenter service account's RBAC role.
45
+
46
+ ## What This Skill Does
47
+
48
+ | Category | Tools | Count | Read/Write |
49
+ |----------|-------|:-----:|:----------:|
50
+ | **GPU inventory** | host list/get, device list, vGPU consumer list | 4 | 4 R |
51
+ | **GPU utilization** | real-time per-vGPU-VM utilization (gpu %, mem %, temp) | 1 | 1 R |
52
+ | **Profile catalog** | vGPU profile list, DirectPath profile list | 2 | 2 R |
53
+ | **vGPU assignment** | set a VM's vGPU profile (VM must be powered off) | 1 | 1 W |
54
+ | **Private AI Service** | served-model list, knowledge-base list | 2 | 2 R |
55
+
56
+ **10 MCP tools (9 read / 1 write).** Reads are strictly non-destructive. The single write
57
+ (`vgpu_assign`) previews its blast radius, refuses a powered-on VM, never powers a VM off itself, is
58
+ double-confirmed at the CLI, and is audit-logged.
59
+
60
+ ## Quick Install
61
+
62
+ ```bash
63
+ uv tool install vmware-privateai
64
+ vmware-privateai version
65
+ vmware-privateai gpu host-list # first read — lists hosts that have a GPU
66
+ ```
67
+
68
+ Config lives in `~/.vmware-privateai/config.yaml` (targets + optional `pais:` section); passwords and
69
+ the PAIS bearer token live in `~/.vmware-privateai/.env` (chmod 600). See `references/setup-guide.md`.
70
+
71
+ ## When to Use This Skill
72
+
73
+ Use vmware-privateai for the **GPU / AI-infrastructure layer**: which hosts and physical devices have
74
+ GPUs, which VMs hold a vGPU and what profile, real-time GPU utilization, the assignable vGPU /
75
+ DirectPath profile catalog, changing a VM's vGPU profile, and the models / knowledge bases served by
76
+ Private AI Service — when the context is explicitly VMware / vSphere / VCF Private AI / NVIDIA vGPU.
77
+
78
+ **Do NOT use when**: the task is the backing VM's lifecycle — power on/off, snapshot, clone, migrate,
79
+ reconfigure CPU/RAM (→ **vmware-aiops**); read-only vSphere inventory, alarms, or host health
80
+ (→ **vmware-monitor**); or GPU-enabled Tanzu Kubernetes / Supervisor namespaces (→ **vmware-vks**).
81
+ `vgpu_assign` deliberately does **not** power the VM off — that is vmware-aiops's job, kept separate
82
+ so this skill's blast radius stays "one VM, when it is already off".
83
+
84
+ ## Related Skills — Skill Routing
85
+
86
+ | The user wants… | Skill |
87
+ |-----------------|-------|
88
+ | Inventory GPUs / vGPU consumers / GPU utilization / assign a vGPU profile | **vmware-privateai** (this) |
89
+ | List PAIS served models / knowledge bases | **vmware-privateai** (this) |
90
+ | Power off / snapshot / clone / migrate the backing vCenter VM | vmware-aiops |
91
+ | Read-only vSphere inventory / alarms / host health | vmware-monitor |
92
+ | GPU-enabled Tanzu Kubernetes clusters / namespaces | vmware-vks |
93
+ | Multi-step GPU workflow with approval + rollback | vmware-pilot |
94
+
95
+ ## Common Workflows
96
+
97
+ **1. Find an idle GPU and reassign a VM's vGPU profile.**
98
+ ```
99
+ vmware-privateai gpu device-list --vendor NVIDIA # find GPUs; vm_count 0 = idle
100
+ vmware-privateai gpu consumer-list # who holds a vGPU, and which profile
101
+ vmware-privateai vgpu profile-list --host esx-07 # profiles that host can hand a VM
102
+ vmware-privateai gpu vgpu-assign fin-train-01 grid_a100-4c --dry-run # preview blast radius
103
+ # power the VM off with vmware-aiops, THEN:
104
+ vmware-privateai gpu vgpu-assign fin-train-01 grid_a100-4c # double-confirm + audit
105
+ ```
106
+ *Failure branch*: if `vgpu-assign` (confirm) refuses with "VM is powered on — a vGPU change needs the
107
+ VM powered off", run `vmware-aiops vm_power_off 'fin-train-01'` first, then re-run. If it fails with
108
+ "profile not offered by the VM's host / GPU lacks free framebuffer", run
109
+ `vmware-privateai gpu host-get <that VM's host>` to see the valid profiles and free capacity.
110
+
111
+ **2. Triage GPU utilization across the estate.**
112
+ ```
113
+ vmware-privateai gpu utilization --top 10 # busiest vGPU VMs first
114
+ vmware-privateai gpu host-list --vendor NVIDIA # which hosts carry the load
115
+ ```
116
+ *Failure branch*: a VM showing `metrics unavailable (no host driver?)` is not an error — the NVIDIA
117
+ host GPU driver is not exposing counters for it (`metrics_available:false`). Deep per-SM / per-process
118
+ / MIG-slice telemetry is **not** available via vSphere; use NVIDIA DCGM on the host for that.
119
+
120
+ **3. See what Private AI Service is serving.**
121
+ ```
122
+ vmware-privateai pais model-list # OpenAI-compatible /models
123
+ vmware-privateai pais kb-list # RAG knowledge bases
124
+ ```
125
+ *Failure branch*: HTTP 404 usually means a base-URL mismatch, not a bug — the `/api/v1` PAIS path
126
+ prefix is deployment-specific and unconfirmed (beta). Check `pais.endpoint` in config.yaml. HTTP
127
+ 401/403 means the bearer token in `VMWARE_PRIVATEAI_PAIS_TOKEN` is expired or lacks scope — obtain a
128
+ fresh token from your Identity Provider, re-export it, and retry.
129
+
130
+ ## Usage Mode
131
+
132
+ - **CLI** — interactive inventory / triage, scripting, small or local models (lower context cost).
133
+ - **MCP** — agent-driven operations with structured JSON; run `vmware-privateai mcp` (an installed
134
+ console script, so no `uvx` network re-resolve — works through enterprise TLS proxies, 踩坑 #25).
135
+
136
+ ## MCP Tools (10 — 9 read, 1 write)
137
+
138
+ | Category | Tools | R/W |
139
+ |----------|-------|:---:|
140
+ | GPU inventory | `gpu_host_list`, `gpu_host_get`, `gpu_device_list`, `gpu_consumer_list` | Read |
141
+ | GPU utilization | `gpu_utilization` | Read |
142
+ | Profile catalog | `vgpu_profile_list`, `directpath_profile_list` | Read |
143
+ | Private AI Service | `pais_model_list`, `pais_knowledge_base_list` | Read |
144
+ | vGPU assignment | `vgpu_assign` | Write |
145
+
146
+ **List envelope**: every `*_list` tool returns `{items, returned, limit, offset, total, truncated, hint}`
147
+ — read rows from `items` and check `truncated` before concluding a listing is complete; empty `items`
148
+ with `truncated:false` means checked-and-none, not a failure. Lists paginate at `limit=50`; filter with
149
+ the tool's `name`/`vendor`/`host`/`profile`/`vm` arguments rather than paging the whole estate.
150
+
151
+ **Write safety (normative)**: `vgpu_assign` with `confirm=false` (the default) previews only —
152
+ current profile, target profile, power state, and that a power-off is required — without acting.
153
+ `confirm=true` applies it, but refuses a powered-on VM with a teaching error. It **never powers the VM
154
+ off itself**, waits for the real ReconfigVM task outcome (never a premature "ok"), and audits every
155
+ applied change to `~/.vmware/audit.db`.
156
+
157
+ ## CLI Quick Reference
158
+
159
+ ```bash
160
+ vmware-privateai gpu host-list [--name N] [--vendor V] # hosts with a GPU
161
+ vmware-privateai gpu host-get <host> # full per-GPU detail
162
+ vmware-privateai gpu device-list [--host H] [--vendor V] # physical GPUs (vm_count 0 = idle)
163
+ vmware-privateai gpu consumer-list [--profile P] [--vm V] # VMs holding a vGPU + profile
164
+ vmware-privateai gpu utilization [--vm V] [--top N] # real-time GPU %, mem %, temp
165
+ vmware-privateai gpu vgpu-assign <vm> <profile> [--dry-run] # WRITE — VM must be off; double-confirm
166
+ vmware-privateai vgpu profile-list [--host H] [--model M] # vGPU profile catalog
167
+ vmware-privateai vgpu directpath-list [--vendor V] # DirectPath profiles (vSphere 9.0+)
168
+ vmware-privateai pais model-list [--name N] # PAIS served models
169
+ vmware-privateai pais kb-list [--name N] # PAIS knowledge bases
170
+ ```
171
+ Full list: `references/cli-reference.md`. Per-tool response-token estimates: `references/capabilities.md`.
172
+
173
+ ## Troubleshooting
174
+
175
+ - **`Password not found for target '<t>'. Set environment variable VMWARE_PRIVATEAI_<T>_PASSWORD`** —
176
+ add that line to `~/.vmware-privateai/.env` and `chmod 600` it, or export it (from a secret manager).
177
+ The `<T>` is the target name upper-cased with `-`→`_`.
178
+ - **`TLS verification failed for target '<t>'`** — for a self-signed lab set `verify_ssl: false` for
179
+ that target in `config.yaml`; otherwise install the vCenter CA on this host.
180
+ - **`gpu host-list` returns nothing on a cluster you know has GPUs** — only `shared` / `direct` /
181
+ `sharedDirect` graphics types count as compute GPUs (the plain host framebuffer is excluded). If real
182
+ 9.x hardware surfaces a GPU under an unexpected type, that is a beta known-limitation — file an issue
183
+ with the raw `gpu host-get` output so the projection can be widened.
184
+ - **`gpu utilization` shows a VM with `metrics unavailable`** — the NVIDIA host GPU driver is not
185
+ exposing counters for it (not an error). Note the `gpu.*` perf counters may report at host level on
186
+ some builds — verify the entity type on real hardware (beta caveat).
187
+ - **`directpath-list` errors with "needs vCenter 9.0+"** — DirectPathProfileManager is new in vSphere
188
+ 9.0; on 8.x use `vgpu profile-list` instead (the error routes you there, not an empty list).
189
+ - **PAIS 404 / non-JSON response** — the `/api/v1` prefix is deployment-specific and unconfirmed;
190
+ check `pais.endpoint` (a proxy or login page returns non-JSON). PAIS 401/403 → refresh the bearer
191
+ token in `VMWARE_PRIVATEAI_PAIS_TOKEN`.
192
+
193
+ ## Audit & Safety
194
+
195
+ 1. **Source Code** — https://github.com/vmware-skills/VMware-PrivateAI (MIT).
196
+ 2. **Config File Contents** — `config.yaml` holds target host/username/port and the `pais.endpoint`
197
+ only; passwords and the PAIS bearer token live in `~/.vmware-privateai/.env` (0600, obfuscated to
198
+ `b64:` at rest — obfuscation, not encryption).
199
+ 3. **Webhook Data Scope** — none. This skill makes no outbound calls except to the configured
200
+ vCenter/ESXi targets and PAIS endpoint.
201
+ 4. **TLS Verification** — on by default; `verify_ssl: false` is per-target (and `pais.verify_ssl`) and
202
+ only for self-signed labs.
203
+ 5. **Prompt Injection Protection** — all vSphere-supplied and PAIS-supplied text (device/vendor/VM/
204
+ profile names, PAIS model ids, knowledge-base descriptions) passes through `vmware_policy.sanitize()`
205
+ (truncation ≤500 chars + C0/C1 control-char stripping); a KB description is the highest-value
206
+ injection surface here.
207
+ 6. **Least Privilege** — read-vs-write authorization is the vCenter role's job: a read-only service
208
+ account refuses `vgpu_assign`'s ReconfigVM at vCenter, un-bypassably. All writes are recorded in
209
+ `~/.vmware/audit.db`. See `references/setup-guide.md`.
210
+
211
+ ## License
212
+
213
+ MIT