Incorrect Product Forwarding Class on vDS When Upgraded via PowerCLI

I recently encountered network issues on a VM migrated to a new host, it turns out it was due to a mismatch on the “Product_Forwarding_Class” between the host and vDS. The Forwarding Class configured for vDS version 6.5.0 and below is “etherswitch”, and from vDS version 6.6.0, and above the Forwarding Class is “cswitch”

When upgrading my vDS from version 6.5.0 to 6.6.0 using the PowerCLI command “Get-VDSwitch -Name “DSwitch” | Set-VDSwitch -Version 6.6.0“. The existing connected hosts had their “host_proxy_switch” upgraded with “cswitch” however, the vDS configuration in the vCenter database remained at “etherswitch” meaning any new hosts added to this vDS in the future would be configured with “etherswitch” causing a mismatch. This leads me to believe the PowerCLI module is missing the API command to update this specification. Note, upgrading via the UI does NOT exhibit this issue.

Below depicts configuration before and after using PowerCLI to Upgrade vDS.

To check the vDS configuration in your environment, you can do so by querying the vCenter Postgres Database or using PowerCLI.
$vds = Get-VDSwitch -Name "DSwitch"

VCDB Query
/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres psql.bin
select id,name,product_version,product_forwarding_class from vpx_dvs;

Host_proxy_switch configuration Query
net-dvs | head

If this mismatch found in your environment, the fix is fairly straightforward.

Warning: I tested this in my own lab successfully; however, I take no responsibility for any negative outcomes that may occur in your environment as a result of this procedure, so use at your own risk! I recommended you take extra precautions when performing this procedure and seek VMware support. I also recommend you take vCenter configuration and DB backups.

  1. Update the “Product_Forwarding_Class” specification on the vCenter DB for the vDS.
  2. Restart the vmware-vpxd service on the vCenter or Restart vCenter Server.
  3. Disconnect and reconnect hosts to the vDS configured with “etherswitch
  4. Recheck configurations.

Step 1 – Update “Product_forwarding_Class” on vDS

The PowerCLI code below should successfully update the “Product_Forwarding_Class” for the vDS.

$vds = Get-VDSwitch -Name "DSwitch"
$operation = 'upgrade'
$productSpec = New-Object VMware.Vim.DistributedVirtualSwitchProductSpec
$productSpec.ForwardingClass = 'cswitch'
$productSpec.Vendor = 'VMware, Inc.'
$productSpec.Name = 'DVS'
$productSpec.Version = '6.6.0'
$_this = $vds | Get-View
$_this.PerformDvsProductSpecOperation_Task($operation, $productSpec) 

Then confirm it has updated using PowerCLI or VCDB query.

$vds = Get-VDSwitch -Name "DSwitch"

Step 2 – Restart “vmware-vpxd” service on vCenter

service-control --restart vmware-vpxd

Step 3 – Disconnect and reconnect hosts to the vDS

Remove and re-add the ESXi host to the vDS, if you are unsure how to do this, I recommend you seek VMware support, if you are unable to seek VMware support, feel free to reach out to me. Below screenshots depict an ESXi host before and after it was removed and re-added to the vDS that was fixed by the previous two steps.

Thanks for reading, I hope you found this informative, feel free to comment below or follow me on Twitter @nmangraviti

Leave a Reply