create_dvs_portgroup
Create a VLAN-tagged portgroup on a distributed virtual switch. Preview validates the switch, name, binding, and VLAN without changes; confirm then applies the exact configuration.
Instructions
[WRITE] Create a VLAN-tagged portgroup on a dvSwitch - preview/confirm gated.
confirm=False (default) validates everything (switch exists, name free, binding and VLAN legal) and returns the exact spec that WOULD be created without writing anything. confirm=True creates the portgroup and waits for the task. Verify afterwards with list_dvs_portgroups. Audited.
binding="ephemeral" creates a portgroup with no pre-created port pool, attachable from the ESXi host client even when vCenter is down - use for a self-hosted VCSA's own management portgroup. num_ports is ignored for ephemeral. lateBinding is deprecated by vSphere and not offered.
Returns: Preview dict (action="preview", would_create) or result dict (action="created", created). Errors return a dict with "error" + hint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the new portgroup; must be unique on the switch. | |
| target | No | vCenter target name from config.yaml; omit to use the default target. | |
| binding | No | "earlyBinding" (default) or "ephemeral". | earlyBinding |
| 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. | |
| vlan_id | Yes | VLAN ID to tag (0-4094; 0 = none). | |
| dvs_name | Yes | Name of the distributed virtual switch to create it on. | |
| num_ports | No | Port count for earlyBinding portgroups (default 8). |