It is recommended to use Static port binding with Elastic port allocation for environments with a high rate of VM configuration change or VM provisioning operations. This will allow vCenter to dynamically adjust the number of ports associated with the portgroup to accommodate new VMs as needed. For more information, see section
Edit General Distributed Port Group Settings in the
vSphere Networking Guide.
Resolving the issue requires first identifying and correcting the cause of the VM provisioning or configuration failures leading to the orphaned ports and then calling the refreshPortState vCenter API to reclaim the orphaned ports. Identifying and resolving the cause of the provisioning failures is out of the scope of this article.
The refreshPortState API can be invoked through the following method:
- Identify the managed object ID (MOID) for the vShpere Distributed Switch that contains the problem portgroup:
- Navigate to the vCenter Manager Object browser and enter the vCenter credentials. The Managed Object Browser can be accessed at the following URL: https://<VC IP or hostname>/mob.
- Identify the distributed switch MOID by following the links for content -> group-d1 (Datacenters) -> selecting the datacenter and then selecting the affected dvPortgroup from the network property box.
- From the dvPortgroup page, select the config link and note the Value for the distributedVirtualSwitch property. This is the MOID for the VDS.
- Invoke the refreshPortState API:
- Navigate to the following URL: https://<VC IP or hostname>/mob/?moid=<VDS MOID>&method=refreshPortState. You will need to substitute the vCenter hostname and the VDS MOID for the specific environment.
- Leave the portKeys text box empty and click Invoke Method.
Note: This operation is not disruptive to virtual machines or other VDS traffic.