saltext.vcf.utils.esxi

ESXi host connection helpers — standalone/unmanaged ESXi only.

All communication uses the pyVmomi SOAP/VMODL stack (/sdk). This works on any ESXi host regardless of whether the vAPI endpoint (/api/*) is present, which is important because shuttle-deployed test hosts omit that service.

On hosts that have been joined to a vCenter, the REST /api/session endpoint is blocked (400 on real VCF 9.2). For hosts managed by vCenter, cluster- level configuration is done via the Configuration Profile API; see saltext.vcf.clients.cluster_config.

Config is read from Salt opts/pillar under saltext.vcf.esxi:

saltext.vcf:
  esxi:
    host: esxi-test.example.com
    username: root
    password: VMware123!
    verify_ssl: false
saltext.vcf.utils.esxi.get_config(opts, profile=None)[source]

Extract ESXi connection config from Salt opts/pillar.

saltext.vcf.utils.esxi.get_service_instance(opts, profile=None)[source]

Return a connected pyVmomi ServiceInstance for the ESXi host.

Cached per (host, port, username). Use invalidate_service_instance() to force a fresh connection.

saltext.vcf.utils.esxi.invalidate_service_instance(opts, profile=None)[source]

Disconnect and drop the cached ServiceInstance for this host.

saltext.vcf.utils.esxi.get_host_system(opts, profile=None)[source]

Return the vim.HostSystem for a standalone ESXi host.

When connecting directly to an ESXi host (not vCenter), the SOAP tree contains exactly one datacenter with one host.