On Thursday, November 10, 2016 at 11:03:09 AM UTC-7, lvpriyana...@gmail.com wrote: > > i need C/C++ library/API at initiator side which can give me the iscsi > target details(iqn) when i pass the OS device name or scsi-channel-lun > details. > > for example input will be "/dev/sdc" or something like "scsi12 Channel 00 > Id 0 Lun: 0" and the output should be the corresponding target iqn . > > > > thanks in advance >
Such information is available in the system. Try running "iscsiadm -m session -P3". This prints out the block device for each session. For example: zsh> iscsiadm -m session -P3 | egrep 'iqn|disk' iscsiadm -m session -P3 | egrep 'iqn|disk' Target: iqn.2003-01.org.linux-iscsi.worklaptop.x8664:sn.36fa11d076f4 (non-flash) Iface Initiatorname: iqn.2005-03.org.open-iscsi:a02b9e9d4e52 Attached scsi disk sdb State: running I suspect you could get this information directly from sysfs yourself, if you want to figure out where it all resides. You can look in usr/iscsi_sysfs.c to see what iscsiadm does to print out this information. -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To post to this group, send email to open-iscsi@googlegroups.com. Visit this group at https://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.