From: Tom Swanson <tom_swanson@dell.com>
Date: Tue, 18 Aug 2015 19:36:38 +0000 (-0500)
Subject: Dell SC: Better exception handling in init_conn
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c128b94a27dc09eff8c64001371043a7a9674cff;p=openstack-build%2Fcinder-build.git

Dell SC: Better exception handling in init_conn

Now re-raising VolumeBackendAPIExceptions in initialize_connection.
And logging any other exceptions as VolumeBackendAPIException.  This
preserves the actual failure in the logs.

Also updated the version history.

Change-Id: Ib2421a9b701445e14095bea2415d7bbfaf54854c
---

diff --git a/cinder/volume/drivers/dell/dell_storagecenter_api.py b/cinder/volume/drivers/dell/dell_storagecenter_api.py
index dab55ec23..1f2fa96ec 100644
--- a/cinder/volume/drivers/dell/dell_storagecenter_api.py
+++ b/cinder/volume/drivers/dell/dell_storagecenter_api.py
@@ -195,8 +195,9 @@ class StorageCenterApi(object):
         2.1.0 - Added support for ManageableVD.
         2.2.0 - Added API 2.2 support.
         2.3.0 - Added Legacy Port Mode Support
+        2.3.1 - Updated error handling.
     """
-    APIVERSION = '2.3.0'
+    APIVERSION = '2.3.1'
 
     def __init__(self, host, port, user, password, verify):
         """This creates a connection to Dell Enterprise Manager.
diff --git a/cinder/volume/drivers/dell/dell_storagecenter_fc.py b/cinder/volume/drivers/dell/dell_storagecenter_fc.py
index 12642dec5..40853b073 100644
--- a/cinder/volume/drivers/dell/dell_storagecenter_fc.py
+++ b/cinder/volume/drivers/dell/dell_storagecenter_fc.py
@@ -42,9 +42,11 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
                 driver.
         2.1.0 - Added support for ManageableVD.
         2.2.0 - Driver retype support for switching volume's Storage Profile
+        2.3.0 - Added Legacy Port Mode Support
+        2.3.1 - Updated error handling.
     """
 
-    VERSION = '2.2.0'
+    VERSION = '2.3.1'
 
     def __init__(self, *args, **kwargs):
         super(DellStorageCenterFCDriver, self).__init__(*args, **kwargs)
diff --git a/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py b/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py
index 5bc9ae4a8..0da98c9a6 100644
--- a/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py
+++ b/cinder/volume/drivers/dell/dell_storagecenter_iscsi.py
@@ -39,10 +39,13 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
         2.0.0 - Switched to inheriting functional objects rather than volume
                 driver.
         2.1.0 - Added support for ManageableVD.
-        2.2.0 - Driver retype support for switching volume's Storage Profile
+        2.2.0 - Driver retype support for switching volume's Storage Profile.
+                Added API 2.2 support.
+        2.3.0 - Added Legacy Port Mode Support
+        2.3.1 - Updated error handling.
     """
 
-    VERSION = '2.2.0'
+    VERSION = '2.3.1'
 
     def __init__(self, *args, **kwargs):
         super(DellStorageCenterISCSIDriver, self).__init__(*args, **kwargs)
@@ -122,11 +125,13 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
                         # Return our iscsi properties.
                         return {'driver_volume_type': 'iscsi',
                                 'data': iscsiprops}
-            except Exception:
-                error = (_('Failed to initialize connection '
-                           '%(initiator)s %(vol)s') %
-                         {'initiator': initiator_name,
-                          'vol': volume_name})
+            # Re-raise any backend exception.
+            except exception.VolumeBackendAPIException:
+                with excutils.save_and_reraise_exception():
+                    LOG.error(_LE('Failed to initialize connection'))
+            # If there is a data structure issue then detail the exception
+            # and bail with a Backend Exception.
+            except Exception as error:
                 LOG.error(error)
                 raise exception.VolumeBackendAPIException(error)