VMware Cloud Community
mike_caddy
Enthusiast
Enthusiast

Configuring iSCSI Multipathing

I've just begun my first attempt at automating some changes with PowerCLI, however I fear the task I have picked may be too dificult!

I've Conneceted to Virtual center selected the host to upgrade

added a new vSwicth with a mtu of 9000

assigned two pNICs

Added six Vmkports to the new vSwitch

Configured the NIC teaming policy to asign NICs half and half to to the Vmkports

and now I'm stuck!!

I now need to assign the vmkernel ports to the iSCSI software Adaptor

Something like the RCLI command "esxcli swiscsi nic add -n vmk1 -d vmhba33"

Also in the RCLI you would need to set the MTU of the vmknic but I didn't get this option when I run New-VMHostNetworkAdapter, will it inherit the jumbo frames setting from the parent vSwitch?

Reply
0 Kudos
14 Replies
LucD
Leadership
Leadership

Have a look at .

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

Why would I want to do that?

I don't want vMotion traffic running over my iSCSI network

Reply
0 Kudos
LucD
Leadership
Leadership

Of course not, so you set that parameter to $false and the FT logging parameter as well.

That's not really required since these two parameters do not have a default value but I find it useful to mention this explicitly (as kind of documentation).

$vmKernel = Get-VMHostNetworkAdapter -VMHost <your_host> -VMKernel | where {$_.DeviceName -eq "&lt;name_of_network_adapter&gt;"}
$vmKernel | Set-VMHostNetworkAdapter -VMotionEnabled $false -FaultToleranceLoggingEnabled $false

If there is no VMkernel portgroup yet or if you want to define a new VMkernel portgroup, you should of course use the New-VMHostNetworkAdapter cmdlet. And then you don't need the Set-VMHostNetworkAdapter cmdlet

New-VMHostNetworkAdapter -VMHost <your-host> -ConsoleNic:$false -IP <IP-address> -VirtualSwitch <your-vSwitch> -SubnetMask <your-subnet
mask> -VMotionEnabled $false -FaultToleranceLoggingEnabled $false

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

Fair enough,

I didn't think this was necessary as the FT and VMotion settings all default to disabled.

I'd rather not add additional complexity when it's not really required.

Any chance you can help with my actual questions?

TIA

Mike

Reply
0 Kudos
LucD
Leadership
Leadership

Is what you are trying to do similar to what is described in vSphere 4.0 with Software iSCSI and 2 Paths ?

If yes, then I'm afraid this will require some SDK methods but it should be possible.

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

That is exaclty what I'm doing, however I'm following a Dell Equallogic Best practice guide which recomends 6 vmk Ports and two Physical Nics.

How do I call the SDK methods? can this be done from PowerCli?

Reply
0 Kudos
LucD
Leadership
Leadership

The SDK methods can be used from PowerCLI without a problem.

Have a look at some of my blog posts on how to do that.

I'm tackling the script right now.

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
gzulauf
Contributor
Contributor

Mike-

I'm running into the same problem you are having. There is no out-of-box PowerCLI command to bind VMkernel ports to an iSCSI software hba.

The EqualLogic document spells out how to do it from the ESX command line or the vMA. But when using ESXi, the only choice is the vMA.

This is very frustrating because it forces us to use more than one script to build a newly genereated ESXi server; a PowerCLI one and a seperate vMA one.

I recently posted a question regarding a command called Set-VMHostiHba. I suspect this command will be included in an update to the PowerCLI environment and allow the binding of VMkernel ports to vmhba's.

There's probably a way to set this option via the SDK, but someone with more experience would need to investigate this.

VMware, are you listening? Smiley Happy

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

In the spirit of sharing, this is how far I've got

$HostName = 'esx-3.my.org'

$FirstNic = 'vmnic5'

$SecondNic = 'vmnic1'

$vmkIP1 = '172.31.11.103'

$vmkIP2 = '172.31.12.103'

$vmkIP3 = '172.31.13.103'

$vmkIP4 = '172.31.14.103'

$vmkIP5 = '172.31.15.103'

$vmkIP6 = '172.31.16.103'

Connect-VIServer -Server 'vSphere1.my.org'

$BaseHost = Get-VMHost -Name $HostName

$NewSwitch = ($BaseHost | New-VirtualSwitch -Mtu 9000 -Name vSwitch-iSCSI -Nic $FirstNic,$SecondNic)

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI1

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI2

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI3

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI4

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI5

New-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI6

#Add six new VMKnics with a mtu of 9000

