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.1 KiB
3.1 KiB
Language / Язык: English | Русский
Virtual machines
Full REST lifecycle for VirtualMachine objects:
app/vsphere/rest/router.py,
vm_ext.py,
app/vsphere/domain/vm_ops.py.
Endpoints
| Method | Path | Notes |
|---|---|---|
| GET | /api/vcenter/vm |
List with names/power_states/hosts/folders/datacenters/clusters/resource_pools/limit/cursor filters |
| GET/DELETE | /api/vcenter/vm/{vm} |
Get / delete (must be 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 — returns { "task": "task-…" } |
| GET | /api/vcenter/vm/{vm}/hardware |
Summary |
| GET/PATCH | /api/vcenter/vm/{vm}/hardware/cpu | /memory |
Change CPU count / memory (privilege-gated) |
| GET/POST | /api/vcenter/vm/{vm}/hardware/disk | /ethernet |
Add 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 |
Task-returning |
| GET/POST | /api/vcenter/vm/{vm}/tools |
Guest tools status / upgrade |
| GET | /api/vcenter/vm/{vm}/guest/identity | /networking |
Guest OS name, synthetic IP |
| GET/POST | /api/vcenter/vm/{vm}/guest/power |
Guest-level power ops |
| POST | /api/vcenter/vm/{vm}/guest/customization |
Sysprep/cloud-init-style customization spec |
| POST | /api/vcenter/vm/{vm}/console/tickets |
Console (VNC/WebMKS-style) ticket |
| GET/PUT/DELETE | /api/vcenter/vm/{vm}/guest/filesystem |
Lab virtual guest filesystem (Ansible/Terraform write-a-file flows) |
| GET | /api/vcenter/vm/{vm}/guest/filesystem/files | /guest/local-filesystem |
Listing |
Highlights
- Every VM row carries a realistic device shape:
nics,disks,cdroms,floppies,serials,scsi_adapters,boot/boot_devices,identity(instance_uuid,bios_uuid), and a syntheticguest_ip/guest_filesystemsmap — the same fields power both the REST hardware endpoints and SOAPVirtualMachineConfigInfo. - Create requires
VirtualMachine.Inventory.Create; delete requiresVirtualMachine.Inventory.Deleteand the VM must bePOWERED_OFF. - Power/clone/snapshot/relocate/customize all create a durable CIS task (see Tasks) rather than mutating synchronously in the response body.
- Console tickets from
/api/vcenter/vm/{vm}/console/ticketspersist invsphere_console_tickets(migration013). - MOIDs follow the
vm-{100+n}convention seeded byapp/vsphere/profiles.py.
See Storage for datastore/disk-file semantics and
SOAP / VIM for the equivalent CreateVM_Task/PowerOnVM_Task/…
operations used by pyvmomi, govmomi, Terraform, and Pulumi.