Files
deb-python-pyvmomi/docs/vim/DistributedVirtualSwitch.rst
Shawn Hartsock 15f7be9a52 pyVmomi reStructured Text Documentation
This external documentation for pyVmomi was generated using Googly Docs
(aka Google Standard Documentation) which renders very cleanly in
GitHub. Internal documentation for a class should be done in Sphinx
format because tools like pyCharm and Eclipse can use that documentation
as a hint for code completion.

Note: External docs as Googly Docs, internal docs as Sphinx.

Closes bug#15
2014-06-17 14:07:42 -04:00

32 KiB

vim.DistributedVirtualSwitch

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:
  • Network traffic between virtual machines on any hosts that are members of the distributed virtual switch.
  • Network traffic between virtual machines that uses a distributed switch and a virtual machine that uses a VMware standard switch.
  • Network traffic between a virtual machine and a remote system on a physical network connected to the ESXi host.
  • vSphere system operations to support capabilities such as VMotion or High Availability.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 ( DVSFeatureCapability ):
  • NIC teaming
  • Network I/O control
  • Network resource allocation
  • Quality of service tag support
  • User-defined resource pools
  • I/O passthrough (VMDirectPath Gen2)A VmwareDistributedVirtualSwitch supports the following additional capabilities ( DVSFeatureCapability and VMwareDVSFeatureCapability ):
  • Backup, restore, and rollback for a VMware distributed virtual switch and its associated portgroups.
  • Maximum Transmission Unit (MTU) configuration.
  • Health check operations for NIC teaming and VLAN/MTU support.
  • Monitoring switch traffic using Internet Protocol Flow Information Export (IPFIX).
  • Link Layer Discovery Protocol (LLDP).
  • Virtual network segmentation using a Private VLAN (PVLAN).
  • VLAN-based SPAN (VSPAN) for virtual distributed port mirroring.
  • Link Aggregation Control Protocol (LACP) defined for uplink portgroups.Distributed Virtual Switch ConfigurationTo use a distributed virtual switch, you create a switch and portgroups on a vCenter Server, and add hosts as members of the switch.
  • Create a distributed virtual switch (
  • Folder
  • .
  • CreateDVS_Task
  • ). Use a
  • DVSConfigSpec
  • to create a switch for a third-party implementation. Use a
  • VMwareDVSConfigSpec
  • to create a VMware distributed virtual switch.
  • Create portgroups (
  • CreateDVPortgroup_Task
  • ) 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
  • .
  • If a portgroup is ephemeral (dynamic), then
  • numPorts
  • is ignored and ports are created as needed.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.
  • If you have created additional uplink portgroups, use the
  • ReconfigureDvs_Task
  • method to add the portgroup(s) to the
  • DVSConfigSpec
  • .
  • uplinkPortgroup
  • array.
  • Retrieve physical NIC device names from the host (
  • HostSystem
  • .
  • config
  • .
  • network
  • .
  • pnic
  • [].
  • device
  • ).
  • Add host member(s) to the distributed virtual switch. To configure host members:
  • Specify hosts (
  • DVSConfigSpec
  • .
  • host
  • []).
  • For each host, specify one or more physical NIC device names to identify the pNIC(s) for the host proxy connection to the network (
  • DistributedVirtualSwitchHostMemberConfigSpec
  • .
  • backing
  • .
  • pnicSpec
  • [].
  • pnicDevice
  • )
  • Use the
  • DistributedVirtualSwitch
  • .
  • ReconfigureDvs_Task
  • method to update the switch configuration.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.
  • Connect hosts and virtual machines to the distributed virtual switch.
  • Host connection
  • Specify port or portgroup connections in the host virtual NIC spec (
  • HostVirtualNicSpec
  • .
  • distributedVirtualPort
  • or
  • HostVirtualNicSpec
  • .
  • portgroup
  • ).
  • Virtual machine connection
  • 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 OperationsIf 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.
extends

vim.ManagedEntity

since

vSphere API 4.0

Attributes

uuid (str):

Generated UUID of the switch. Unique across vCenter Server inventory and instances.

capability (vim.DistributedVirtualSwitch.Capability):

Capability of the switch. Capabilities are indicated at the port, portgroup and switch levels, and for version-specific features. When you retrieve this property from an ESXi host, capability . dvsOperationSupported should always be set to false.

summary (vim.DistributedVirtualSwitch.Summary):

Summary of the switch.

config (vim.DistributedVirtualSwitch.ConfigInfo):

Switch configuration data.

networkResourcePool (vim.dvs.NetworkResourcePool):

Network resource pool information for the switch.