#must use API calls as New-VMHostNetworkAdaptor is unable to set the MTU

$netSys = Get-View ($BaseHost| Get-View).configManager.networkSystem

$spec = New-Object "VMware.Vim.HostVirtualNicSpec"

$spec.Ip = New-Object "VMware.Vim.HostIpConfig"

$spec.mtu = 9000

$spec.Ip.SubnetMask = "255.255.128.0"

$spec.TsoEnabled = $true

$spec.Ip.IpAddress = $vmkIP1

$spec.Portgroup ="iSCSI1"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

$spec.Ip.IpAddress = $vmkIP2

$spec.Portgroup ="iSCSI2"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

$spec.Ip.IpAddress = $vmkIP3

$spec.Portgroup ="iSCSI3"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

$spec.Ip.IpAddress = $vmkIP4

$spec.Portgroup ="iSCSI4"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

$spec.Ip.IpAddress = $vmkIP5

$spec.Portgroup ="iSCSI5"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

$spec.Ip.IpAddress = $vmkIP6

$spec.Portgroup ="iSCSI6"

$netSys.AddVirtualNic($spec.PortGroup,$spec)

##Configure The NicTeaming Policy

$iSCSI1PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI1 | Get-NicTeamingPolicy

$iSCSI2PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI2 | Get-NicTeamingPolicy

$iSCSI3PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI3 | Get-NicTeamingPolicy

$iSCSI4PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI4 | Get-NicTeamingPolicy

$iSCSI5PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI5 | Get-NicTeamingPolicy

$iSCSI6PortGroup = $BaseHost | Get-VirtualPortGroup -VirtualSwitch $NewSwitch -Name iSCSI6 | Get-NicTeamingPolicy

#Reset the Nic Team Policy

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI1PortGroup -MakeNicUnused $FirstNic,$SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI2PortGroup -MakeNicUnused $FirstNic,$SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI3PortGroup -MakeNicUnused $FirstNic,$SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI4PortGroup -MakeNicUnused $FirstNic,$SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI5PortGroup -MakeNicUnused $FirstNic,$SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI6PortGroup -MakeNicUnused $FirstNic,$SecondNic

#Bind each PortGroup to alternate IPs

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI1PortGroup -MakeNicActive $FirstNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI2PortGroup -MakeNicActive $SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI3PortGroup -MakeNicActive $FirstNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI4PortGroup -MakeNicActive $SecondNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI5PortGroup -MakeNicActive $FirstNic

Set-NicTeamingPolicy -VirtualPortGroup $iSCSI6PortGroup -MakeNicActive $SecondNic

Disconnect-VIServer -Server 'vSphere1.my.org' -Confirm:$false

Reply
0 Kudos
LucD
Leadership
Leadership

And does it work ?

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

I've got all the way up to the equivalent of "esxcli swiscsi nic add -n vmk1 -d vmhba33" so no further forward, other than I now know how to create a VMKnic with a mtu of 9000 from powershell. I've also written the bit that needs to follow the above command (for my EQUALLOGIC SAN at least)

$EqlScsiLuns = $BaseHost | Get-ScsiLun | where {$_.Vendor -match "EQLOGIC"}

foreach ($EqlScsiLun in $EqlScsiLuns) { Set-ScsiLun -ScsiLun $EqlScsiLun -MultipathPolicy RoundRobin }

I now also need to set the default to RoundRobin for all new Luns, a API/PowerShell equivalent to "esxcli nmp satp setdefaultpsp --psp VMW_PSP_RR --satp VMW_SATP_EQL"

in summary I'm looking for the API Calls for equivalent to the following two commands

esxcli nmp satp setdefaultpsp --psp VMW_PSP_RR --satp VMW_SATP_EQL

esxcli swiscsi nic add -n vmk1 -d vmhba33

Reply
0 Kudos
gzulauf
Contributor
Contributor

Mike-

Many thanks for the load balancing command.

Just one small bug. When I copy/paste from the forum posting, there is a space showing up between the "_" and "." characters in the following portion:

{$_ .Vendor

Thanks again for the help.

Reply
0 Kudos
mike_caddy
Enthusiast
Enthusiast

Yea, bit of keyboard trouble, I've updated the original post

Reply
0 Kudos
alasdair_carnie
Enthusiast
Enthusiast

Has anyone cracked this? I'm in the same position of trying to enable round robin for access to our new NS-120. I've created all the vSwitches and VMK ports, but now need the PS equivelent of the esxcli commands.

Reply
0 Kudos