Description of problem: This is probably a simple problem but I think one that will annoy a lot of customers and thus should be fixed. The LUNs listed via "iscsi-ls -l" come out in a non-intuitive order that is different from rhel3. Sample output: [root@ibmx325-rtp02 ~]# iscsi-ls -l ************************************************************************ ******* SFNet iSCSI Driver Version ...4:0.1.11(12-Jan-2005) ************************************************************************ ******* TARGET NAME : iqn.1992-08.com.netapp:sn.33611702 TARGET ALIAS : HOST ID : 2 BUS ID : 0 TARGET ID : 0 TARGET ADDRESS : 192.168.1.67:3260,2 SESSION STATUS : ESTABLISHED AT Fri Jul 15 09:21:35 EDT 2005 SESSION ID : ISID 00023d000001 TSIH 507 DEVICE DETAILS: --------------- LUN ID : 0 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46584f71 page80: 4f64472d4259797a46584f710a Device: /dev/sdb LUN ID : 1 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46584970 page80: 4f64472d4259797a465849700a Device: /dev/sdu LUN ID : 10 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46575033 page80: 4f64472d4259797a465750330a Device: /dev/sdl LUN ID : 11 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46573379 page80: 4f64472d4259797a465733790a Device: /dev/sdk LUN ID : 12 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4656772f page80: 4f64472d4259797a4656772f0a Device: /dev/sdj LUN ID : 13 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46567538 page80: 4f64472d4259797a465675380a Device: /dev/sdi LUN ID : 14 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4656725a page80: 4f64472d4259797a4656725a0a Device: /dev/sdh LUN ID : 15 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46567031 page80: 4f64472d4259797a465670310a Device: /dev/sdg LUN ID : 16 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46566d56 page80: 4f64472d4259797a46566d560a Device: /dev/sdf LUN ID : 17 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46566a4c page80: 4f64472d4259797a46566a4c0a Device: /dev/sde LUN ID : 18 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4656664e page80: 4f64472d4259797a4656664e0a Device: /dev/sdd LUN ID : 19 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4656534e page80: 4f64472d4259797a4656534e0a Device: /dev/sdc LUN ID : 2 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4658436b page80: 4f64472d4259797a4658436b0a Device: /dev/sdt LUN ID : 20 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c622f68 page80: 4f64472d4259797a4c622f680a Device: /dev/sdv LUN ID : 21 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c626932 page80: 4f64472d4259797a4c6269320a Device: /dev/sdw LUN ID : 22 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c626c69 page80: 4f64472d4259797a4c626c690a Device: /dev/sdx LUN ID : 23 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c627032 page80: 4f64472d4259797a4c6270320a Device: /dev/sdy LUN ID : 24 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c627436 page80: 4f64472d4259797a4c6274360a Device: /dev/sdz LUN ID : 25 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a4c633335 page80: 4f64472d4259797a4c6333350a Device: /dev/sdaa LUN ID : 3 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46583768 page80: 4f64472d4259797a465837680a Device: /dev/sds LUN ID : 4 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46583234 page80: 4f64472d4259797a465832340a Device: /dev/sdr LUN ID : 5 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46577046 page80: 4f64472d4259797a465770460a Device: /dev/sdq LUN ID : 6 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46576d2d page80: 4f64472d4259797a46576d2d0a Device: /dev/sdp LUN ID : 7 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46576a2d page80: 4f64472d4259797a46576a2d0a Device: /dev/sdo LUN ID : 8 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46576630 page80: 4f64472d4259797a465766300a Device: /dev/sdn LUN ID : 9 Vendor: NETAPP Model: LUN Rev: 0.2 Type: Direct-Access ANSI SCSI revision: 04 page83 type3: 60a980004f64472d4259797a46575a44 page80: 4f64472d4259797a46575a440a Device: /dev/sdm Version-Release number of selected component (if applicable): iscsi-initiator-utils-4.0.3.0-1 How reproducible: every time you run "iscsi-ls -l" Steps to Reproduce: See above Actual results: LUNs listed 0,1,11,12,13,...,19,2,20,... Expected results: LUNs listed 0,1,2,3,4...,19,20,... Additional info:
Not currently planning to change this for the initial release - may be something to look into for the next update.
Patch that fixes this problem. Mike, if you think this is ok, can you queue for next RHEL4 update? Thanks. # diff -Nurp /sbin/iscsi-ls /sbin/iscsi-ls.new --- /sbin/iscsi-ls 2005-07-05 15:18:14.000000000 -0400 +++ /sbin/iscsi-ls.new 2005-10-28 10:54:23.000000000 -0400 @@ -107,7 +107,7 @@ print_common_info() print_lun_info() { - luns=`ls -d $1/device/$2:0:0* 2> /dev/null` + luns=`ls -d $1/device/$2:0:0* | sort --field-separator=: --key=6 -n 2> /dev/null` echo "" echo "DEVICE DETAILS:" echo "---------------"
I can queue this.
Instead of the additional sort command, how about using the -v option with the ls command? I don't have a diff, but here's the gist of the change: - luns=`ls -d $1/device/$2:0:0* 2> /dev/null` + luns=`ls -dv $1/device/$2:0:0* 2> /dev/null` It should be slightly more efficient this way. Thanks, Dave Boone
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. Please See https://access.redhat.com/support/policy/updates/errata/ If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.