VMware Cloud Community
Bucketenator
Enthusiast
Enthusiast
Jump to solution

How to increase per-host DVS proxy switch max ports?

Hello all,


I'm hoping one of the PowerCLI gurus out there can help me with a problem that's driving me nuts.

The issue; in our vSphere 5 environment we're using a dvSwitch across a cluster of hosts ... occasionally the hosts are running out of DVS proxy switch ports.  The default it 256 ports, and I'd therefore like to increase it (e.g. 1024 or similar).

I can query the host object and determine the numPorts & maxPorts property:

get-vmhost blah.lab | Get-view -Property 'Config.Network' | %{ foreach ( $Switch in $_.Config.Network.ProxySwitch) {write-host "DVS Name: " $Switch.dvsName " NumPorts " $Switch.numPorts " configNumPorts " $Switch.configNumPorts } }

Kudos to the vSphere PowerCLI Reference team for giving me the seed code above to get this far. This gives me...

DVS Name:  dvTest  NumPorts  256  configNumPorts  256

So far, so good.   According to the documentation (assumption: I'm interpreting it correctly) if I set the configNumPorts property of HostProxySwitch to a different value this will change the number of proxy DVS ports after a of the host reboot.   I tried this, and it didnt work.

Perhaps I need to invoke a method of some sort to apply the change to the proxy switch on the host? Or am I heading in the wrong direction?

As you can see, at this stage I'm running out of PowerCLI skills.  All help gratefully received!

Jason D
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Ok, I see what you are trying to do.

I had a look, but it seems there is no documented method to change the MaxPort value of a proxyswitch. Smiley Sad


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

The following should increase the number of ports.

You have to pass the ConfigVersion property to make the call.

And a reboot is indeed required

function Set-dvSwMaxPort{
   
param ($dvSw, $Ports)
   
   
$spec = New-Object VMware.Vim.VMwareDVSConfigSpec
   
$spec.ConfigVersion = $dvSw.ExtensionData.Config.ConfigVersion
   
$spec.MaxPorts = $Ports   
   
$dvSw.ExtensionData.ReconfigureDvs($spec)
}

$dvSwitchName = "dvSw1"
$dvSw = Get-VirtualSwitch -Name $dvSwitchName -Distributed

Set-dvSwMaxPort
-dvSw $dvSw -Ports 256


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Bucketenator
Enthusiast
Enthusiast
Jump to solution

Luc,

Thanks for taking the time to assist ... unfortunately it doesnt achieve what I'm aiming for, which is to increase the maximum allocation of DVS proxy switch ports on a given host which is already attached to a DVS.   You can interrogate the DVS proxy switches at the ESX shell using net-dvs:

~ # net-dvs | more
switch a4 e8 0f 50 fe 90 47 81-43 b6 1a df ba 74 bf 0b (etherswitch)
        max ports: 256
        global properties:
                com.vmware.common.version = 0x 1. 0. 0. 0
                        propType = CONFIG
                com.vmware.common.alias = dvTest ,         propType = CONFIG
                com.vmware.common.uplinkPorts:
                        dvUplink1, dvUplink2, dvUplink3, dvUplink4
                        propType = CONFIG
                com.vmware.etherswitch.ipfix:
                        idle timeout = 15 seconds
                        active timeout = 60 seconds
                        sampling rate = 0
                        collector = 0.0.0.0:0
                        internal flows only = false
                        propType = CONFIG
... [ cut ]

As you can see (and are probably well aware) the VC-defined DVS is implemented as a proxy switch on each host that attaches to it, and proxy switches are allocated 256 local ports (local to the host that is).   As each vNIC or vmk on a given host is allocated & mapped the DVS port groups, a port from the proxy switch is allocated.

The full outout of the net-dvs command shows every port connect to the proxy switch, and when I was have VM provisioning failures the count of allocated ports was right up to the 256 maximum.   I guess in most environments 256 ports is enough, but in our environment we have lots of small VMs with multiple vNICs.

So in summary, it's actually the DVS proxy switch maxport count on each host attached to the DVS that I'm trying to increase.   net-dvs showed promise (net-dvs -a -P maxports dvsname) but that just adds a new DVS proxy switch with the increase maxports count, it doesnt allow me to change the configuration of an existing proxy switch.

Hopefully this clarifies what I'm trying to achieve, and hence why I was messing around with the objects like HostProxySwitch.

Thanks,

Jason D
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Ok, I see what you are trying to do.

I had a look, but it seems there is no documented method to change the MaxPort value of a proxyswitch. Smiley Sad


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Bucketenator
Enthusiast
Enthusiast
Jump to solution

Luc thanks once again for your time on this issue.   I've got down and dirty with this and started attacking the problem from the VC database angle:

  1. Edited the row for a host and changed MAX_PORT & CURRENT_MAX_PORT from 256 to 1024 ...

    VPX_DVHOST.png
  2. Restarted VC.
  3. Rebooted the ESX host.
  4. Login and check net-dvs output ... 1024 ports!

It seems to have worked.  Pretty ugly solution though, and it's effectiveness is not proven (I'm not in a position to test the port limit yet).

There must be a better PowerCLI way though surely?  I did some further digging via the VC mob browser (http://vc/mob/) and it would seem that the VMwareDVSConfigInfo object contains an array of DistributedVirtualSwitchHostMember objects, in which the maxProxySwitchPorts property is defined. Surely if this property were to be set to an appropriate value for all the DVS-attached hosts and then the ReconfigureDvs_Task() method called it would get the job done?

Borrowing some of (your?) DVS cmdlet code from the PowerCLI Reference, I crafted a new cmdlet (see attached file) to do exactly that and ... it worked.  Interestingly, unlike the manual steps above, the new max ports value is immediately propagated out to the host from VC so there's no need to restart VC etc, but I'm guessing that a host reboot is still required to make the change effective.

Since the majority of the code is from your co-authored book, I'm going to assign full points for the assist Smiley Happy

Cheers!

Jason D

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Thanks for sharing, I must have missed that one.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
krisnz
Contributor
Contributor
Jump to solution

How can I change this value for a host deployed using autodeploy. setting will not be persistent after stateless host reboot..

any help much appreciated

0 Kudos