During my research for the last part of my blog series on Bare Metal Deployment I wanted to get an overview of the weights that were assigned to all virtual machines on a host. What looked like a simple thing quickly became a little complex.
Let’s assume you have a Windows Server 2012 (R2) host running Hyper-V. On this host you have configured a NIC team with a vSwitch on top of that, either manually or with a logical switch from System Center Virtual Machine Manager 2012 SP1 or R2. The vSwitch is configured with the MinimumBandwidthMode set to Weight. In a weighted mode each virtual network adapter that has a weight assigned to it will have its minimum bandwidth mode calculated in percentage of the total bandwidth. For example if you have two virtual machines running on a vSwitch with the MinimumBandwidthMode set to Weight and each virtual machine has a weight of 3 they both have a minimum of 50% of the total bandwidth guaranteed. If you have fifty virtual machines running on a vSwitch with the MinimumBandwidthMode set to Weight and each virtual machine has a weight of 3, each virtual machine will have a minimum of 2% of the total bandwidth guaranteed.
If every virtual machine has the same weight assigned to it, the calculation is quite simple. It will become more complex if you have virtual machines with different weights. For example you have seven virtual machines with a minimum weight of 5, twenty-four virtual machines with a weight of 3 and eleven virtual machines with a weight of 1.
· High bandwidth adapter 7*5 = 35
· Medium bandwidth adapter 24*3 = 72
· Low bandwidth adapter 11*1 = 11
· Total weight 35 + 72 + 11 = 118
To get the percentage of a single vNIC, divide the weight of a single vNIC by the sum of all vNIC weights and multiple by 100. A virtual machine with a High bandwidth adapter would have a minimum bandwidth percentage of 5/118 * 100 = 4.24%
Virtual machines tend to move all over the place and to make it even more complex it is also possible to create vNICs accessible for the MangementOS. These vNICs can also have a minimum bandwidth value.
[image not preserved in the archive]
Luckily for us is there is an easier way of getting the bandwidth information by calling on our good friend PowerShell. You can use the Get-VMNetworkAdapter cmdlet to retrieve a list of information about each vNIC (attached to a virtual machine or running in the MangementOS).