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.3 KiB
Raw Permalink Blame History

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

Content library

Локальные content libraries, library items, upload/download sessions и OVF deploy: app/vsphere/rest/content_rest.py, nfc_rest.py, app/vsphere/domain/content.py.

Эндпоинты

Метод Путь Заметки
GET /api/content/library Список library ids
POST /api/content/local-library Создать local library
GET/POST /api/content/library/item Список / create items (?library_id=)
POST /api/vcenter/ovf/library-item/{item_id} Deploy OVF item → новая VirtualMachine + task
POST /api/content/library/item/update-session[/{session_id}[/file]] Поток push-upload (стиль Ansible/Terraform)
GET/POST /api/content/library/item/download-session[/{session_id}[/file]] Поток pull-download
GET/PUT/POST /nfc/{lease} | /nfc/{lease}/files/{filename} | /nfc/{lease}/complete Эндпоинты transfer в стиле HttpNfcLease для SOAP import path

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

  • Libraries/items живут в vsphere_libraries / vsphere_library_items; seed создаёт две libraries («Local Content», «Published Templates») с OVF-typed items (ubuntu-22.04, centos-stream-9, golden-image).
  • Update/download sessions живут в PostgreSQL (vsphere_transfer_sessions, миграция 012) и моделируют handshake передачи файлов — не реальное byte-for-byte хранилище OVF/VMDK. Строки HttpNfcLease — в vsphere_nfc_leases.
  • deploy_ovf_from_library создаёт реальную строку VirtualMachine и возвращает task id, зеркаля SOAP-поток ImportVApp_Task / CreateImportSpec + HttpNfcLease*, используемый govc-style ovf.import.
  • Для create нужны ContentLibrary.CreateLocalLibrary / .AddLibraryItem, для deploy — VirtualMachine.Provisioning.DeployTemplate.

Операции HttpNfcLease progress/complete/abort для upload-heavy клиентов — SOAP / VIM.