PowerCLI – Distributed Virtual Switch Port Group Load Balancing Policies

While working on scripting the creation of Distributed Virtual Switches in a new virtual infrastructure of ours, I came to realize that VMware’s documentation for the Set-VDUplinkTeamingPolicy cmdlet was missing something.

Although Standard Virtual Switches only give you the ability to Load Balance on Source IP, Source MAC Address, Original Port ID, or by specifying an explicit failover order, Distributed Virtual Switches include a 5th option for “Load-based Teaming”, or by “Physical NIC Load”.

VMware’s CMDLET Reference link is here
http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/Set-VDUplinkTeamingPolicy.html

According to the documentation, the -LoadBalancingPolicy parameter is described here: “Specifies the load balancing policy for the corresponding distributed port, port group, or switch. The value can be LoadBalanceIP, LoadBalanceSrcMac, LoadBalanceSrcId, or ExplicitFailover.”

I assumed someone else had noticed this, but (perhaps due to my lack of finding the proper Google Search) I was unable to find what I wanted to script using a Physical NIC Load load-balancing policy.

The last thing I wanted to do was to be forced to stop the build script, and tell the user to temporarily use the vSphere Web Client.  Instead, I decided to make the change in the GUI, and invoke PowerCLI to see what the variable was.

Get-VDPortgroup MyPortGroup | Get-VDUplinkTeamingPolicy | fl

VDPortgroup                      : MyPortGroup
NotifySwitches                   : True
NotifySwitchesInherited          : True
LoadBalancingPolicy              : LoadBalanceLoadBased
LoadBalancingPolicyInherited     : False
FailoverDetectionPolicy          : LinkStatus
ActiveUplinkPort                 : {dvUplink1, dvUplink2}
StandbyUplinkPort                : {}
UplinkPortOrderInherited         : True
FailBack                         : False
FailBackInherited                : True
UnusedUplinkPort                 : {}
FailoverDetectionPolicyInherited : True
Uid                              : /VIServer=tcwd\matt@…..

Now, I was able to modify my script and update the rest of my port groups.  I could have modified the above with:

Get-VDPortgroup MyPortGroup | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceLoadBased

 

twitterredditlinkedinmail

2 Comments

  1. Max

    thx. worked fine for me.

    Reply
  2. BB

    Thanks a lot. This saved me some time. 🙂

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *