Utils for working with Host Bus Adapters.
detect_fc_hba();
Checks whether at least one Fibre Channel HBA port is registered in sysfs. Returns true/false.
my @hosts = list_scsi_hosts();
Lists the SCSI/SAS host adapters (initiators), via lsscsi -H -t (list hosts, not devices/LUNs, with transport info), as an array of hashes: - host: sysfs host name, e.g. host0 - driver: kernel driver bound to the host, e.g. ahci, virtio_scsi, qla2xxx - transport: raw transport string as reported by lsscsi, e.g. fc:0x50060b00741cc28e,0x0b1900, sata:, usb: 7-1:1.0; undef if lsscsi reports none.
Returns an empty list if none are found.
my @hosts = list_fc_hosts();
Lists the Fibre Channel host ports registered in sysfs (/sys/class/fc_host), as an array of hashes: - host: sysfs host name, e.g. host6 - port_state: link state, e.g. Online, Linkdown, Offline - port_type: topology, e.g. NPort (fabric via switch), NLPort (loop), Point-To-Point - speed: negotiated link speed, e.g. 16 Gbit
Returns an empty list if none are found.
check_fc_hosts();
Checks that at least one Fibre Channel port is Online, per list_fc_hosts(). Records a failure if none are found.
Returns the number of Online ports found.