Search code examples
linux-kerneliscsi

get iscsi ip from initiator name


In Linux how can I get iscsi target IP if I know the initiatorname either programmatically or by reading /sys filesystem. That is Without using iscsiadm or reading /etc/iscsi/node/* links. Thanks


Solution

  • Found it:

    initiator ip: /sys/class/scsi_host/$host/device/iscsi_host/${host}/ipaddress 
    target    ip: /sys/class/scsi_host/$host/device/session${s}/connection*/iscsi_connection/connection*/address
    

    where $host the scsi host name