portgroup (vim.dvs.DistributedVirtualPortgroup):

Portgroups that are defined on the switch.

runtime (vim.DistributedVirtualSwitch.RuntimeInfo):

Runtime information of the distributed virtual switch.

Methods

FetchDVPortKeys(criteria):

Return the keys of ports that meet the criteria. On an ESXi host, the property shows only the connected ports currently on the host.

Privilege:

System.Read

Args:
criteria (vim.dvs.PortCriteria, optional):

The port selection criteria. If unset, the operation returns the keys of all the ports in the switch.

Returns:

str:

FetchDVPorts(criteria):

Return the ports that meet the criteria.

Privilege:

System.Read

Args:
criteria (vim.dvs.PortCriteria, optional):

The port selection criteria. If unset, the operation returns the keys of all the ports in the portgroup.

Returns:

vim.dvs.DistributedVirtualPort:

QueryUsedVlanIdInDvs():

Return the used VLAN ID (PVLAN excluded) in the switch.

Privilege:

System.Read

Args:

Returns:

int:

ReconfigureDvs(spec):
Reconfigures a distributed virtual switch. You can use this method to set switch properties or to reset the switch to a previous state.Reconfiguring a Standard Distributed Virtual SwitchTo reconfigure a DistributedVirtualSwitch , use a DVSConfigSpec to set the switch properties.Reconfiguring a VMware Distributed Virtual SwitchIf you use a VmwareDistributedVirtualSwitch , you can perform the following switch reconfiguration:
  • Use a
  • VMwareDVSConfigSpec
  • to set the switch properties.
  • Use the
  • VMwareDVSConfigSpec
  • returned by
  • DVSRollback_Task
  • to reset the switch to a previous state.Reconfiguring the switch may require any of the following privileges, depending on what is being changed:
  • DVSwitch.PolicyOp if
  • policy
  • is set.
  • DVSwitch.PortSetting if
  • defaultPortConfig
  • is set.
  • DVSwitch.HostOp if
  • policy
  • is set. The user will also need the Host.Config.Network privilege on the host.
  • DVSwitch.Vspan if
  • vspanConfigSpec
  • is set.
  • DVSwitch.Modify for anything else.
Privilege:

dynamic

Args:
spec (vim.DistributedVirtualSwitch.ConfigSpec):

The configuration of the switch

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.ConcurrentAccess:

vim.fault.ConcurrentAccess

vim.fault.DuplicateName:

vim.fault.DuplicateName

vim.fault.InvalidState:

vim.fault.InvalidState

vim.fault.InvalidName:

vim.fault.InvalidName

vim.fault.NotFound:

vim.fault.NotFound

vim.fault.AlreadyExists:

vim.fault.AlreadyExists

vim.fault.LimitExceeded:

vim.fault.LimitExceeded

vim.fault.ResourceInUse:

vim.fault.ResourceInUse

vim.fault.ResourceNotAvailable:

If there is no port available in the portgroup

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

vmodl.fault.NotSupported:

if called directly on a host or if the spec includes settings for any vNetwork Distributed Switch feature that is not supported on this switch.

vmodl.fault.InvalidArgument:

if any of the hosts being added lack support for any of the overlay classes of the switch's overlay instances.

vim.fault.VspanPortConflict:

if dvPort is used as both the transmitted source and destination ports in Distributed Port Mirroring sessions.

vim.fault.VspanPromiscuousPortNotSupported:

if a promiscuous port is used as transmitted source or destination in the Distributed Port Mirroring sessions.

vim.fault.VspanSameSessionPortConflict:

if a dvPort is used as both the source and destination in the same Distributed Port Mirroring session.

vim.fault.VspanDestPortConflict:

if a dvPort is used as desination ports in multiple Distributed Port Mirroring sessions.

PerformDvsProductSpecOperation(operation, productSpec):

This method updates the DistributedVirtualSwitch product specifications.

Privilege:

DVSwitch.Modify

Args:
operation (str):

The operation. See DistributedVirtualSwitchProductSpecOperationType for valid values. For VmwareDistributedVirtualSwitch , only upgrade is valid.

productSpec (vim.dvs.ProductSpec, optional):

The product info of the implementation.

Returns:

vim.Task:

Raises:

vim.fault.TaskInProgress:

vim.fault.TaskInProgress

vim.fault.InvalidState:

vim.fault.InvalidState

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vmodl.fault.NotSupported:

If called directly on a host.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

