From 4e5e9701b4f5e85eada2a7fb670bee92a5988ecf Mon Sep 17 00:00:00 2001 From: zhufl Date: Fri, 15 Mar 2019 16:03:23 +0800 Subject: [PATCH] Fix kwargs passed to exception to get better format of error message kwargs should be passed to exception according to the definition of exception format message, or we can just pass message to exception, so this is to fix some inconsistencies of kwargs passed to exception to get better format of error message. Change-Id: I809725c1f8fd711b372406e64ba80f11505eb737 --- cinder/volume/drivers/dell_emc/sc/storagecenter_common.py | 2 +- cinder/volume/drivers/dothill/dothill_common.py | 2 +- cinder/volume/drivers/fujitsu/eternus_dx/eternus_dx_common.py | 2 +- cinder/volume/drivers/hpe/hpe_3par_common.py | 4 ++-- cinder/volume/drivers/ibm/ibm_storage/ds8k_restclient.py | 2 +- cinder/volume/drivers/netapp/dataontap/utils/data_motion.py | 2 +- cinder/volume/drivers/netapp/utils.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py index 40dba788e22..8bc2f86a4c8 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py @@ -2031,6 +2031,6 @@ class SCCommonDriver(driver.ManageableVD, 'back-end or resolve primary system issues and ' 'fail back to reenable full functionality.') LOG.error(msg) - raise exception.Invalid(reason=msg) + raise exception.Invalid(msg) return True diff --git a/cinder/volume/drivers/dothill/dothill_common.py b/cinder/volume/drivers/dothill/dothill_common.py index bca02950e14..ed399c4d79d 100644 --- a/cinder/volume/drivers/dothill/dothill_common.py +++ b/cinder/volume/drivers/dothill/dothill_common.py @@ -283,7 +283,7 @@ class DotHillCommon(object): err = (_("Unable to get stats for backend_name: %s") % self.backend_name) LOG.exception(err) - raise exception.Invalid(reason=err) + raise exception.Invalid(err) stats['pools'].append(pool) self.stats = stats diff --git a/cinder/volume/drivers/fujitsu/eternus_dx/eternus_dx_common.py b/cinder/volume/drivers/fujitsu/eternus_dx/eternus_dx_common.py index 7de2b4bc548..4a02238e937 100644 --- a/cinder/volume/drivers/fujitsu/eternus_dx/eternus_dx_common.py +++ b/cinder/volume/drivers/fujitsu/eternus_dx/eternus_dx_common.py @@ -1606,7 +1606,7 @@ class FJDXCommon(object): 'Error: Volume is in Busy state') % {'cpsession': cpsession, 'operation': operation}) - raise exception.VolumeIsBusy(data=msg) + raise exception.VolumeIsBusy(msg) elif rc != 0: msg = (_('_delete_copysession, ' 'copysession: %(cpsession)s, ' diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index ca54b3d92be..e5eeb482d1e 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -3193,12 +3193,12 @@ class HPE3PARCommon(object): if not (host_type == 'HPE3PARDriver'): reason = (_("Cannot retype from HPE3PARDriver to %s.") % host_type) - raise exception.InvalidHost(reason) + raise exception.InvalidHost(reason=reason) sys_info = self.client.getStorageSystemInfo() if not (host_id == sys_info['serialNumber']): reason = (_("Cannot retype from one 3PAR array to another.")) - raise exception.InvalidHost(reason) + raise exception.InvalidHost(reason=reason) # Validate new_snap_cpg. A white-space snapCPG will fail eventually, # but we'd prefer to fail fast -- if this ever happens. diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_restclient.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_restclient.py index cf56d7fa29b..742aeeb6caa 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_restclient.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_restclient.py @@ -233,7 +233,7 @@ class RESTScheduler(object): # verify the method if method not in ('GET', 'POST', 'PUT', 'DELETE'): msg = _("Invalid HTTP method: %s") % method - raise APIException(data=msg) + raise APIException(msg) # prepare the url url = "https://%s:%s/api/v1%s" % (self.host, self.port, endpoint) diff --git a/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py b/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py index e4010ecedbf..e60f48ba632 100644 --- a/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py +++ b/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py @@ -319,7 +319,7 @@ class DataMotionMixin(object): desired_attributes=['relationship-status', 'mirror-state'])[0] if snapmirror.get('relationship-status') != 'quiesced': msg = _("SnapMirror relationship is not quiesced.") - raise na_utils.NetAppDriverException(reason=msg) + raise na_utils.NetAppDriverException(msg) try: wait_for_quiesced() diff --git a/cinder/volume/drivers/netapp/utils.py b/cinder/volume/drivers/netapp/utils.py index 24bffe485ed..a55c4c6e26c 100644 --- a/cinder/volume/drivers/netapp/utils.py +++ b/cinder/volume/drivers/netapp/utils.py @@ -139,7 +139,7 @@ def setup_api_trace_pattern(api_trace_pattern): except (re.error, TypeError): msg = _('Cannot parse the API trace pattern. %s is not a ' 'valid python regular expression.') % api_trace_pattern - raise exception.InvalidConfigurationValue(reason=msg) + raise exception.InvalidConfigurationValue(msg) API_TRACE_PATTERN = api_trace_pattern