The resource 'Port-ID' is in use error when removing a host from vSphere Distributed Switch (vDS) when nothing is using it
book
Article ID: 324497
calendar_today
Updated On:
Products
VMware vSphere ESXi
Issue/Introduction
When an ESXi host has no running virtual machines and is on Maintenance Mode, these symptoms are observed:
Unable to remove an ESXi host from the vSphere Distributed Switch (vDS).
Error similar to this is seen:
The resource '###' is in use.
Note: In this example, ### is the port-ID in use at that time. This could be any value.
Environment
VMware vSphere
Cause
In this situation, typically the vCenter database will contain a record that suggests that a dvPort with the number of '###' in "in use". This is why vCenter is issuing that error message.
However, when examining the output from the command esxcfg-vswitch -l on the ESXi host, the "in use" value associated with that dvPort "###" may show "0", indicating that it is not currently in use.
The dvPort "###" could be associated with a vmkernel interface. The vmkernel interface could be one associated with Management, vMotion, VSAN or other services.
Alternatively, the dvPort "###" could be associated with a virtual machine that has a snapshot that has not been consolidated.
Lastly, the dvPort "###" could be associated with a virtual machine template.
Resolution
The best way to remedy this will depend on which type of network connection is associated with the dvPort "###" in the error message.
If it is determined that:
The dvPort "###" is associated with a virtual machine or a virtual machine template, and
The Management vmkernel interface configured for the host is configured to use a standard switch (or a different vDS than the one in question);
Then follow the procedure below:
Place the ESXi host in Maintenance Mode (NOTE: If the ESXi host is part of a VSAN cluster, make sure to select the appropriate Maintenance Mode option that is suitable for a host to completely leave the VSAN cluster, as if it were being decommissioned. )
Disconnect the ESXi host from vCenter: vSphere client -> vCenter -> Hosts and Clusters icon -> Right-click on the ESXi host -> Connection -> Disconnect
Once successfully disconnected, remove the ESXi host from vCenter (which will also remove the ESXi host from any vDS of which it is a member): vSphere client -> vCenter -> Hosts and Clusters icon -> Right-click on the ESXi host -> Remove from inventory