Scissor
Virtuoso
Virtuoso

"upgrade" Distributed Switch's Network IO Control / LACP Enhancements via PowerCLI?

Jump to solution

vSphere 6.0.  PowerCLI 6.0 R1.


After using the New-VDSwitch PowerCLI command I notice that the vSphere Web Client shows there are "upgrades available" to the resulting Distributed Switch.  


I know I can right-click on the Distributed Switch and select upgrade in the Web Client.


Anyone know how I can perform the upgrade using PowerCLI?

Capture.PNG

search terms:  nioc

Tags (1)
1 Solution

Accepted Solutions
Scissor
Virtuoso
Virtuoso

The following is the code I ended up with yesterday before reading your reply... does it look ok to you?

Also, is it ok to use "ReconfigureDvs" instead of "ReconfigureDvs_Task"? 

p.s.  How do you get the colored syntax for your PowerCLI code?

$myvDS = New-VDSwitch -Verbose -Name $myvDSwitchName -Location $myNetFolder -NumUplinkPorts 2

# Upgrade DSwitch capabilities to 'NIOC v3' and 'Enhanced LACP Support'

$spec = New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.networkResourceControlVersion = 'version3'

$spec.lacpApiVersion = 'multipleLag'

$spec.configVersion = $myvDS.ExtensionData.config.configVersion

$myvDS.ExtensionData.ReconfigureDvs($spec)

# Enable NIOC

$myvDS.ExtensionData.EnableNetworkResourceManagement($true)


# Refetch our object to pick up current configuration

$myvDS = Get-VDSwitch $myvDS

View solution in original post

7 Replies
Scissor
Virtuoso
Virtuoso

I found the 'Onyx for the Web Client' fling which provided the below code to answer my question:

Fling URL - https://labs.vmware.com/flings/onyx-for-the-web-client

# Upgrade to 'Network I/O Control v3'

$spec = New-Object VMware.Vim.DVSConfigSpec

$spec.networkResourceControlVersion = 'version3'

$spec.configVersion = '1'

$_this = Get-View -Id 'VmwareDistributedVirtualSwitch-dvs-424'

$_this.ReconfigureDvs_Task($spec)

# Upgrade to 'Enhanced LACP Support'

$spec = New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.lacpApiVersion = 'multipleLag'

$spec.configVersion = '2'

$_this = Get-View -Id 'VmwareDistributedVirtualSwitch-dvs-424'

$_this.ReconfigureDvs_Task($spec)

LucD
Leadership
Leadership

This is a typical example why you can't use Onyx produced code as is :smileygrin:

You can't hard-code the ConfigVersion property like this, you will have to fetch the actual value from the VDS object.

That line should be

$spec.configVersion = $_this.Config.configVersion

The 2nd "issue" is the way the VDS is referenced, the generated code uses the actual MoRef of the VDS for which Onyx captured the code.

To make the code portable, you should fetch the VDS MoRef


$dvSwitchName = 'vds1'

$vds = Get-VDSwitch -Name $dvSwitchName

$_this = Get-View -Id $vds.ExtensionData.MoRef


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

Scissor
Virtuoso
Virtuoso

The following is the code I ended up with yesterday before reading your reply... does it look ok to you?

Also, is it ok to use "ReconfigureDvs" instead of "ReconfigureDvs_Task"? 

p.s.  How do you get the colored syntax for your PowerCLI code?

$myvDS = New-VDSwitch -Verbose -Name $myvDSwitchName -Location $myNetFolder -NumUplinkPorts 2

# Upgrade DSwitch capabilities to 'NIOC v3' and 'Enhanced LACP Support'

$spec = New-Object VMware.Vim.VMwareDVSConfigSpec

$spec.networkResourceControlVersion = 'version3'

$spec.lacpApiVersion = 'multipleLag'

$spec.configVersion = $myvDS.ExtensionData.config.configVersion

$myvDS.ExtensionData.ReconfigureDvs($spec)

# Enable NIOC

$myvDS.ExtensionData.EnableNetworkResourceManagement($true)


# Refetch our object to pick up current configuration

$myvDS = Get-VDSwitch $myvDS

View solution in original post

LucD
Leadership
Leadership

That looks good.

The methods with _Task at the end go to the same method, but they will run the method in the background (like with the RunAsync switch on the PowerCLI cmdlets).

The colored syntax is done through an ISE add-on, see 5.  Re: How to Display Information About FileName of a Disk?


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

Scissor
Virtuoso
Virtuoso

Thanks for the reply and the info about the syntax highlighting!

Instead of re-running Get-VDSwitch, is there a more efficient way to update the .ExtensionData of my $myvDS variable after running .ExtensionData.ReconfigureDvs()?    I tried $myvDS.ExtensionData.UpdateViewData() but it didn't seem to do anything.

0 Kudos
LucD
Leadership
Leadership

That should work afaik.

Did you check the value in $myvDS.ExtensionData.Config.ConfigVersion ?

That should have changed after the method call.


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

0 Kudos
Scissor
Virtuoso
Virtuoso

You were correct, the value of $myvDS.ExtensionData.Config.ConfigVersion did increase after the method call.

0 Kudos