VMware Cloud Community
jarushepic
Enthusiast
Enthusiast

VcHostFibreChannelHba.device doesn't reflect what is seen in vCenter

I'm writing some workflows to take care of automatic zoning using the Cisco MDS REST API.  As part of that I need to be able to identify ESXi host HBAs on the SAN fabric.  Today, we create device aliases based on the name of the HBA in vCenter.  For example, if I have a host called tstdev-hb2-0004 and it shows HBAs vmhba0, vmhba1, vmhba2, vmhba3, my aliases would be:

tstdev-hb2-0004-vmhba0

tstdev-hb2-0004-vmhba1

tstdev-hb2-0004-vmhba2

tstdev-hb2-0004-vmhba3

When I run this code:

for each (var hba in u_host.configManager.storageSystem.storageDeviceInfo.hostBusAdapter)

  if (hba instanceof VcHostFibreChannelHba)

  {

  System.log(hba.device);

  }

}

I expect:

vmhba0

vmhba1

vmhba2

vmhba3

(which is what is displayed in vCenter)

But what I get back is:

vmhba1

vmhba2

vmhba3

vmhba4

How can I get the display names as displayed in vCenter?

0 Kudos
2 Replies
jarushepic
Enthusiast
Enthusiast

Interestingly, this code:

for each (var hba in u_host.configManager.storageSystem.storageDeviceInfo.hostBusAdapter)

  System.log('Device Name: ' + hba.device);

  System.log('Device Type: ' + hba.driver);

  if (hba instanceof VcHostFibreChannelHba)

  {

  System.log('FC HBA: ' + hba.device);

  }

}

Produces this:

[2017-05-02 14:58:17.973] [I] Device Name: vmhba0

[2017-05-02 14:58:17.975] [I] Device Type: megaraid_sas

[2017-05-02 14:58:17.976] [I] Device Name: vmhba1

[2017-05-02 14:58:17.977] [I] Device Type: fnic

[2017-05-02 14:58:17.978] [I] FC HBA: vmhba1

[2017-05-02 14:58:17.979] [I] Device Name: vmhba2

[2017-05-02 14:58:17.980] [I] Device Type: fnic

[2017-05-02 14:58:17.981] [I] FC HBA: vmhba2

[2017-05-02 14:58:17.982] [I] Device Name: vmhba3

[2017-05-02 14:58:17.983] [I] Device Type: fnic

[2017-05-02 14:58:17.984] [I] FC HBA: vmhba3

[2017-05-02 14:58:17.986] [I] Device Name: vmhba4

[2017-05-02 14:58:17.987] [I] Device Type: fnic

[2017-05-02 14:58:17.988] [I] FC HBA: vmhba4

[2017-05-02 14:58:17.989] [I] Device Name: vmhba32

[2017-05-02 14:58:17.990] [I] Device Type: usb-storage

In vCenter, I don't see an HBA of type megaraid sas.

0 Kudos
bulatkaz
Contributor
Contributor

What the following command return, if you run it directly from ESXi server console?

     esxcfg-scsidevs -a

0 Kudos