MergeDvs(dvs):
Merge an existing DistributedVirtualSwitch (source) to this switch (destination). The host members and the connected entity of the source switch will be transferred to the destination switch. This operation disconnects the entities from the source switch, tears down its host proxy switches, creates new proxies for the destination switch, and reconnects the entities to the destination switch.In summary, this operation does the following:
  • Adds the
  • config
  • .
  • maxPorts
  • of the source switch to the
  • maxPorts
  • of the destination switch.
  • The host members of the source switch leave the source switch and join the destination switch with the same Physical NIC and VirtualSwitch (if applicable). A set of new uplink ports, compliant with the
  • uplinkPortPolicy
  • , is created as the hosts join the destination switch.
  • The portgroups on the source switch are copied over to destination switch, by calculating the effective default port config and creating a portgroup of the same name in the destination switch. If the name already exists, the copied portgroup uses names following a "Copy of switch-portgroup-name" scheme to avoid conflict. The same number of ports are created inside each copied portgroup.
  • The standalone distributed virtual ports are not copied, unless there is a virtual machine or host virtual NIC connecting to it. In that case, the operation calculates the effective port config and creates a port in the destination switch with the same name. Name conflict is resolved using numbers like "original-port-name(1)". The uplink ports are not copied over.
  • The virtual machine and host virtual NICs are disconnected from the source switch and reconnected with the destination switch, to the copied standalone port or portgroup.
  • If you are using a
  • VmwareDistributedVirtualSwitch
    • Unless the PVLAN map contains exactly the same entries between the source and destination VMware distributed virtual switches, the method raises a fault if
  • pvlanId
  • is set in any port, portgroup, or switch that will be copied.
Privilege:

DVSwitch.Modify

Args:
dvs (vim.DistributedVirtualSwitch):

The switch (source) to be merged

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

vim.fault.NotFound

vim.fault.ResourceInUse:

If failed to delete the source switch

vim.fault.InvalidHostState:

vim.fault.InvalidHostState

vmodl.fault.NotSupported:

If called directly on a host.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

AddDVPortgroup(spec):

Creates one or more DistributedVirtualPortgroup s and adds them to the distributed virtual switch.

Privilege:

DVPortgroup.Create

Args:
spec (vim.dvs.DistributedVirtualPortgroup.ConfigSpec):

The specification for the portgroup.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.DuplicateName:

vim.fault.DuplicateName

vim.fault.InvalidName:

vim.fault.InvalidName

vmodl.fault.NotSupported:

If called directly on a host.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

MoveDVPort(portKey, destinationPortgroupKey):

Move the ports out of their current portgroup into the specified portgroup. If the moving of any of the ports results in a violation of the portgroup policy, or type of the source or destination portgroup, the operation raises a fault. A conflict port cannot be moved.

Privilege:

DVSwitch.Modify

Args:
portKey (str):

The keys of the ports to be moved into the portgroup.

destinationPortgroupKey (str, optional):

The key of the portgroup to be moved into. If unset, the port will be moved under the switch.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

vim.fault.NotFound

vim.fault.ConcurrentAccess:

vim.fault.ConcurrentAccess

vmodl.fault.NotSupported:

If called directly on a host.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

UpdateDvsCapability(capability):

Set the capability of the switch.

Privilege:

DVSwitch.Modify

Args:
capability (vim.DistributedVirtualSwitch.Capability):

The capability of the switch.

Returns:

None

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vmodl.fault.NotSupported:

If called directly on a host or if the switch implementation doesn't support this API.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

ReconfigureDVPort(port):

Reconfigure individual ports.

Privilege:

DVSwitch.PortConfig

Args:
port (vim.dvs.DistributedVirtualPort.ConfigSpec):

The specification of the ports.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

vim.fault.NotFound

vim.fault.ResourceInUse:

vim.fault.ResourceInUse

vim.fault.ConcurrentAccess:

vim.fault.ConcurrentAccess

vmodl.fault.NotSupported:

If called directly on a host or if the switch implementation doesn't support this API or if the spec includes settings for any vSphere Distributed Switch feature that is not supported on this switch.

vmodl.fault.InvalidArgument:

If the array have different elements for the same port.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

RefreshDVPortState(portKeys):

Refresh port states.

Privilege:

System.Read

Args:
portKeys (str, optional):

The keys of the ports to be refreshed. If not specified, all port states are refreshed.

Returns:

None

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

vim.fault.NotFound

RectifyDvsHost(hosts):

Update the switch configuration on the host to bring them in sync with the current configuration in vCenter Server.

Privilege:

System.Read

Args:
hosts (vim.HostSystem, optional):

The hosts to be rectified.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

vim.fault.NotFound

UpdateNetworkResourcePool(configSpec):

Update the network resource pool configuration. since: vSphere API 4.1

Privilege:

DVSwitch.ResourceManagement

