How can i get the IQN of iScsi HBA?
How can i use the following object:
i have tried this:
var myVcHostInternetScsiHba = new VcHostInternetScsiHba() ;
iqn = VcHostInternetScsiHba.iScsiName;
But it does not work.
regards Denis
findiSCSIDevice() action returns the iSCSI device as a string, not as an object.
You can duplicate this action (let's say under a name findiSCSIName) and modify its scripting code by replacing the following line:
return busAdapter.device;
with
return busAdapter.iScsiName;
and then use it in your workflows/actions by something like
var hbaScsiName = System.getModule("com.vmware.library.vc.storage").findiSCSIName(host);
Hi Denis,
In general, you should not directly instantiate VcSomething objects (including VcHostInternetScsiHba) - their constructor usually does nothing so you'll get an empty, useless object. Instead, you should retrieve them by calling methods or reading a property of another objects.
Here is sample code that displays some info (including IQNs) of all host bus adapters available on a host:
// 'host' (of type VC:HostSystem) is the input parameter for this code snippet
for each (var hba in host.config.storageDevice.hostBusAdapter) {
if (hba instanceof VcHostInternetScsiHba) {
System.log("device: '" + hba.device + "' model: '" + hba.model + "' SCSI name: " + hba.iScsiName);
} else {
System.log("device: '" + hba.device + "' model: '" + hba.model + "' is not SCSI");
}
}
Hi Illian,
thank you very much.
I select the iScsi HBA with this command.
hba = System.getModule("com.vmware.library.vc.storage").findiSCSIDevice(host);
How can i get the IQN for this specified vmhba?
findiSCSIDevice() action returns the iSCSI device as a string, not as an object.
You can duplicate this action (let's say under a name findiSCSIName) and modify its scripting code by replacing the following line:
return busAdapter.device;
with
return busAdapter.iScsiName;
and then use it in your workflows/actions by something like
var hbaScsiName = System.getModule("com.vmware.library.vc.storage").findiSCSIName(host);