Files
inecs f8d3cbdd59 Initial commit: VMware vSphere API simulator scaffold.
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API
contracts, docs, client examples, and the unit/integration/compatibility
test suite for local client and tooling labs without a real vCenter.
2026-07-18 04:42:11 +03:00

2.7 KiB

Language / Язык: English | Русский

Inventory

Listing + CRUD для datacenter, cluster, folder, resource pool, host и datastore/network: app/vsphere/rest/router.py, app/vsphere/domain/inventory_ops.py.

Эндпоинты

Метод Путь Заметки
GET /api/vcenter/datacenter Список
POST/DELETE /api/vcenter/datacenter[/{datacenter}] Create засевает подпапки host/vm/datastore/network
GET /api/vcenter/cluster Список
POST/DELETE /api/vcenter/cluster[/{cluster}] Create засевает ResourcePool
GET /api/vcenter/folder Список; GET /api/vcenter/folder/{folder}/children
POST/DELETE /api/vcenter/folder[/{folder}]
GET /api/vcenter/resource-pool Список
POST/DELETE /api/vcenter/resource-pool[/{resource_pool}]
GET /api/vcenter/host[/{host}] Connection state, CPU/memory, IP, storage devices, networking
POST /api/vcenter/host/{host}/maintenance Переключение maintenance mode
GET /api/vcenter/datastore[/{datastore}] Type, capacity, free space, accessibility
GET /api/vcenter/network Standard networks + distributed portgroups

Legacy /rest/vcenter/* зеркалит большинство GET-путей с конвертом { "value": … } — см. Поверхность API.

Основные моменты

  • Каждый объект inventory — строка в vsphere_objects (MOID, type, name, parent_moid, props JSONB) — см. app/vsphere/inventory.py.
  • Конвенции MOID следуют формам реального vCenter: datacenter-NN, domain-cNN (cluster), resgroup-NN (resource pool), group-vNN/group-hNN/ group-sNN/group-nNN (папки VM/host/datastore/network), host-NN, datastore-NN, network-NN / dvportgroup-NN.
  • list_hosts/list_clusters/и т.п. фильтруют живое состояние PostgreSQL; отдельного кэша для инвалидации после мутации нет.
  • Список VM (GET /api/vcenter/vm) поддерживает фильтры: names, power_states, hosts, folders, datacenters, clusters, resource_pools, плюс пагинацию limit/cursor.

Форма топологии по умолчанию — Профили seed; операции по VM — Виртуальные машины.