Args:
configSpec (vim.dvs.NetworkResourcePool.ConfigSpec):

The network resource pool configuration specification.

Returns:

None

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

if the resource pool does not exist on the dvs.

vim.fault.InvalidName:

if the name of the resource pool is invalid.

vim.fault.ConcurrentAccess:

if a network resource pool is modified by two or more clients at the same time.

vmodl.fault.NotSupported:

if network I/O control is not supported on the vSphere Distributed Switch.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

AddNetworkResourcePool(configSpec):

Add a network resource pool. since: vSphere API 5.0

Privilege:

DVSwitch.ResourceManagement

Args:
configSpec (vim.dvs.NetworkResourcePool.ConfigSpec):

the network resource pool configuration specification.

Returns:

None

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.InvalidName:

vim.fault.InvalidName

vmodl.fault.NotSupported:

if network I/O control is not supported on the vSphere Distributed Switch.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

RemoveNetworkResourcePool(key):

Remove a network resource pool. since: vSphere API 5.0

Privilege:

DVSwitch.ResourceManagement

Args:
key (str):

The network resource pool key.

Returns:

None

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.NotFound:

if the resource pool does not exist on the dvs.

vim.fault.InvalidName:

if the name of the resource pool is invalid.

vim.fault.ResourceInUse:

If network resource pool is associated with a network entity

vmodl.fault.NotSupported:

if network I/O control is not supported on the vSphere Distributed Switch.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

EnableNetworkResourceManagement(enable):

Enable/Disable network I/O control on the vSphere Distributed Switch. since: vSphere API 4.1

Privilege:

DVSwitch.ResourceManagement

Args:
enable (bool):

If true, enables I/O control. If false, disables network I/O control.

Returns:

None

Raises:

vim.fault.DvsFault:

if the enabling/disabling fails.

vmodl.fault.NotSupported:

if network I/O control is not supported on the vSphere Distributed Switch.

vim.fault.DvsNotAuthorized:

if login-session's extension key does not match the switch's configured extensionKey .

DVSRollback(entityBackup):
This method determines if the distributed virtual switch configuration has changed. If it has changed, the method returns a VMwareDVSConfigSpec . Use the ReconfigureDvs_Task method to apply the rollback configuration to the switch. You can use the rollback method only on a VmwareDistributedVirtualSwitch .
  • If you specify the
  • entityBackup
  • parameter, the returned configuration specification represents the exported switch configuration. If the
  • entityBackup
  • matches the current switch configuration, the method does not return a configuration specification.
  • If
  • entityBackup
  • is not specified, the returned configuration specification represents a previous state of the switch, if available. When you use a VMware distributed virtual switch, each time you reconfigure the switch, the Server saves the switch configuration before applying the updates. If the vCenter Server is restarted, the saved configuration is not preserved and the method does not return a configuration specification.To use the rollback method, you must have the DVSwitch.Read privilege.

since: vSphere API 5.1

Privilege:

dynamic

Args:
entityBackup (vim.dvs.EntityBackup.Config, optional):

Backup of a distributed virtual switch, returned by the DVSManagerExportEntity_Task method.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails.

vim.fault.RollbackFailure:

if there is no configuration specified in entityBackup and the previous configuration does not exist either.

CreateDVPortgroup(spec):

Creates a single DistributedVirtualPortgroup and adds it to the distributed virtual switch. since: vSphere API 5.1

Privilege:

DVPortgroup.Create

Args:
spec (vim.dvs.DistributedVirtualPortgroup.ConfigSpec):

The specification for the portgroup.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vim.fault.DuplicateName:

if a portgroup with the same name already exists

vim.fault.InvalidName:

if name of the portgroup is invalid

UpdateDVSHealthCheckConfig(healthCheckConfig):

Update health check configuration. since: vSphere API 5.1

Privilege:

DVSwitch.Modify

Args:
healthCheckConfig (vim.DistributedVirtualSwitch.HealthCheckConfig):

The health check configuration.

Returns:

vim.Task:

Raises:

vim.fault.DvsFault:

if operation fails on any host or if there are other update failures.

vmodl.fault.NotSupported:

if health check is not supported on the switch.

LookupDvPortGroup(portgroupKey):

Returns the portgroup identified by the key within this VDS. since: vSphere API 5.1

Privilege:

System.Read

Args:
portgroupKey (str):

The key that identifies a portgroup of this VDS.

Returns:

vim.dvs.DistributedVirtualPortgroup:

Raises:

vim.fault.NotFound:

If the portgroup for the specified key is not found.

vmodl.fault.NotSupported:

If the operation is not supported.