add_host_vmk
Create a static-IP VMkernel adapter on a distributed portgroup. Preview validates host, portgroup, IP, netmask, MTU without changes; confirm creates it and returns the device name.
Instructions
[WRITE] Add a static-IP VMkernel adapter on a DVS portgroup - preview/confirm gated.
Deliberately minimal shape for throwaway test vmks on L2-only segments (e.g. a TEP VLAN): static IPv4, NO gateway, NO services enabled. The DVS port allocation is handled internally - pass the distributed portgroup name. confirm=False validates (host + portgroup exist, IP/netmask/MTU legal, IP not already on the host) and returns the exact spec without writing; confirm=True creates and returns the assigned device name. Verify with list_host_vmks; remove with remove_host_vmk. Audited.
Returns: Preview dict (action="preview") or result dict (action="created", device=e.g. "vmk2"). Errors return a dict with "error" + hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | Static IPv4 address for the vmk. | |
| mtu | No | MTU for the vmk (default 1500; 9000 for jumbo tests). | |
| 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 creates it. Do not set True because the user asked earlier; they have not seen the preview yet. | |
| netmask | Yes | Subnet mask (e.g. 255.255.255.0). | |
| host_name | Yes | ESXi host to add the vmk on. | |
| portgroup | Yes | Distributed portgroup name to connect to. |