From a9cf8adfbf785dfb79d6b7540a710721af395592 Mon Sep 17 00:00:00 2001 From: zhongjun2 Date: Fri, 16 Dec 2016 09:59:55 +0800 Subject: [PATCH] Trivial fix translate issues Fix some translate issues according to oslo.i18n guideline [1]. [1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html Change-Id: I93da3f1f834fb193bd2253208f689cc112baddd1 --- manila/scheduler/manager.py | 3 +-- manila/share/api.py | 4 +--- .../dell_emc/plugins/vnx/object_manager.py | 15 +++++++------ manila/share/drivers/huawei/v3/connection.py | 21 ++++++++----------- manila/share/manager.py | 7 +++---- manila/share/share_types.py | 8 +++---- 6 files changed, 24 insertions(+), 34 deletions(-) diff --git a/manila/scheduler/manager.py b/manila/scheduler/manager.py index 5057e72bd1..32e182d217 100644 --- a/manila/scheduler/manager.py +++ b/manila/scheduler/manager.py @@ -23,7 +23,6 @@ from oslo_config import cfg from oslo_log import log from oslo_utils import excutils from oslo_utils import importutils -import six from manila.common import constants from manila import context @@ -189,7 +188,7 @@ class SchedulerManager(manager.Manager): request_spec): LOG.error(_LE("Failed to schedule %(method)s: %(ex)s"), - {"method": method, "ex": six.text_type(ex)}) + {"method": method, "ex": ex}) properties = request_spec.get('share_properties', {}) diff --git a/manila/share/api.py b/manila/share/api.py index c94d82e63f..3c574f8177 100644 --- a/manila/share/api.py +++ b/manila/share/api.py @@ -721,9 +721,7 @@ class API(base.Base): except Exception as e: reservations = None LOG.exception( - _LE("Failed to update quota for deleting share: %s"), - six.text_type(e) - ) + _LE("Failed to update quota for deleting share: %s"), e) for share_instance in share.instances: if share_instance['host']: diff --git a/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py b/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py index f778008ba5..0e1855d00f 100644 --- a/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py +++ b/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py @@ -24,7 +24,7 @@ import six from manila.common import constants as const from manila import exception -from manila.i18n import _, _LI, _LW +from manila.i18n import _, _LE, _LI, _LW from manila.share.drivers.dell_emc.plugins.vnx import connector from manila.share.drivers.dell_emc.plugins.vnx import constants from manila.share.drivers.dell_emc.plugins.vnx import utils as vnx_utils @@ -439,13 +439,12 @@ class FileSystem(StorageObject): try: self._execute_cmd(copy_ckpt_cmd, check_exit_code=True) - except processutils.ProcessExecutionError as expt: - message = (_("Failed to copy content from snapshot %(snap)s to " - "file system %(filesystem)s. Reason: %(err)s.") % - {'snap': snap_name, - 'filesystem': name, - 'err': six.text_type(expt)}) - LOG.error(message) + except processutils.ProcessExecutionError as e: + LOG.error(_LE("Failed to copy content from snapshot %(snap)s to " + "file system %(filesystem)s. Reason: %(err)s."), + {'snap': snap_name, + 'filesystem': name, + 'err': e}) # When an error happens during nas_copy, we need to continue # deleting the checkpoint of the target file system if it exists. diff --git a/manila/share/drivers/huawei/v3/connection.py b/manila/share/drivers/huawei/v3/connection.py index e36ac84a5c..b9a4fe6bad 100644 --- a/manila/share/drivers/huawei/v3/connection.py +++ b/manila/share/drivers/huawei/v3/connection.py @@ -452,11 +452,10 @@ class V3StorageConnection(driver.HuaweiBase): try: os.rmdir(item['mount_src']) except Exception as err: - err_msg = (_('Failed to remove temp file. ' - 'File path: %(file_path)s. Reason: %(err)s.') - % {'file_path': item['mount_src'], - 'err': six.text_type(err)}) - LOG.warning(err_msg) + LOG.warning(_LW('Failed to remove temp file. File path: ' + '%(file_path)s. Reason: %(err)s.'), + {'file_path': item['mount_src'], + 'err': err}) return new_share_path @@ -471,7 +470,7 @@ class V3StorageConnection(driver.HuaweiBase): LOG.error(_LE('Failed to add access to share %(name)s. ' 'Reason: %(err)s.'), {'name': old_share['name'], - 'err': six.text_type(err)}) + 'err': err}) new_access = self.get_access(new_share) try: @@ -482,7 +481,7 @@ class V3StorageConnection(driver.HuaweiBase): LOG.error(_LE('Failed to mount old share %(name)s. ' 'Reason: %(err)s.'), {'name': old_share['name'], - 'err': six.text_type(err)}) + 'err': err}) try: self.allow_access(new_share, new_access) @@ -493,7 +492,7 @@ class V3StorageConnection(driver.HuaweiBase): LOG.error(_LE('Failed to mount new share %(name)s. ' 'Reason: %(err)s.'), {'name': new_share['name'], - 'err': six.text_type(err)}) + 'err': err}) copied = self.copy_snapshot_data(old_share, new_share) @@ -504,7 +503,7 @@ class V3StorageConnection(driver.HuaweiBase): LOG.warning(_LW('Failed to unmount share %(name)s. ' 'Reason: %(err)s.'), {'name': item['name'], - 'err': six.text_type(err)}) + 'err': err}) self.deny_access(new_share, new_access) @@ -574,9 +573,7 @@ class V3StorageConnection(driver.HuaweiBase): if copy.get_progress()['total_progress'] == 100: copy_finish = True except Exception as err: - err_msg = (_("Failed to copy data, reason: %s.") - % six.text_type(err)) - LOG.error(err_msg) + LOG.error(_LE("Failed to copy data, reason: %s."), err) return copy_finish diff --git a/manila/share/manager.py b/manila/share/manager.py index 031a576abe..d6e09d68ea 100644 --- a/manila/share/manager.py +++ b/manila/share/manager.py @@ -325,7 +325,7 @@ class ShareManager(manager.SchedulerDependentManager): LOG.error( _LE("Caught exception trying ensure share '%(s_id)s'. " "Exception: \n%(e)s."), - {'s_id': share_instance['id'], 'e': six.text_type(e)}, + {'s_id': share_instance['id'], 'e': e}, ) continue @@ -344,7 +344,7 @@ class ShareManager(manager.SchedulerDependentManager): _LE("Unexpected error occurred while updating access " "rules for share instance %(s_id)s. " "Exception: \n%(e)s."), - {'s_id': share_instance['id'], 'e': six.text_type(e)}, + {'s_id': share_instance['id'], 'e': e}, ) self.publish_service_capabilities(ctxt) @@ -2071,8 +2071,7 @@ class ShareManager(manager.SchedulerDependentManager): # Quota reservation errors here are not fatal, because # unmanage is administrator API and he/she could update user # quota usages later if it's required. - LOG.warning(_LW("Failed to update quota usages: %s."), - six.text_type(e)) + LOG.warning(_LW("Failed to update quota usages: %s."), e) if self.configuration.safe_get('unmanage_remove_access_rules'): try: diff --git a/manila/share/share_types.py b/manila/share/share_types.py index 7a8df6f866..0a2bd7e5fc 100644 --- a/manila/share/share_types.py +++ b/manila/share/share_types.py @@ -88,12 +88,10 @@ def get_all_types(context, inactive=0, search_opts=None): required_extra_specs = get_valid_required_extra_specs( type_args['extra_specs']) except exception.InvalidExtraSpec as e: - values = { - 'share_type': type_name, - 'error': six.text_type(e) - } LOG.exception(_LE('Share type %(share_type)s has invalid required' - ' extra specs: %(error)s'), values) + ' extra specs: %(error)s'), + {'share_type': type_name, + 'error': e}) type_args['required_extra_specs'] = required_extra_specs