dwchan
Enthusiast
Enthusiast

ISCSI binding

I have DV switch with 5 portgroups.  Of the 5 portgroups, three of them has a VM Kernel port

1 - Management - vmk0 (set to management)
2 - vMotion - vmk1 (set to vMotion)
3 -  VM - no kernel port
4 - iSCSI - vmk2 (set to nothing)
5 - Trunk - no kernel port

I am trying to bind the vmk2 to my software iSCSI HBA with the following

$hba = Get-VMHostHba -Type iScsi | Where {$_.Model -eq "iSCSI Software Adapter"}
$vmkSCSI = $vmhost | Get-VMHostNetworkAdapter -VMKernel | where {$_.PortGroupName -cmatch 'iSCSI Network'} | select Devicename
$esxcli = Get-EsxCli -V2 -VMHost $vmhost
$esxcli.iscsi.networkportal.add.CreateArgs()
$bind = @{
adapter = $hba.Device
force = $false
nic = $vmkSCSI.DeviceName
}
$esxcli.iscsi.networkportal.add.Invoke($bind)

Upon execution, I got the following error, and not sure exactly what I am missing

PS C:\Users\cdominic> $esxcli.iscsi.networkportal.add.Invoke($bind)
Message: EsxCLI.CLIFault.summary;
InnerText: Unable to bind iscsi port. [force = 0]
iScsiException: status(c0000000): Invalid parameter; Message= IMA_VMW_AddNicEsxCLI.CLIFault.summary
At line:1 char:1
+ $esxcli.iscsi.networkportal.add.Invoke($bind)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault

Just to be safe, I explicitly add in the values manually and gotten the same error

$bind = @{
adapter = 'vmhba64'
force = $false
nic = 'vmk2'
}

When I try to do it through the GUI, I notices that I don't have the option to pick vmk2 from the GUI either.  What am I missing?

dwchan_0-1614478520101.png

 

0 Kudos
4 Replies
DARKINF
Enthusiast
Enthusiast

Hi.

You need to check teaming policy on the PG, that is bind to vmk. Make only one physical nic active for one vmk.

 

You can read more - https://kb.vmware.com/s/article/2045040

dwchan
Enthusiast
Enthusiast

Not sure if this is related to policy, but by change the parameter from 

$bind = @{
adapter = $hba.Device
force = $false
nic = $vmkSCSI.DeviceName
}

to 

$bind = @{
adapter = $hba.Device
force = $true
nic = $vmkSCSI.DeviceName
}

Seem to resolve the problem.  Have to give it more test

0 Kudos
LucD
Leadership
Leadership

The remark from @DARKINF is correct, although that KB is not very explicit in which "default" policy is causing the issue.

A partial, better explanation is found in Bind iSCSI and VMkernel Adapters, more specifically the line "Create a virtual VMkernel adapter for each physical network adapter on your host"
If you want to use a Switch that has Teaming, make sure to have only 1 pNIC Active and all the others in Standby for every vmkernel that you want to bind to iSCSI.

The Force parameter on the esxcli command ignores that setup issue.


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

dwchan
Enthusiast
Enthusiast

Good read and that did the trick 😉

0 Kudos