diff --git a/nova/image/s3.py b/nova/image/s3.py index fa7278e257c1..5d5c4edff0cc 100644 --- a/nova/image/s3.py +++ b/nova/image/s3.py @@ -31,7 +31,7 @@ from oslo.config import cfg from nova.api.ec2 import ec2utils import nova.cert.rpcapi from nova import exception -from nova.i18n import _ +from nova.i18n import _, _LE from nova.image import glance from nova.openstack.common import log as logging from nova.openstack.common import processutils @@ -328,8 +328,8 @@ class S3ImageService(object): shutil.copyfileobj(part, combined) except Exception: - LOG.exception(_("Failed to download %(image_location)s " - "to %(image_path)s"), log_vars) + LOG.exception(_LE("Failed to download %(image_location)s " + "to %(image_path)s"), log_vars) _update_image_state(context, image_uuid, 'failed_download') return @@ -345,8 +345,8 @@ class S3ImageService(object): self._decrypt_image(context, enc_filename, encrypted_key, encrypted_iv, dec_filename) except Exception: - LOG.exception(_("Failed to decrypt %(image_location)s " - "to %(image_path)s"), log_vars) + LOG.exception(_LE("Failed to decrypt %(image_location)s " + "to %(image_path)s"), log_vars) _update_image_state(context, image_uuid, 'failed_decrypt') return @@ -356,8 +356,8 @@ class S3ImageService(object): unz_filename = self._untarzip_image(image_path, dec_filename) except Exception: - LOG.exception(_("Failed to untar %(image_location)s " - "to %(image_path)s"), log_vars) + LOG.exception(_LE("Failed to untar %(image_location)s " + "to %(image_path)s"), log_vars) _update_image_state(context, image_uuid, 'failed_untar') return @@ -366,8 +366,8 @@ class S3ImageService(object): with open(unz_filename) as image_file: _update_image_data(context, image_uuid, image_file) except Exception: - LOG.exception(_("Failed to upload %(image_location)s " - "to %(image_path)s"), log_vars) + LOG.exception(_LE("Failed to upload %(image_location)s " + "to %(image_path)s"), log_vars) _update_image_state(context, image_uuid, 'failed_upload') return diff --git a/nova/objects/base.py b/nova/objects/base.py index 63a2705aaad0..f6a8d505d9be 100644 --- a/nova/objects/base.py +++ b/nova/objects/base.py @@ -24,7 +24,7 @@ import six from nova import context from nova import exception -from nova.i18n import _ +from nova.i18n import _, _LE from nova import objects from nova.objects import fields from nova.openstack.common import log as logging @@ -83,8 +83,7 @@ def make_class_properties(cls): return setattr(self, attrname, field_value) except Exception: attr = "%s.%s" % (self.obj_name(), name) - LOG.exception(_('Error setting %(attr)s') % - {'attr': attr}) + LOG.exception(_LE('Error setting %(attr)s'), {'attr': attr}) raise setattr(cls, name, property(getter, setter)) diff --git a/nova/objects/instance.py b/nova/objects/instance.py index 275e7db89d96..a0ea3ba9ec82 100644 --- a/nova/objects/instance.py +++ b/nova/objects/instance.py @@ -17,7 +17,7 @@ from nova.cells import rpcapi as cells_rpcapi from nova.compute import flavors from nova import db from nova import exception -from nova.i18n import _ +from nova.i18n import _LE from nova import notifications from nova import objects from nova.objects import base @@ -428,7 +428,7 @@ class Instance(base.NovaPersistentObject, base.NovaObject): try: getattr(self, '_save_%s' % field)(context) except AttributeError: - LOG.exception(_('No save handler for %s') % field, + LOG.exception(_LE('No save handler for %s'), field, instance=self) elif field in changes: updates[field] = self[field] diff --git a/nova/objects/instance_info_cache.py b/nova/objects/instance_info_cache.py index 10b128e0e8e6..9d7011937f12 100644 --- a/nova/objects/instance_info_cache.py +++ b/nova/objects/instance_info_cache.py @@ -16,7 +16,7 @@ from nova.cells import opts as cells_opts from nova.cells import rpcapi as cells_rpcapi from nova import db from nova import exception -from nova.i18n import _ +from nova.i18n import _LE from nova.objects import base from nova.objects import fields from nova.openstack.common import log as logging @@ -79,8 +79,8 @@ class InstanceInfoCache(base.NovaPersistentObject, base.NovaObject): try: cells_api.instance_info_cache_update_at_top(ctxt, info_cache) except Exception: - LOG.exception(_("Failed to notify cells of instance info " - "cache update")) + LOG.exception(_LE("Failed to notify cells of instance info " + "cache update")) @base.remotable def save(self, context, update_cells=True): diff --git a/nova/servicegroup/drivers/db.py b/nova/servicegroup/drivers/db.py index bf45d1ada5f3..70b7e132ba20 100644 --- a/nova/servicegroup/drivers/db.py +++ b/nova/servicegroup/drivers/db.py @@ -18,7 +18,7 @@ import six from nova import conductor from nova import context -from nova.i18n import _ +from nova.i18n import _, _LE from nova.openstack.common import log as logging from nova.openstack.common import timeutils from nova.servicegroup import api @@ -107,4 +107,4 @@ class DbDriver(api.ServiceGroupDriver): except Exception: # pylint: disable=W0702 if not getattr(service, 'model_disconnected', False): service.model_disconnected = True - LOG.exception(_('model server went away')) + LOG.exception(_LE('model server went away')) diff --git a/nova/servicegroup/drivers/mc.py b/nova/servicegroup/drivers/mc.py index 3d643bb20c78..636dec8aa971 100644 --- a/nova/servicegroup/drivers/mc.py +++ b/nova/servicegroup/drivers/mc.py @@ -21,7 +21,7 @@ from oslo.config import cfg from nova import conductor from nova import context -from nova.i18n import _ +from nova.i18n import _, _LE from nova.openstack.common import log as logging from nova.openstack.common import memorycache from nova.openstack.common import timeutils @@ -102,4 +102,4 @@ class MemcachedDriver(api.ServiceGroupDriver): except Exception: # pylint: disable=W0702 if not getattr(service, 'model_disconnected', False): service.model_disconnected = True - LOG.exception(_('model server went away')) + LOG.exception(_LE('model server went away')) diff --git a/nova/servicegroup/drivers/zk.py b/nova/servicegroup/drivers/zk.py index 9ba3ae64f982..a2dc3c83c1aa 100644 --- a/nova/servicegroup/drivers/zk.py +++ b/nova/servicegroup/drivers/zk.py @@ -20,7 +20,7 @@ import eventlet from oslo.config import cfg from nova import exception -from nova.i18n import _ +from nova.i18n import _, _LE from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import loopingcall @@ -87,10 +87,10 @@ class ZooKeeperDriver(api.ServiceGroupDriver): try: member = membership.Membership(self._session, path, member_id) except RuntimeError: - LOG.exception(_("Unable to join. It is possible that either " - "another node exists with the same name, or " - "this node just restarted. We will try " - "again in a short while to make sure.")) + LOG.exception(_LE("Unable to join. It is possible that either" + " another node exists with the same name, or" + " this node just restarted. We will try " + "again in a short while to make sure.")) eventlet.sleep(CONF.zookeeper.sg_retry_interval) member = membership.Membership(self._session, path, member_id) self._memberships[(group, member_id)] = member