[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
Mon Aug 1 19:44:58 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 c2356c2f91d9652476c02a28477542e933d42737
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 1d5bf90..70697dc 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -246,6 +246,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')
 
@@ -472,7 +473,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 1496bbc..8067189 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -913,6 +913,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