Blame SOURCES/libstoragemgmt-0.0.22-ontap_ssl.patch

f144a8
diff --git lsm/lsm/na.py lsm/lsm/na.py
f144a8
index 06c74bc..44ceccc 100644
f144a8
--- lsm/lsm/na.py
f144a8
+++ lsm/lsm/na.py
f144a8
@@ -22,6 +22,7 @@ import time
f144a8
 from binascii import hexlify
f144a8
 
f144a8
 from M2Crypto import RC4
f144a8
+from _ssl import SSLError
f144a8
 
f144a8
 from external.xmltodict import ConvertXmlToDict
f144a8
 
f144a8
@@ -112,6 +113,16 @@ def netapp_filer(host, username, password, timeout, command, parameters=None,
f144a8
             raise e
f144a8
     except socket.timeout:
f144a8
         raise FilerError(Filer.ETIMEOUT, "Connection timeout")
f144a8
+    except SSLError as sse:
f144a8
+        # The ssl library doesn't give a good way to find specific reason.
f144a8
+        # We are doing a string contains which is not ideal, but other than
f144a8
+        # throwing a generic error in this case there isn't much we can do
f144a8
+        # to be more specific.
f144a8
+        if "timed out" in str(sse).lower():
f144a8
+            raise FilerError(Filer.ETIMEOUT, "Connection timeout (SSL)")
f144a8
+        else:
f144a8
+            raise FilerError(Filer.EUNKNOWN,
f144a8
+                             "SSL error occurred (%s)", str(sse))
f144a8
     finally:
f144a8
         if handler:
f144a8
             handler.close()
f144a8
@@ -148,6 +159,7 @@ class Filer(object):
f144a8
     Class to handle NetApp API calls.
f144a8
     Note: These are using lsm terminology.
f144a8
     """
f144a8
+    EUNKNOWN = 10                   # Non-specific error
f144a8
     ENOSPC = 28                     # Out of space
f144a8
     ETIMEOUT = 60                   # Time-out
f144a8
     EINVALID_ISCSI_NAME = 9006      # Invalid ISCSI IQN
f144a8
diff --git lsm/lsm/ontap.py lsm/lsm/ontap.py
f144a8
index b742a36..060fc4b 100644
f144a8
--- lsm/lsm/ontap.py
f144a8
+++ lsm/lsm/ontap.py
f144a8
@@ -45,7 +45,8 @@ e_map = {
f144a8
     na.Filer.ECLONE_LICENSE_EXPIRED: ErrorNumber.NOT_LICENSED,
f144a8
     na.Filer.ECLONE_NOT_LICENSED: ErrorNumber.NOT_LICENSED,
f144a8
     na.Filer.EINVALID_ISCSI_NAME: ErrorNumber.INVALID_IQN,
f144a8
-    na.Filer.ETIMEOUT: ErrorNumber.PLUGIN_TIMEOUT
f144a8
+    na.Filer.ETIMEOUT: ErrorNumber.PLUGIN_TIMEOUT,
f144a8
+    na.Filer.EUNKNOWN: ErrorNumber.PLUGIN_ERROR
f144a8
 }
f144a8
 
f144a8