f8d3cbdd59
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.
3.5 KiB
3.5 KiB
Language / Язык: English | Русский
Виртуальные машины
Полный REST lifecycle для объектов VirtualMachine:
app/vsphere/rest/router.py,
vm_ext.py,
app/vsphere/domain/vm_ops.py.
Эндпоинты
| Метод | Путь | Заметки |
|---|---|---|
| GET | /api/vcenter/vm |
Список с фильтрами names/power_states/hosts/folders/datacenters/clusters/resource_pools/limit/cursor |
| GET/DELETE | /api/vcenter/vm/{vm} |
Get / delete (должна быть powered off) |
| POST | /api/vcenter/vm |
Create — placement.{folder,host,datastore,resource_pool}, cpu.count, memory.size_MiB, disks, nics |
| GET/POST | /api/vcenter/vm/{vm}/power |
Get power state / ?action=start|stop|suspend|reset — возвращает { "task": "task-…" } |
| GET | /api/vcenter/vm/{vm}/hardware |
Сводка |
| GET/PATCH | /api/vcenter/vm/{vm}/hardware/cpu | /memory |
Смена CPU count / memory (privilege-gated) |
| GET/POST | /api/vcenter/vm/{vm}/hardware/disk | /ethernet |
Добавить disk / NIC |
| GET | /api/vcenter/vm/{vm}/hardware/boot |
Boot type/order |
| GET/POST/DELETE | /api/vcenter/vm/{vm}/snapshots[/{snapshot}] |
Create, revert (?action=revert), delete |
| POST | /api/vcenter/vm/{vm}/clone | /relocate |
Возвращают задачу |
| GET/POST | /api/vcenter/vm/{vm}/tools |
Статус guest tools / upgrade |
| GET | /api/vcenter/vm/{vm}/guest/identity | /networking |
Имя guest OS, синтетический IP |
| GET/POST | /api/vcenter/vm/{vm}/guest/power |
Guest-level power ops |
| POST | /api/vcenter/vm/{vm}/guest/customization |
Спека customization в стиле sysprep/cloud-init |
| POST | /api/vcenter/vm/{vm}/console/tickets |
Console-тикет (стиль VNC/WebMKS) |
| GET/PUT/DELETE | /api/vcenter/vm/{vm}/guest/filesystem |
Lab virtual guest filesystem (потоки write-a-file Ansible/Terraform) |
| GET | /api/vcenter/vm/{vm}/guest/filesystem/files | /guest/local-filesystem |
Listing |
Основные моменты
- У каждой строки VM реалистичная форма устройств:
nics,disks,cdroms,floppies,serials,scsi_adapters,boot/boot_devices,identity(instance_uuid,bios_uuid) и синтетическая картаguest_ip/guest_filesystems— те же поля питают и REST hardware-эндпоинты, и SOAPVirtualMachineConfigInfo. - Create требует
VirtualMachine.Inventory.Create; delete требуетVirtualMachine.Inventory.Deleteи VM должна бытьPOWERED_OFF. - Power/clone/snapshot/relocate/customize создают устойчивую CIS-задачу (см. Tasks), а не мутируют синхронно в теле ответа.
- Console tickets из
/api/vcenter/vm/{vm}/console/ticketsживут вvsphere_console_tickets(миграция013). - MOID следуют конвенции
vm-{100+n}, засеваемойapp/vsphere/profiles.py.
Семантика datastore/disk-file — Storage; эквивалентные
операции CreateVM_Task/PowerOnVM_Task/… для pyvmomi, govmomi, Terraform и
Pulumi — SOAP / VIM.