[NEW PATCH] BZ#726970 iscsiadm: Return an appropriate error code to ISCSI_ERR_LOGIN_AUTH_FAILED (via gerrit-bot)

David Naori dnaori at redhat.com
Wed Sep 7 13:18:12 UTC 2011


New patch submitted by David Naori (dnaori at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/772

commit e7f3e82ff9ad3f9c6db99c659367dd1ecfc5c9dc
Author: David Naori <dnaori at redhat.com>
Date:   Mon Aug 1 15:32:08 2011 -0400

    BZ#726970 iscsiadm: Return an appropriate error code to ISCSI_ERR_LOGIN_AUTH_FAILED
    
    Change-Id: I2fa16bad0661ff06470e00e62bce27d98ed01f84

diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index a9cda1b..3ab6aab 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -256,6 +256,7 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
 
 # iscsiadm exit statuses
 ISCSI_ERR_SESS_EXISTS = 15
+ISCSI_ERR_LOGIN_AUTH_FAILED = 24
 
 log = logging.getLogger('Storage.iScsi')
 
@@ -482,7 +483,9 @@ def addiSCSINode(ip, port, iqn, tpgt, initiator, username=None, password=None):
         # Finally instruct the iscsi initiator to login to the target
         cmd = cmdt + ["-l", "-p", portal]
         rc = misc.execCmd(cmd)[0]
-        if rc not in (0, ISCSI_ERR_SESS_EXISTS):
+        if rc == ISCSI_ERR_LOGIN_AUTH_FAILED:
+            raise se.iSCSILoginAuthError(portal)
+        elif rc not in (0, ISCSI_ERR_SESS_EXISTS):
             raise se.iSCSILoginError(portal)
 
     except se.StorageException:
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 8ebf340..0a0ab22 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -923,6 +923,9 @@ class iSCSIDiscoveryError(StorageServeriSCSIError):
     def __init__(self, portal, err):
         self.value = "portal=%s, err=%s" % (portal, err)
 
+class iSCSILoginAuthError(StorageServeriSCSIError):
+    code = 476
+    message = "Failed to login to iSCSI node due to authorization failure"
 #################################################
 #  LVM related Exceptions
 #################################################




More information about the vdsm-patches mailing list