]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Dell SC: Better exception handling in init_conn
authorTom Swanson <tom_swanson@dell.com>
Tue, 18 Aug 2015 19:36:38 +0000 (14:36 -0500)
committerTom Swanson <tom_swanson@dell.com>
Wed, 19 Aug 2015 19:27:40 +0000 (14:27 -0500)
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

cinder/volume/drivers/dell/dell_storagecenter_api.py
cinder/volume/drivers/dell/dell_storagecenter_fc.py
cinder/volume/drivers/dell/dell_storagecenter_iscsi.py

index dab55ec238676aa9d2e81f226f76f3be194a3442..1f2fa96ecbe3b78375a327814189adbef1790565 100644 (file)
@@ -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.
index 12642dec56bb134d4b4319afd420bef8f07a5e5f..40853b0738f21634b2b72d236b9ce459430aec06 100644 (file)
@@ -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)
index 5bc9ae4a803c285bc0f5da4efea16a14452430e5..0da98c9a6a7f2bfe4a7b5724496074d916ead5e1 100644 (file)
@@ -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)