vcf_vim_host_network¶
State module for standard vSwitch / port group / VMkernel adapters.
Note on NIC teaming / physical-failover mode:
vswitch_teaming_configured()covers the four load-balancing policies plus explicit-failover order on a standard vSwitch.LACP is DVS-only in vSphere — it is not available on a standard vSwitch. See
saltext.vcf.states.vcf_vim_dvsfor the DPG equivalent; LACP-with-LAG (LAG creation +ReconfigureLacp_Taskon the DVS) is a follow-up.
- saltext.vcf.states.vcf_vim_host_network.vswitch_present(name, host, num_ports=None, mtu=1500, pnic_devices=None, profile=None)[source]¶
Ensure a standard vSwitch name exists on host with the given config.
num_ports is a create-time hint only — ESXi 5+ auto-scales the port count internally, so passing a fixed value produces spurious drift on every apply. Omit it to skip the drift check; the creation of a new vSwitch still falls back to 128.
- saltext.vcf.states.vcf_vim_host_network.portgroup_present(name, host, vswitch, vlan_id=0, promiscuous=None, mac_changes=None, forged_transmits=None, profile=None)[source]¶
Ensure a standard port group name exists with the given config.
Security-policy args (
promiscuous/mac_changes/forged_transmits):Trueaccepts,Falserejects,None(default) inherits the vSwitch policy.Nested-VM labs typically want all three
Trueon the port group carrying nested workloads so nested MAC addresses can traverse the physical vSwitch.
- saltext.vcf.states.vcf_vim_host_network.vmkernel_present(name, host, portgroup=None, dhcp=False, ip_address=None, subnet_mask=None, mtu=1500, profile=None)[source]¶
Ensure a VMkernel name (device id, e.g.
vmk1) exists.If the device doesn’t exist, a portgroup is required to bind it to. For an existing vmkernel, drift on IP/MTU/DHCP triggers an update.
- saltext.vcf.states.vcf_vim_host_network.vswitch_teaming_configured(name, host, policy, reverse_policy=None, notify_switches=None, rolling_order=None, check_beacon=None, active_nic=None, standby_nic=None, profile=None)[source]¶
Ensure standard vSwitch name on host uses the given NIC-teaming policy.
Satisfies the “virtual switches must be set up in a physical network failover mode (LACP, teaming)” requirement for standard vSwitches. LACP itself is DVS-only in vSphere; on a standard vSwitch the
policyvalue covers all four load-balancing modes and explicit failover order.Only fields the caller passes (non-
None) are considered for drift;Nonemeans “don’t manage this field”, so callers can pin just the policy while leaving everything else as ESXi sees it.