VMware {code} Community
satishh
Contributor
Contributor

How to get the iscsi initiator name(iqn) of esx using vsphere sdk

Hi,

I want to get the iscsi initiator name of esx using SDK. I am unable to find the required data object type from managad object type for the same in API reference guide.

what is the exact managed object type and data object type to get this information ?

Thanks in advance,

Satish.

0 Kudos
5 Replies
lamw
Community Manager
Community Manager

To retrieve the IQN of an iSCSI initiator, you'll need to use the hostStorageSystem and select storageDeviceInfo and iterate through the [hostBusAdapter|http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.StorageDeviceInfo.html#field_detail and look for HBA's that are of type HostInternetScsiHba and you'll find a property called iScsiName which contains the value you're looking for. Tools like the MOB (Managed Object Browser) is great for things like this where you know the value you're trying to find, but aren't sure where within the various data objects to look at

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
satishh
Contributor
Contributor

Hi William,

Thanks for the reply.

I browsed MOB as you said hostStorageSystem -> HostStorageDeviceInfo -> HostScsiTopology ->[HostScsiTopologyInterface[] -> |http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.ScsiTopology.Interface.html][HostScsiTopologyTarget[]|http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.ScsiTopology.Target.html]

But i dont find the required information. It will just take me to target infomation. I need the ISCSI initiator of ESX server.

Please can you point me to exact hierarchy in MOB to get ISCSI initiator name.

Thanks,

Satish

0 Kudos
stumpr
Virtuoso
Virtuoso

HostInternetScsiHba has what you're looking for. You'll have to enumerate the hostBusAdapter property array and test each device to find your HostInternetScsiHba adapters.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
lamw
Community Manager
Community Manager

If you take a look at my initial reply, it says you need to traverse to the hostBusAdapter property array and look for type HostInternertScsiHba.

You're looking at the target which is incorrect. To path using the MOB is the following:

HostSystem->configManager->storageSystem->storageDeviceInfo->hostBusAdapter->

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
satishh
Contributor
Contributor

Thanks for the replies,

Got it working .

Thanks,

Satish.

0 Kudos