Fixing switch port leaks in VMM
hi everyone, it has become apparent that VMM 2008 R2 has switch port leaks when performing checkpointing operations through VMM (either through the PowerShell interface, through Visual Studio Lab Manager, through the self-service portal, or through the VMM Administrator Console)
This is a known issue that we will potentially address in an upcoming QFE. For now, there is a workaround that is detailed in this blog post. Alex from our team wrote the PowerShell script that resolves this issue.
How to tell if you have switch port leaks:
- You are managing Hyper-V using VMM
- Calling the following cmdlet from PowerShell take more than 3 minutes to return: get-vmhost "<host computer name FQDN>" | refresh-vmhost???
- executing the following queries locally on the Hyper-V host from an elevated command prompt return more than a couple of hundred different objects. Running the same query command from wbemtest.exe connecting to root\virtualization as "select * from Msvm_hostedaccesspoint" for example will give you an instant count.
- ??winrm enum wmi/root/virtualization/Msvm_hostedaccesspoint
- ??winrm enum wmi/root/virtualization/Msvm_resourceallocationsettingdata
- ??winrm enum wmi/root/virtualization/Msvm_networkelementsettingdata
- winrm enum wmi/root/virtualization/Msvm_bindsto?
How to fix the switch port leaks:
- Run the attached powershell script locally on the Hyper-V host from an elevated powershell window. This command will return back data on the unused networking elements in Hyper-V that were potentially leaked by VMM
- DeleteUnusedHyper-VNetworkingComponents.ps1 <hostname FQDN> no
- If you are satisfied with the objects that will potentially be deleted, run the same cmdlet with the "yes" switch.
- DeleteUnusedHyper-VNetworkingComponents.ps1 <hostname FQDN> yes
- Run refresh-vmhost again in VMM a couple of times to observe the increase in speed
- Create a scheduled task to execute this script against your Hyper-V hosts every couple of weeks.