Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 796574

Summary: iscsiadm does not support hostname with port
Product: Red Hat Enterprise Linux 6 Reporter: Bruno Goncalves <bgoncalv>
Component: iscsi-initiator-utilsAssignee: Andy Grover <agrover>
Status: CLOSED ERRATA QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: coughlan, fge, fsimonce, mchristi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: iscsiadm did not parse the hostname and port properly when they were passed into discovery and login commands. Consequence: The login or discovery operation would fail, because iscsiadm would not be able to fine the record for the portal. Fix: The iscsiadm portal processing was modified to check for ports after hostnames. Result: Hostnames are now supported as portal arguments in iscsiadm.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 14:49:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bruno Goncalves 2012-02-23 08:38:46 UTC
Description of problem:
When trying to run discovery using hostname and port it does not work.
This problem seems to apply only to host definition on /etc/hosts. With DNS hostname it works fine.

Version-Release number of selected component (if applicable):
iscsi-initiator-utils-6.2.0.872-34.el6.x86_64

How reproducible:

100%

Steps to Reproduce:

1. install scsi-target-utils
2. service tgtd restart
3. tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.1994-05.com.redhat:tgtd-1
4. tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
5. Create disk for LUN: mktemp /tmp/disk.XXXXX
        dd if=/dev/zero of=/tmp/disk.XXXXX bs=1M count=0 seek=100
6. tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /tmp/disk.XXXXX

7.
iscsiadm -m discovery -t st -p "localhost:3260" -I default  -P1
iscsiadm: Cannot resolve host localhost:3260. getaddrinfo error: [Name or service not known]

iscsiadm: cannot resolve host name localhost:3260
iscsiadm: cannot resolve host name localhost:3260
iscsiadm: No portals found

---------------

For DNS hostname it works
iscsiadm -m discovery -t st -p "localhost.localdomain:3260" -I default  -P1
Target: iqn.1994-05.com.redhat:tgtd-1
	Portal: [::1]:3260,1
		Iface Name: default


Actual results:
Cannot resolve host

Expected results:
Discovery should work

Comment 2 Mike Christie 2012-03-08 00:19:55 UTC
*** Bug 800864 has been marked as a duplicate of this bug. ***

Comment 3 Mike Christie 2012-03-22 09:30:19 UTC
Fixed in iscsi-initiator-utils-6.2.0.872-37.el6.

Comment 5 Bruno Goncalves 2012-03-22 16:57:59 UTC
This bug has been fixed on iscsi-initiator-utils-6.2.0.872-37.el6.

--------
service tgtd restart
Stopping SCSI target daemon: not running                   [FAILED]
Starting SCSI target daemon:                               [  OK  ]

tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.1994-05.com.redhat:tgtd-1

tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

dd if=/dev/zero of=/tmp/disk.1 bs=1M count=0 seek=100
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.599e-05 s, 0.0 kB/s

tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /tmp/disk.1

iscsiadm -m discovery -t st -p "localhost:3260" -I default  -P1
Starting iscsid:                                           [  OK  ]
Target: iqn.1994-05.com.redhat:tgtd-1
        Portal: [::1]:3260,1
                Iface Name: default

iscsiadm -m node -l
Logging in to [iface: default, target: iqn.1994-05.com.redhat:tgtd-1, portal: ::1,3260] (multiple)
Login to [iface: default, target: iqn.1994-05.com.redhat:tgtd-1, portal: ::1,3260] successful.

Comment 6 Bruno Goncalves 2012-03-22 17:12:42 UTC
Looks like there was some regression using localhost IPV6 format (::1).

If add it [] ([::1]) works. 

----------

rpm -q iscsi-initiator-utils
iscsi-initiator-utils-6.2.0.872-36.el6.x86_64

iscsiadm -m discovery -t st -p "::1" -I default  -P1
Starting iscsid:                                           [  OK  ]
Target: iqn.1994-05.com.redhat:tgtd-1
        Portal: [::1]:3260,1
                Iface Name: default



rpm -q iscsi-initiator-utils
iscsi-initiator-utils-6.2.0.872-37.el6.x86_64

iscsiadm -m discovery -t st -p "::1" -I default  -P1
Starting iscsid:                                           [  OK  ]
iscsiadm: Cannot resolve host . getaddrinfo error: [Name or service not known]

iscsiadm: cannot resolve host name 
iscsiadm: cannot resolve host name 
iscsiadm: No portals found


iscsiadm -m discovery -t st -p "[::1]" -I default  -P1
Target: iqn.1994-05.com.redhat:tgtd-1
        Portal: [::1]:3260,1
                Iface Name: default

Comment 7 Mike Christie 2012-03-23 04:27:29 UTC
Fixed in iscsi-initiator-utils-6.2.0.872-38.el6.

Comment 8 Bruno Goncalves 2012-03-23 14:16:35 UTC
Everything is working now on iscsi-initiator-utils-6.2.0.872-38.el6.x86_64

rpm -q iscsi-initiator-utils
iscsi-initiator-utils-6.2.0.872-38.el6.x86_64

service tgtd restart
Stopping SCSI target daemon: not running                   [FAILED]
Starting SCSI target daemon:                               [  OK  ]

tgtadm --lld iscsi --op new --mode target --tid 1 -T
iqn.1994-05.com.redhat:tgtd-1

tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

dd if=/dev/zero of=/tmp/disk.1 bs=1M count=0 seek=100
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.599e-05 s, 0.0 kB/s

tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /tmp/disk.1

iscsiadm -m discovery -t st -p "::1" -I default  -P1
Starting iscsid:                                           [  OK  ]
Target: iqn.1994-05.com.redhat:tgtd-1
        Portal: [::1]:3260,1
                Iface Name: default

iscsiadm -m discovery -t st -p "localhost:3260" -I default  -P1
Starting iscsid:                                           [  OK  ]
Target: iqn.1994-05.com.redhat:tgtd-1
        Portal: [::1]:3260,1
                Iface Name: default

Comment 9 Mike Christie 2012-05-02 03:57:07 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: iscsiadm did not parse the hostname and port properly when they were passed into discovery and login commands.
Consequence: The login or discovery operation would fail, because iscsiadm would not be able to fine the record for the portal.
Fix: The iscsiadm portal processing was modified to check for ports after hostnames.
Result: Hostnames are now supported as portal arguments in iscsiadm.

Comment 10 errata-xmlrpc 2012-06-20 14:49:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0957.html