Using a Distributed Virtual Switch
A DistributedVirtualSwitch managed object is a virtual network switch that is located on a vCenter Server. A distributed virtual switch manages configuration for proxy switches (HostProxySwitch). A proxy switch is located on an ESXi host that is managed by the vCenter Server and is a member of the switch. A distributed switch also provides virtual port state management so that port state is maintained when vCenter Server operations move a virtual machine from one host to another.
A proxy switch performs network I/O to support the following network traffic and operations:
A DistributedVirtualSwitch is the base distributed switch implementation. It supports a VMware distributed virtual switch implementation and it supports third party distributed switch implementations. The base implementation provides the following capabilities (defined in the DVSFeatureCapability object):
A VmwareDistributedVirtualSwitch supports the following additional capabilities (defined in the DVSFeatureCapability and VMwareDVSFeatureCapability objects):
Distributed Virtual Switch Configuration
To use a distributed virtual switch, you create a switch and portgroups on a vCenter Server, and add hosts as members of the switch.
1
Use the Folder.CreateDVS_Task method to create a distributed virtual switch. Use a DVSConfigSpec to create a switch for a third-party implementation. Use a VMwareDVSConfigSpec to create a VMware distributed virtual switch.
2
Use the CreateDVPortgroup_Task method to create portgroups for host and virtual machine network connections and for the connection between proxy switches and physical NICs. A DistributedVirtualPortgroup specifies how virtual ports (DistributedVirtualPort) will be used. When you create a distributed virtual switch, the vCenter Server automatically creates one uplink portgroup (config.uplinkPortgroup). Uplink portgroups are distributed virtual portgroups that support the connection between proxy switches and physical NICs.
Port creation on a distributed switch is determined by the portgroup type (DVPortgroupConfigSpec.type):
If a portgroup is early binding (static), then DVPortgroupConfigSpec.numPorts determines the number of ports that get created when the portgroup is created. This number can be increased if DVPortgroupConfigSpec.autoExpand is true.
You can also specify standalone ports that are not associated with a port group and uplink ports that are created on ESXi hosts (DVSConfigSpec.numStandalonePorts).
The DVPortgroupConfigInfo.numPorts property is the total number of ports for a distributed virtual switch. This total includes the ports generated by the static and dynamic portgroups and the standalone ports.
3
4
Retrieve physical NIC device names from the host (HostSystem.config.network.pnic[].device).
5
Specify hosts (DVSConfigSpec.host[]).
When you add a host to a distributed virtual switch (DistributedVirtualSwitch.config.host), the host automatically creates a proxy switch. The proxy switch is removed automatically when the host is removed from the distributed virtual switch.
6
Specify port or portgroup connections in the host virtual NIC spec (HostVirtualNicSpec.distributedVirtualPort or HostVirtualNicSpec.portgroup).
Specify port or portgroup connections in the distributed virtual port backing (VirtualEthernetCardDistributedVirtualPortBackingInfo) for the virtual Ethernet cards on the virtual machine (VirtualEthernetCard.backing).
Backup, Rollback, and Query Operations
If you are using a VmwareDistributedVirtualSwitch, you can perform backup and rollback operations on the switch and its associated distributed virtual portgroups.
When you reconfigure a VMware distributed virtual switch (ReconfigureDvs_Task), the Server saves the current switch configuration before applying the configuration updates. The saved switch configuration includes portgroup configuration data. The Server uses the saved switch configuration as a checkpoint for rollback operations. You can rollback the switch or portgroup configuration to the saved configuration, or you can rollback to a backup configuration (EntityBackupConfig).
To backup the switch and portgroup configuration, use the DistributedVirtualSwitchManager.DVSManagerExportEntity_Task method. The export method produces a EntityBackupConfig object. The backup configuration contains the switch and/or portgroups specified in the SelectionSet parameter. To backup the complete configuration you must select the distributed virtual switch and all of its portgroups.
To rollback the switch configuration, use the DVSRollback_Task method to determine if the switch configuration has changed. If it has changed, use the ReconfigureDvs_Task method to complete the rollback operation.
To rollback the portgroup configuration, use the DistributedVirtualPortgroup.DVPortgroupRollback_Task method to determine if the portgroup configuration has changed. If it has changed, use the ReconfigureDVPortgroup_Task method to complete the rollback operation.
To perform query operations on a distributed virtual switch, use the DistributedVirtualSwitchManager methods.