This commit is contained in:
2026-06-25 18:34:45 -05:00
parent da16e5ff56
commit 552b86c323
12 changed files with 439 additions and 125 deletions

View File

@@ -509,8 +509,8 @@ Payload:
| `POST` | `/api/hosts` | User | Create host. |
| `GET` | `/api/hosts/import/vcenter/status` | User | Return legacy effective vCenter status plus visible saved VMware connection records. |
| `GET` | `/api/hosts/import/vcenter/connections` | User | List visible saved VMware connections. |
| `POST` | `/api/hosts/import/vcenter/connections` | User | Create an encrypted VMware connection record. Use `targetType: "vcenter"` for vCenter inventory or `targetType: "host"` for standalone ESXi Web Services inventory. |
| `PUT` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Update a visible VMware connection; omit password to keep the existing secret. |
| `POST` | `/api/hosts/import/vcenter/connections` | User | Create a VMware connection record using a Credential Vault `credentialId`. Use `targetType: "vcenter"` for vCenter inventory or `targetType: "host"` for standalone ESXi Web Services inventory. |
| `PUT` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Update a visible VMware connection and its selected vault credential. |
| `DELETE` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Delete a visible VMware connection. |
| `POST` | `/api/hosts/import/vcenter/connections/:connectionId/test` | User | Verify a VMware connection. vCenter records authenticate and list VM summaries; standalone ESXi records authenticate to `/sdk` and query VM inventory through the vSphere Web Services API. |
| `POST` | `/api/hosts/import/vcenter/preview` | User | Authenticate to vCenter, search VM inventory, and return import candidates. |
@@ -612,8 +612,7 @@ Create/update a saved vCenter inventory system:
"name": "Production vCenter",
"targetType": "vcenter",
"baseUrl": "https://vcenter.contoso.local",
"username": "administrator@vsphere.local",
"password": "stored-encrypted-on-save",
"credentialId": "cred_vmware_api",
"apiMode": "auto",
"requestTimeoutMs": 20000,
"allowUntrustedTls": false,
@@ -630,8 +629,7 @@ Create/update a saved standalone ESXi host connection:
"name": "Standalone ESXi 01",
"targetType": "host",
"baseUrl": "https://esxi01.contoso.local",
"username": "root",
"password": "stored-encrypted-on-save",
"credentialId": "cred_esxi_api",
"apiMode": "web-services",
"requestTimeoutMs": 20000,
"allowUntrustedTls": true,
@@ -641,13 +639,21 @@ Create/update a saved standalone ESXi host connection:
}
```
Saved VMware passwords are encrypted with the same credential-store key used
by the Credential Vault. `targetType: "vcenter"` records use the vSphere
VMware connection records reference a Credential Vault username/password entry
through `credentialId`; operators create and rotate the actual VMware API
username/password in Credential Vault, then select it in Config / VMware.
Existing legacy connection records with an embedded encrypted VMware password
continue to resolve for compatibility, but new records should use the vault.
`targetType: "vcenter"` records use the vSphere
Automation API or legacy REST API for inventory and VM power-state checks.
`targetType: "host"` records are standalone host connections that use the
vSphere Web Services SOAP endpoint at `/sdk`; they validate direct ESXi
connectivity and enumerate VM inventory directly from the selected ESXi host in
the VMware import wizard. Existing
the VMware import wizard. The saved URL can be the host root
(`https://esxi01.contoso.local`), `/sdk`, or `/sdk/vimService.wsdl`; POSHManager
normalizes those forms, probes `/sdk/vimService.wsdl` for diagnostics, and
retries SOAP POSTs across `/sdk`, `/sdk/`, and `/sdk/vimService` when ESXi or a
reverse proxy maps one path differently. Existing
`vcenter_*` settings and `VCENTER_*` environment variables remain supported as
the `Configured default` import connection for single-vCenter deployments or
Docker-provided configuration.
@@ -658,10 +664,12 @@ When the import wizard selects a standalone ESXi connection (`targetType:
"host"`), preview uses the vSphere Web Services API sequence
`RetrieveServiceContent`, `Login`, `CreateContainerView`, and
`RetrievePropertiesEx` against `/sdk` to enumerate `VirtualMachine` managed
objects. Filter fields work the same as vCenter imports. Imported hosts store
the selected ESXi connection plus the VM managed-object reference in
`sourceRef`, so script tests and RunPlans can run a direct ESXi power-state
check before spawning PowerShell.
objects. The API trace includes the WSDL probe, endpoint attempt count, redacted
SOAP session cookies, and low-level network/TLS causes when Node reports a
generic `fetch failed`. Filter fields work the same as vCenter imports.
Imported hosts store the selected ESXi connection plus the VM managed-object
reference in `sourceRef`, so script tests and RunPlans can run a direct ESXi
power-state check before spawning PowerShell.
For exact VM-name searches (`field: "name"`, `operator: "equals"`), POSHManager uses the documented server-side name filters: `names=<vm>` for `/api/vcenter/vm` and `filter.names=<vm>` for `/rest/vcenter/vm`. Contains/starts-with/ends-with searches are filtered locally because vCenter VM list filters do not provide wildcard contains semantics. The combined `hostname` field searches both the VM inventory name and the VMware Tools guest `host_name`/FQDN after enrichment. VM display-name matches are checked first, then the rest of the inventory is still enriched for guest-only hostname matches. Networking/IP enrichment is only requested for candidates that match the filter. FQDN and IP discovery depends on VMware Tools data; when guest data is unavailable, the import falls back to the VM name as the host address and records the limitation in host notes.