June 29, 2021

iSCSI adapter IQN changed after upgrading to ESXi 7.0 U2

Possible loss of iSCSI storage connectivity after upgrading from vSphere 7.0 Update 1 to Update 2. iSCSI adapter IQN changes after upgrade from vSphere 7.0 Update 1 to Update 2.

In some cases, with the upgrade from vSphere 7.0 Update 1 to Update 2, the iSCSI adapter IQN may change. This issue is specifically after an upgrade from vSphere 7.0 U1 to U2 where iSCSI was added while using Update 1. The issue can occur when the IQN is automatically generated and not user-defined, which is usually the case.  Also, if the iSCSI adapter was added before vSphere 7.0 Update 1, the issue doesn't seem to occur.

iSCSI adapter IQN example

 

The combination of these specific conditions is when the issue can occur.

  1. ESXi is a fresh install of version 7.0 U1 or a particular software/dependent iSCSI adapter was added in 7.0 U1 only
  2. The IQN of the iSCSI adapter is not set by the user but automatically generated by ESXi
  3. LUN access control is configured on the target side based on the generated IQN

 

To avoid the potential issue, you need to save/commit the IQN to the host's config store before doing an upgrade. If the IQN is not set, the iSCSI adapter IQN may change after the update and you may lose connectivity to your iSCSI storage. Consequently, you would need to reconfigure your LUN access with the newly generated iSCSI adapter IQN after the upgrade.

 

It is a fairly simple process to record/set IQN. Be aware this is a per-host process and must be completed on all hosts using dependant or SW iSCSI adapters. Prior to the upgrading from vSphere 7.0 Update 1 to Update 2, use esxcli get and set commands to save the generated iSCSI adapter IQN explicitly.

 

Get the IQN details:

$ esxcli iscsi adapter list 
vmhba67  Name: iqn.1998-01.com.vmware:w1-hs3-n2503.eng.vmware.com:452738760:67

Set the IQN details:

$ esxcli iscsi adapter set -A vmhba67 -n iqn.1998-01.com.vmware:w1-hs3-n2503.eng.vmware.com:452738760:67

 

Note: The vmhba## may be different on your host.

Once you’ve completed this process, the IQN will be included in the host config and won’t change after the upgrade.

 

Here is the KB iSCSI adapter IQN may change after an upgrade to ESXi 7.0 U2 (84339)

 

 

In a large environment, this can take quite a bit of time. Here are a few short PowerCLI scripts that set/record the current IQN for the iSCSI adapter.

 

As a precaution, make sure to test before running across your environment!

Get-VMHost |
ForEach-Object -Process {
    $HostHBA = $_ | Get-VMHostHba -Type iScsi | Select-Object Name,IScsiName
    $esxcli = get-esxcli -v2 -vmhost $_
    $CLIARG =  @{
        adapter = $HostHBA.Name
        name = $HostHBA.IScsiName
        skipifsessionactive = $false
        }
    $esxcli.iscsi.adapter.set.Invoke($CLIARG)
write-host "Setting host " $H  "adapter"  $HostHBA.Name "with IQN" $HostHBA.IScsiName
    }

 

If you want to run on a specific vSphere cluster, you can add -Location to Get-VMhost

IE: Get-VMHost -Location "Cluster_Name"

 

Another example complements of Jase McCarty:

Get-Cluster -Name "C1" | Get-VMhost | % { $esxcli=Get-EsxCli -VMhost $_ -V2;$vmhba=Get-VMHostHba -Host $_ -Type Iscsi;$esxcli.iscsi.adapter.set.invoke(@{adapter="$($vmhba.device)";name="$($vmhba.IscsiName)";skipifsessionactive=$false})}

 

 

Filter Tags

Storage ESXi 7 vSphere 7 iSCSI Blog Best Practice Tool Intermediate Manage Migrate