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 640340 - [RFE] Meaningful error codes from the iscsiadm utility
Summary: [RFE] Meaningful error codes from the iscsiadm utility
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: iscsi-initiator-utils
Version: 6.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Andy Grover
QA Contact: Gris Ge
URL:
Whiteboard:
Depends On:
Blocks: 595443 655920
TreeView+ depends on / blocked
 
Reported: 2010-10-05 15:31 UTC by Saggi Mizrahi
Modified: 2015-09-28 02:32 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
When iscsiadm failed or exited incorrectly, it did not output useful error codes. Meaningful error codes now exist for these situations, and are described further in the iscsiadm man page.
Clone Of:
Environment:
Last Closed: 2011-05-19 14:14:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0733 0 normal SHIPPED_LIVE iscsi-initiator-utils bug fix and enhancement update 2011-05-19 09:47:49 UTC

Description Saggi Mizrahi 2010-10-05 15:31:51 UTC
Description of problem:
We would like to be able to differentiate between these error by the resulting error code from the command.

* no records found
* CHAP log-in issues
* record already found

Other distinctive errors will also be greatly appreciated.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 3 Mike Christie 2011-02-01 08:46:44 UTC
This is fixed in iscsi-initiator-utils-6.2.0.872-14.el6. You can download it here
http://people.redhat.com/mchristi/iscsi/rhel6.1/iscsi-initiator-utils/

See the iscsiadm man page's EXIT STATUS section for info on the error codes.

Comment 5 Gris Ge 2011-03-04 07:02:27 UTC
Mike,
Do you have any code for testing all of these error?
If not, I will try to create one.

Comment 6 Mike Christie 2011-03-08 21:27:14 UTC
No code. Sorry.

If you can create a script where it runs iscsiadm then checks the return code for operations, I will integrate it into open-iscsi upstream. Then I can also run it when merging patches and before even making a rpm for you to test. So it should help you out.

Comment 7 Gris Ge 2011-03-10 10:50:57 UTC
(In reply to comment #6)
> If you can create a script where it runs iscsiadm then checks the return code
> for operations, I will integrate it into open-iscsi upstream. Then I can also
> run it when merging patches and before even making a rpm for you to test. So it
> should help you out.

It will take some for finishing this tool.

When I am reviewing the code and try to hit the error code, I found a typo in the code of 6.2.0.872:
usr/iscsi_err.c 

47c47
<       /* 22 */ "sysfs lookup failure",
---
>       /* 23 */ "sysfs lookup failure",

It's just a comment and you might change it for next respin.

Q1:
For ISCSI_ERR_SESS_NOT_FOUND error, any hit for hit it?
I tryed this command: iscsiadm -m session -r 99
But got $? 22 ISCSI_ERR_SYSFS_LOOKUP instead of 4 ISCSI_ERR_SESS_NOT_FOUND

Q2: 
For ISCSI_ERR_LOGIN error, I try to use iptables to DROP package to 3260 port.
'iscsiadm -m node -l' will goes into a infinite sleep and waiting for iscsid to return.
If I Ctrl-C, iscsid still there and waiting for package which cause iscsiadm login failed with 15 - session exists.
Do you think this is bug, if so I will file a new one for it.

Comment 8 Mike Christie 2011-03-10 22:44:06 UTC
(In reply to comment #7)
> <       /* 22 */ "sysfs lookup failure",
> ---
> >       /* 23 */ "sysfs lookup failure",
> 
> It's just a comment and you might change it for next respin.
> 

Thanks. Fixed upstream. Will bring in fix in next respin.

> Q1:
> For ISCSI_ERR_SESS_NOT_FOUND error, any hit for hit it?
> I tryed this command: iscsiadm -m session -r 99
> But got $? 22 ISCSI_ERR_SYSFS_LOOKUP instead of 4 ISCSI_ERR_SESS_NOT_FOUND

Ah yeah, ISCSI_ERR_SYSFS_LOOKUP makes sense from a devel perspective. The sysfs code could not find the session so that is why you get the error. From a user perspective ISCSI_ERR_SESS_NOT_FOUND makes a lot more sense. Will fix that on the next respin.

I do not think there is a easy way to hit ISCSI_ERR_SESS_NOT_FOUND(2). It only occurs during races where if you were to run iscsiadm twice and both instances where going to logout the same session. If you can get the timing right iscsid would return ISCSI_ERR_SESS_NOT_FOUND. If once iscsiadm instance completely logs out a session and cleans up sysfs before the other iscsiadm could read the sysfs info, then the other iscsiadm instance would get ISCSI_ERR_SYSFS_LOOKUP.



> 
> Q2: 
> For ISCSI_ERR_LOGIN error, I try to use iptables to DROP package to 3260 port.
> 'iscsiadm -m node -l' will goes into a infinite sleep and waiting for iscsid to
> return.

Is it infinite or just a long time? The default wait time is a couple minutes.

If you set node.conn[0].timeo.login_timeout to 10 and node.session.initial_login_retry_max to 0, then it should be really quick.


If it is not real quick with those settings. It is a bug. Make me a bz and I will fix it. Could you also run iscsid by hand if it is a bug. Do

iscsid -d 7 -f &


and send me all the log output that gets printed.



> If I Ctrl-C, iscsid still there and waiting for package which cause iscsiadm
> login failed with 15 - session exists.

Do you mean when you do Ctrl-C then when iscsiadm returns it returns with 15? I tried it here and got 1, which is expected (1 is just a generic error).

Or do you mean you did Ctrl-C then when you reran iscsiadm it returned 15? This is sort of expected. Ctrl-C will kill iscsiadm, but iscsid is still executing the operation, so it sort of still exists in iscsid. If this is what you are hitting I will make a bugzilla. I will try to fix it. It is not a simple change is the reason it has not got fixed yet.

Comment 9 Gris Ge 2011-03-11 06:45:07 UTC
(In reply to comment #8)
Is it infinite or just a long time? The default wait time is a couple minutes.

Yes. By default, it's 120s for timeout. It quit as error 8. My fault.

As I have tested most of the return code. I would like to VERIFY this bug with rhts tag.

Storage-qe are out of capacity of RHEL6.1 and RHEL 5.7 testing, for this exit status script, we will try out best to finished it.

Comment 10 Laura Bailey 2011-05-12 07:13:19 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:
When iscsiadm failed or exited incorrectly, it did not output useful error codes. Meaningful error codes now exist for these situations, and are described further in the iscsiadm man page.

Comment 11 errata-xmlrpc 2011-05-19 14:14:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0733.html


Note You need to log in before you can comment on or make changes to this bug.