remove_host_vmk
Remove a VMkernel adapter from an ESXi host after previewing impact; requires confirmation, with guarded protections and optional force override for deliberate teardown.
Instructions
[WRITE] Remove a VMkernel adapter - confirm-gated, guarded, fail-closed.
REFUSES (unless force_unprotected=True) when the vmk is selected for any host service (management/vmotion/vsan/...), lives on a non-default netstack (NSX TEPs on vxlan, dedicated vmotion/provisioning stacks - never visible in the service map), carries a default gateway route, or when any of that CANNOT be verified - unverifiable is treated as unsafe, never as clear. Test vmks created by add_host_vmk trip none of these and remove cleanly without force.
ABSOLUTE, no override: the host's only management-enabled vmk is never removable - this call rides the interface it would delete.
force_unprotected=True (together with confirm=True) overrides the non-absolute protections for deliberate teardown; the override and every bypassed protection are recorded in the result (and the audit trail).
Returns: Preview dict (action="preview") or result dict (action="removed", plus forced/protections_bypassed when overridden). Errors return a dict with "error" + hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vmk | Yes | Device name to remove (e.g. "vmk2"). | |
| 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 removes it. Do not set True because the user asked earlier; they have not seen the preview yet. | |
| host_name | Yes | ESXi host the vmk lives on. | |
| force_unprotected | No | True bypasses the non-absolute protections above. |