Q. I want to use QoS with my Hyper-V switch but how do I reserve bandwidth for the VMs connected to the switch?
A. It is common to team multiple network adapters on a host using NIC Teaming then create a virtual switch using that team. On that virtual switch you can then create vNICs for use by the management OS for various purposes (Live Migration, cluster, management etc) and then the VMs connect directly to the switch. QoS values can be applied to each NIC. Typically as a best practice use weight rather than an absolute value and try to keep the weights close to 100 in total. Minimum bandwidth is also preferred over setting maximums as it allows workloads to utilize as much bandwidth as needed unless there is a contention at which point the values configured would be enforced. To set a minimum bandwidth weight for a vNIC (a NIC on the host connected to the switch) use:
Set-VMNetworkAdapter -ManagementOS -Name “Cluster” -MinimumBandwidthWeight 15
To set a minimum bandwidth weight for a vmNIC (a NIC connected to a VM) you can use PowerShell below. Note do not use the Hyper-V GUI which are absolute values and not weighted which will not work on a switch configured to use weighted. You can check the switch configuration using Get-VMSwitch | fl and the BandwidthReservationMode should be Weight which is the default.
Set-VMNetworkAdapter -VMName <name> -MinimumBandwidthWeight 5
The challenge is that VMs are often very dynamic and have a high churn of creation and deletion which makes constantly setting their weight and keeping the total close to 100 very difficult. Instead on the switch a default flow pool MinimumBandwidthWeight can be set which will be shared by all vNICs/vmNICs that do not have a specific QoS value. To set this use:
Set-VMSwitch "<switch name>" -DefaultFlowMinimumBandwidthWeight 50
In the example above 50% (assuming total weights are 100) is reserved for the default pool. For the vNICs used on the management OS such as Live Migration, Cluster set them with a QoS. For the VMs do not set a QoS and they will share the default flow pool.