summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloooosy <syluo5695@fiberhome.com>2017-03-21 14:34:00 +0800
committerSiyi Luo <syluo5695@fiberhome.com>2017-03-24 07:24:50 +0000
commit89b4a8a1b934820d29452cbc90577ff95b2593c0 (patch)
tree22af09db80716678d760cbce309e71493399267e
parentd1524a48b5ab0a7fd18d60bfb1a59e615b32d163 (diff)
downloadoslo-vmware-89b4a8a1b934820d29452cbc90577ff95b2593c0.tar.gz
Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Ib7bb69eac558fa157331f9cf0fb452e6053714a7
-rw-r--r--oslo_vmware/_i18n.py10
-rw-r--r--oslo_vmware/api.py44
-rw-r--r--oslo_vmware/common/loopingcall.py7
-rw-r--r--oslo_vmware/exceptions.py10
-rw-r--r--oslo_vmware/image_transfer.py6
-rw-r--r--oslo_vmware/pbm.py3
-rw-r--r--oslo_vmware/rw_handles.py20
-rw-r--r--oslo_vmware/vim_util.py7
8 files changed, 46 insertions, 61 deletions
diff --git a/oslo_vmware/_i18n.py b/oslo_vmware/_i18n.py
index bb197a5..984d1ed 100644
--- a/oslo_vmware/_i18n.py
+++ b/oslo_vmware/_i18n.py
@@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='oslo_vmware')
# The primary translation function using the well-known name "_"
_ = _translators.primary
-
-# Translators for log levels.
-#
-# The abbreviated names are meant to reflect the usual use of a short
-# name like '_'. The "L" is for "log" and the other letter comes from
-# the level.
-_LI = _translators.log_info
-_LW = _translators.log_warning
-_LE = _translators.log_error
-_LC = _translators.log_critical
diff --git a/oslo_vmware/api.py b/oslo_vmware/api.py
index 439e90c..4224a96 100644
--- a/oslo_vmware/api.py
+++ b/oslo_vmware/api.py
@@ -28,7 +28,7 @@ from oslo_utils import excutils
from oslo_utils import reflection
import six
-from oslo_vmware._i18n import _, _LE, _LI, _LW
+from oslo_vmware._i18n import _
from oslo_vmware.common import loopingcall
from oslo_vmware import exceptions
from oslo_vmware import pbm
@@ -96,17 +96,17 @@ class RetryDecorator(object):
result = f(*args, **kwargs)
except self._exceptions:
with excutils.save_and_reraise_exception() as ctxt:
- LOG.warning(_LW("Exception which is in the suggested list "
- "of exceptions occurred while invoking "
- "function: %s."),
+ LOG.warning("Exception which is in the suggested list "
+ "of exceptions occurred while invoking "
+ "function: %s.",
func_name,
exc_info=True)
if (self._max_retry_count != -1 and
self._retry_count >= self._max_retry_count):
- LOG.error(_LE("Cannot retry upon suggested exception "
- "since retry count (%(retry_count)d) "
- "reached max retry count "
- "(%(max_retry_count)d)."),
+ LOG.error("Cannot retry upon suggested exception "
+ "since retry count (%(retry_count)d) "
+ "reached max retry count "
+ "(%(max_retry_count)d).",
{'retry_count': self._retry_count,
'max_retry_count': self._max_retry_count})
else:
@@ -191,7 +191,7 @@ class VMwareAPISession(object):
def pbm_wsdl_loc_set(self, pbm_wsdl_loc):
self._pbm_wsdl_loc = pbm_wsdl_loc
self._pbm = None
- LOG.info(_LI('PBM WSDL updated to %s'), pbm_wsdl_loc)
+ LOG.info('PBM WSDL updated to %s', pbm_wsdl_loc)
@property
def vim(self):
@@ -250,8 +250,8 @@ class VMwareAPISession(object):
# object. We can't use the username used for login since the Login
# method ignores the case.
self._session_username = session.userName
- LOG.info(_LI("Successfully established new session; session ID is "
- "%s."),
+ LOG.info("Successfully established new session; session ID is "
+ "%s.",
_trunc_id(self._session_id))
# Set PBM client cookie.
@@ -261,16 +261,16 @@ class VMwareAPISession(object):
def logout(self):
"""Log out and terminate the current session."""
if self._session_id:
- LOG.info(_LI("Logging out and terminating the current session "
- "with ID = %s."),
+ LOG.info("Logging out and terminating the current session "
+ "with ID = %s.",
_trunc_id(self._session_id))
try:
self.vim.Logout(self.vim.service_content.sessionManager)
self._session_id = None
except Exception:
- LOG.exception(_LE("Error occurred while logging out and "
- "terminating the current session with "
- "ID = %s."),
+ LOG.exception("Error occurred while logging out and "
+ "terminating the current session with "
+ "ID = %s.",
_trunc_id(self._session_id))
else:
LOG.debug("No session exists to log out.")
@@ -415,8 +415,8 @@ class VMwareAPISession(object):
skip_op_id=True)
except exceptions.VimException:
with excutils.save_and_reraise_exception():
- LOG.exception(_LE("Error occurred while reading info of "
- "task: %s."),
+ LOG.exception("Error occurred while reading info of "
+ "task: %s.",
task)
else:
task_detail = {'id': task.value}
@@ -483,8 +483,8 @@ class VMwareAPISession(object):
skip_op_id=True)
except exceptions.VimException:
with excutils.save_and_reraise_exception():
- LOG.exception(_LE("Error occurred while checking "
- "state of lease: %s."),
+ LOG.exception("Error occurred while checking "
+ "state of lease: %s.",
lease)
else:
if state == 'ready':
@@ -518,8 +518,8 @@ class VMwareAPISession(object):
lease,
'error')
except exceptions.VimException:
- LOG.warning(_LW("Error occurred while reading error message for "
- "lease: %s."),
+ LOG.warning("Error occurred while reading error message for "
+ "lease: %s.",
lease,
exc_info=True)
return "Unknown"
diff --git a/oslo_vmware/common/loopingcall.py b/oslo_vmware/common/loopingcall.py
index c4a16ae..489b198 100644
--- a/oslo_vmware/common/loopingcall.py
+++ b/oslo_vmware/common/loopingcall.py
@@ -22,7 +22,6 @@ from eventlet import event
from eventlet import greenthread
from oslo_utils import timeutils
-from oslo_vmware._i18n import _LE, _LW
LOG = logging.getLogger(__name__)
@@ -79,15 +78,15 @@ class FixedIntervalLoopingCall(LoopingCallBase):
break
delay = interval - timeutils.delta_seconds(start, end)
if delay <= 0:
- LOG.warning(_LW('task run outlasted interval '
- 'by %s sec'),
+ LOG.warning('task run outlasted interval '
+ 'by %s sec',
-delay)
greenthread.sleep(delay if delay > 0 else 0)
except LoopingCallDone as e:
self.stop()
done.send(e.retvalue)
except Exception:
- LOG.exception(_LE('in fixed duration looping call'))
+ LOG.exception('in fixed duration looping call')
done.send_exception(*sys.exc_info())
return
else:
diff --git a/oslo_vmware/exceptions.py b/oslo_vmware/exceptions.py
index aa57133..4018a82 100644
--- a/oslo_vmware/exceptions.py
+++ b/oslo_vmware/exceptions.py
@@ -21,7 +21,7 @@ import logging
import six
-from oslo_vmware._i18n import _, _LE, _LW
+from oslo_vmware._i18n import _
LOG = logging.getLogger(__name__)
@@ -79,9 +79,9 @@ class VMwareDriverException(Exception):
except Exception:
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
- LOG.exception(_LE('Exception in string format operation'))
+ LOG.exception('Exception in string format operation')
for name, value in six.iteritems(kwargs):
- LOG.error(_LE("%(name)s: %(value)s"),
+ LOG.error("%(name)s: %(value)s",
{'name': name, 'value': value})
# at least get the core message out if something happened
message = self.msg_fmt
@@ -168,8 +168,8 @@ class ImageTransferException(VMwareDriverException):
def _print_deprecation_warning(clazz):
- LOG.warning(_LW("Exception %s is deprecated, it will be removed in the "
- "next release."), clazz.__name__)
+ LOG.warning("Exception %s is deprecated, it will be removed in the "
+ "next release.", clazz.__name__)
class VMwareDriverConfigurationException(VMwareDriverException):
diff --git a/oslo_vmware/image_transfer.py b/oslo_vmware/image_transfer.py
index c7da026..eb6d6c5 100644
--- a/oslo_vmware/image_transfer.py
+++ b/oslo_vmware/image_transfer.py
@@ -24,7 +24,7 @@ from eventlet import timeout
import six
from oslo_utils import units
-from oslo_vmware._i18n import _, _LW
+from oslo_vmware._i18n import _
from oslo_vmware.common import loopingcall
from oslo_vmware import constants
from oslo_vmware import exceptions
@@ -311,8 +311,8 @@ def upload_image(context, timeout_secs, image_service, image_id, owner_id,
LOG.debug("Ignoring keyword argument 'is_public'.")
if 'image_version' in kwargs:
- LOG.warning(_LW("The keyword argument 'image_version' is deprecated "
- "and will be ignored in the next release."))
+ LOG.warning("The keyword argument 'image_version' is deprecated "
+ "and will be ignored in the next release.")
image_ver = six.text_type(kwargs.get('image_version'))
image_metadata = {'disk_format': 'vmdk',
diff --git a/oslo_vmware/pbm.py b/oslo_vmware/pbm.py
index 007d81f..849cd55 100644
--- a/oslo_vmware/pbm.py
+++ b/oslo_vmware/pbm.py
@@ -26,7 +26,6 @@ import os
import six.moves.urllib.parse as urlparse
import six.moves.urllib.request as urllib
-from oslo_vmware._i18n import _LW
from oslo_vmware import service
from oslo_vmware import vim_util
@@ -199,7 +198,7 @@ def get_pbm_wsdl_location(vc_version):
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
'pbmService.wsdl')
if not os.path.exists(pbm_service_wsdl):
- LOG.warning(_LW("PBM WSDL file %s not found."), pbm_service_wsdl)
+ LOG.warning("PBM WSDL file %s not found.", pbm_service_wsdl)
return
pbm_wsdl = urlparse.urljoin('file:', urllib.pathname2url(pbm_service_wsdl))
LOG.debug("Using PBM WSDL location: %s.", pbm_wsdl)
diff --git a/oslo_vmware/rw_handles.py b/oslo_vmware/rw_handles.py
index e81adf0..e2f1bed 100644
--- a/oslo_vmware/rw_handles.py
+++ b/oslo_vmware/rw_handles.py
@@ -32,7 +32,7 @@ import six
import six.moves.urllib.parse as urlparse
from urllib3 import connection as httplib
-from oslo_vmware._i18n import _, _LE, _LW
+from oslo_vmware._i18n import _
from oslo_vmware import exceptions
from oslo_vmware import vim_util
@@ -150,7 +150,7 @@ class FileHandle(object):
try:
self._file_handle.close()
except Exception:
- LOG.warning(_LW("Error occurred while closing the file handle"),
+ LOG.warning("Error occurred while closing the file handle",
exc_info=True)
def _build_vim_cookie_header(self, vim_cookies):
@@ -253,7 +253,7 @@ class FileWriteHandle(FileHandle):
try:
self._conn.getresponse()
except Exception:
- LOG.warning(_LW("Error occurred while reading the HTTP response."),
+ LOG.warning("Error occurred while reading the HTTP response.",
exc_info=True)
super(FileWriteHandle, self).close()
@@ -307,9 +307,9 @@ class VmdkHandle(FileHandle):
percent=progress)
except exceptions.VimException:
with excutils.save_and_reraise_exception():
- LOG.exception(_LE("Error occurred while updating the "
- "write/read progress of VMDK file "
- "with URL = %s."),
+ LOG.exception("Error occurred while updating the "
+ "write/read progress of VMDK file "
+ "with URL = %s.",
self._url)
def _release_lease(self):
@@ -516,8 +516,8 @@ class VmdkWriteHandle(VmdkHandle):
try:
self._release_lease()
except exceptions.VimException:
- LOG.warning(_LW("Error occurred while releasing the lease "
- "for %s."),
+ LOG.warning("Error occurred while releasing the lease "
+ "for %s.",
self._url,
exc_info=True)
super(VmdkWriteHandle, self).close()
@@ -594,8 +594,8 @@ class VmdkReadHandle(VmdkHandle):
try:
self._release_lease()
except exceptions.VimException:
- LOG.warning(_LW("Error occurred while releasing the lease "
- "for %s."),
+ LOG.warning("Error occurred while releasing the lease "
+ "for %s.",
self._url,
exc_info=True)
raise
diff --git a/oslo_vmware/vim_util.py b/oslo_vmware/vim_util.py
index 24d9286..9332ae2 100644
--- a/oslo_vmware/vim_util.py
+++ b/oslo_vmware/vim_util.py
@@ -22,9 +22,6 @@ import logging
from oslo_utils import timeutils
from suds import sudsobject
-from oslo_vmware._i18n import _LW
-
-
LOG = logging.getLogger(__name__)
@@ -347,8 +344,8 @@ def get_object_properties_dict(vim, moref, properties_to_collect):
# The object may have information useful for logging
if hasattr(obj_contents[0], 'missingSet'):
for m in obj_contents[0].missingSet:
- LOG.warning(_LW("Unable to retrieve value for %(path)s "
- "Reason: %(reason)s"),
+ LOG.warning("Unable to retrieve value for %(path)s "
+ "Reason: %(reason)s",
{'path': m.path,
'reason': m.fault.localizedMessage})
return property_dict