set_vmk_service
Enable or disable a vSphere service on a VMkernel adapter with preview-first confirmation to avoid unintended changes.
Instructions
[WRITE] Enable/disable a host service on an existing vmk - preview/confirm gated.
Completes the add_host_vmk story: adapters are created serviceless by design, then tagged here (e.g. enable "vmotion" on a new vMotion vmk). Idempotent - re-applying the current state returns a no-write noop. Verify with list_host_vmks (the services field). Audited.
Valid services are the vSphere nicType names: management, vmotion, vsan, vSphereProvisioning, faultToleranceLogging, vSphereReplication, vSphereReplicationNFC, vSphereBackupNFC, ptp, and the nvme/vsan variants. Note "vSphereProvisioning", not "provisioning".
FAIL CLOSED: refuses both directions when the host's service map cannot be read. ABSOLUTE, no override: disabling management on the host's only management-enabled vmk - the call rides the interface it would untag.
Returns: Preview dict (action="preview"), noop dict (action="noop") when the state already matches, or result dict (action="set", services_now). Errors return a dict with "error" + hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vmk | Yes | Device name to change (e.g. "vmk3"). | |
| target | No | vCenter target name from config.yaml; omit to use the default target. | |
| confirm | No | False (default) returns the blast radius and changes nothing. True applies it. Do not set True because the user asked earlier; they have not seen the preview yet. | |
| enabled | Yes | True selects the vmk for the service; False deselects. | |
| service | Yes | Service/nicType name to enable or disable. | |
| host_name | Yes | ESXi host the vmk lives on. |