The resource 'Port-ID' is in use error when removing a host from VDS - The vSphere Distributed Switch configuration on some hosts differed from that of the vCenter Server

After receiving a warning from vCenter about VDS configuration drift I attempted the remediation methods outlined in this KB article (see Method 2).

I was unable to attach the blank Virtual Machine created from the KB to the specific ports that were showing as out of sync.

The out of sync ports were not occupied but were behaving like they were in use by another Virtual Machine.

Next I attempted to remove the out of sync host from the VDS but was met with the following "The resource 'Port-ID' is in use, error when removing a host from VDS"

To resolve this problem I have to use a combination of the KB article mentioned above and one other KB on how to "force" remove a host from a VDS that reports "The resource 'Port-ID' is in use" (see the last 4 steps in the KB).

I first selected the host I wanted to remove from the VDS and disconnected it from vCenter - Right click the ESXi host from the Inventory and select Connection > Disconnect.

I then proceeded to remove the host from the VDS (no warning this time about ports being in use as the host was disconnected).

The out of sync error on the VDS cleared as soon as the faulty host was removed.

Next I assigned the port that was reporting as "in use" before the host removal to the temporary Virtual Machine created from the first KB, in this case it was port 161.

After powering on the temporary Virtual Machine to ensure port 161 was occupied, I reconnected the out of sync host to vCenter and re-added it back to the VDS.

As port 161 was now legitimately "in use ", a full refresh of the VDS configuration on re-connection of the host seemed to take place. This resolved the out of sync VDS warning and my Cluster was backup to full strength.

This post describes what felt like a pretty unique situation, but hope this helps should you encounter something similar.

Thanks for reading

Adam