atmvm
Contributor
Contributor

How to get only iscsi software adapter from ESXi host using Java ( Even if multi-function NICs are attached to ESXI host)

Hi ,

I was trying to get the iscsi software adapter from ESXi host using VIJAVA library. Here I am using HostInternetScsiHba.isIsSoftwareBased() api to get only iscsi software adapter.

     Following  is the high level code snap :

         

          HostStorageDeviceInfo storageDevice = host.getConfig().getStorageDevice();

          if(storageDevice.isSoftwareInternetScsiEnabled()) {

                        HostHostBusAdapter[] adapters = storageDevice.getHostBusAdapter();

                        if (adapters != null) {

                            for (HostHostBusAdapter adapter : adapters) {

                                if (adapter instanceof HostInternetScsiHba) {

                                    HostInternetScsiHba scsiAdapter = (HostInternetScsiHba) adapter;

                                    if(scsiAdapter.isIsSoftwareBased()) {

                                       //Adapter is software based.

                                    }

                                }

                            }

                        }

                    }

       

Now when I attached the multi-function NICs ( Lets say NIC from Vendor "ABCD")  the JAVA code is giving two iscsi software adapter .But I just want to get the default iscsi software adapter.


It would be helpful if some guide how to get the default iscsi software adapter only using Java code from ESxi host.



Thanks in Advance.





Tags (1)
0 Kudos
0 Replies