VMware: Using ESXCLI to Troubleshoot iSCSI Issues
There are a number of iSCSI related esxcli commands, all accessed using the ‘esxcli iscsi’ namespace:
# esxcli iscsi Usage: esxcli iscsi {cmd} [cmd options] Available Namespaces: adapter Operations that can be performed on iSCSI adapters networkportal Operations that can be performed on iSCSI Network Portal (iSCSI vmknic) physicalnetworkportal Operations that can be performed on iSCSI Physical Network Portal (vmnic) session Operations that can be performed on iSCSI sessions ibftboot Operations that can be performed on iSCSI IBFT boot table logicalnetworkportal Operations that can be performed on iSCSI Logical Network Portal (vmknic) plugin Operations that can be performed on iSCSI management plugins software Operations that can be performed on software iSCSI
Looking at the host’s iSCSI adapters:
# esxcli iscsi adapter list Adapter Driver State UID Description ------- --------- ------ ---------------------------------------------- ---------------------------- vmhba3 qla4xxx online iqn.2000-04.com.qlogic:qle4060c.yk10ny96t57v.1 4032 Family iSCSI Controller vmhba35 iscsi_vmk online iqn.1998-01.com.vmware:xvm1-mgt-1a8f4e4d iSCSI Software Adapter
It’s clear from the output that this host is using the iSCSI Software Adapter and a Hardware controller. To display more information on a given adapter you can run:
# esxcli iscsi adapter get --adapter vmhba3 vmhba3 Name: iqn.2000-04.com.qlogic:qle4060c.yk10ny96t57v.1 Alias: xvm1 Vendor: QLOGIC Model: QLE4060C Description: 4032 Family iSCSI Controller Serial Number: YK10NY96T57V Hardware Version: QLE4060C Asic Version: 0 Firmware Version: 3.0.1.49 Option Rom Version: 1.0.0.0 Driver Name: qla4010.o Driver Version: 624-01-43 TCP Protocol Supported: true Bidirectional Transfers Supported: true Maximum Cdb Length: 0 Can Be NIC: false Is NIC: false Is Initiator: true Is Target: false Using TCP Offload Engine: true Using ISCSI Offload Engine: true
As this is a hardware adapter, some of the fields will display additional information such as details on Firmware and Driver versions etc. You can use the ‘set’ option to change the name and alias of the adapter. For example:
# esxcli iscsi adapter set --adapter vmhba3 --alias HardwareAdapter
There are a number of other namespaces relating to the iSCSI adapter:
# esxcli iscsi adapter Usage: esxcli iscsi adapter {cmd} [cmd options] Available Namespaces: auth Operations that can be performed on iSCSI adapter authentications discovery Operations that can be performed on iSCSI adapter discovery target Operations that can be performed on iSCSI targets capabilities Operations that can be performed on iSCSI adapter capabilities firmware Operations that can be performed on iSCSI adapter firmware param Operations that can be performed on iSCSI adapter parameters
In relation to troubleshooting its worth paying attention to the ‘auth’, ‘discovery’ and ‘target’ namespaces in particular. You can list the chap settings with:
# esxcli iscsi adapter auth chap get -A vmhba3 Direction: uni Name: Level: prohibited
To list the configured iSCSI targets you can run:
# esxcli iscsi adapter target list Adapter Target Alias Discovery Method Last Error ------- --------------------------------------- ----- ---------------- ---------- vmhba35 iqn.1996-04.com.bosch:raid.sn7445666.00 SENDTARGETS No Error vmhba35 iqn.1996-04.com.bosch:raid.sn7445666.10 SENDTARGETS No Error vmhba3 iqn.1996-04.com.bosch:raid.sn7445666.00 SENDTARGETS na vmhba3 iqn.1996-04.com.bosch:raid.sn7445666.10 SENDTARGETS na
To list the iSCSI targets with IP and port, run this:
# esxcli iscsi adapter target portal list Adapter Target IP Port Tpgt ------- --------------------------------------- ----------- ---- ---- vmhba35 iqn.1996-04.com.bosch:raid.sn7445666.00 192.168.3.3 3260 1 vmhba35 iqn.1996-04.com.bosch:raid.sn7445666.10 192.168.3.4 3260 1 vmhba3 iqn.1996-04.com.bosch:raid.sn7445666.00 192.168.3.3 3260 1 vmhba3 iqn.1996-04.com.bosch:raid.sn7445666.10 192.168.3.4 3260 1
Moving away from the adapter related commands, a useful command for troubleshooting is the ‘sessions’ namespace. This will output established sessions to the host’s configured targets. For example:
# esxcli iscsi session list vmhba35,iqn.1996-04.com.bosch:raid.sn7445666.00,00023d000001 Adapter: vmhba35 Target: iqn.1996-04.com.bosch:raid.sn7445666.00 ISID: 00023d000001 TargetPortalGroupTag: 1 AuthenticationMethod: none DataPduInOrder: true DataSequenceInOrder: true DefaultTime2Retain: 0 DefaultTime2Wait: 0 ErrorRecoveryLevel: 0 FirstBurstLength: 65536 ImmediateData: true InitialR2T: false MaxBurstLength: 262144 MaxConnections: 1 MaxOutstandingR2T: 1 TSIH: 256 vmhba35,iqn.1996-04.com.bosch:raid.sn7445666.10,00023d000001 Adapter: vmhba35 Target: iqn.1996-04.com.bosch:raid.sn7445666.10 ISID: 00023d000001 TargetPortalGroupTag: 1 AuthenticationMethod: none DataPduInOrder: true DataSequenceInOrder: true DefaultTime2Retain: 0 DefaultTime2Wait: 0 ErrorRecoveryLevel: 0 FirstBurstLength: 65536 ImmediateData: true InitialR2T: false MaxBurstLength: 262144 MaxConnections: 1 MaxOutstandingR2T: 1 TSIH: 512 vmhba3,iqn.1996-04.com.bosch:raid.sn7445666.00,00c0dd113f21 Adapter: vmhba3 Target: iqn.1996-04.com.bosch:raid.sn7445666.00 ISID: 00c0dd113f21 TargetPortalGroupTag: 1 AuthenticationMethod: none DataPduInOrder: true DataSequenceInOrder: true DefaultTime2Retain: 0 DefaultTime2Wait: 2 ErrorRecoveryLevel: 0 FirstBurstLength: 128 ImmediateData: true InitialR2T: false MaxBurstLength: 512 MaxConnections: 1 MaxOutstandingR2T: 1 TSIH: 0 vmhba3,iqn.1996-04.com.bosch:raid.sn7445666.10,00c0dd113f21 Adapter: vmhba3 Target: iqn.1996-04.com.bosch:raid.sn7445666.10 ISID: 00c0dd113f21 TargetPortalGroupTag: 1 AuthenticationMethod: none DataPduInOrder: true DataSequenceInOrder: true DefaultTime2Retain: 0 DefaultTime2Wait: 2 ErrorRecoveryLevel: 0 FirstBurstLength: 128 ImmediateData: true InitialR2T: false MaxBurstLength: 512 MaxConnections: 1 MaxOutstandingR2T: 1 TSIH: 0
Finally, you can view the network settings/vmk used by iSCSI on the host by running:
# esxcli iscsi networkportal list vmhba35 Adapter: vmhba35 Vmknic: vmk2 MAC Address: 5c:f3:fc:4d:e7:24 MAC Address Valid: true IPv4: 192.168.3.104 IPv4 Subnet Mask: 255.255.255.0 IPv6: MTU: 9000 Vlan Supported: true Vlan ID: 0 Reserved Ports: 63488~65536 TOE: false TSO: true TCP Checksum: false Link Up: true Current Speed: 1000 Rx Packets: 79643 Tx Packets: 87410 NIC Driver: bnx2 NIC Driver Version: 2.2.1l.v50.1 NIC Firmware Version: bc 5.2.3 NCSI 2.0.10 Compliant Status: compliant NonCompliant Message: NonCompliant Remedy: Vswitch: vSwitch0 PortGroup: iSCSI VswitchUuid: PortGroupKey: PortKey: Duplex: Path Status: unused