diff options
author | Ngo Quoc Cuong <cuongnq@vn.fujitsu.com> | 2017-05-22 16:00:08 +0700 |
---|---|---|
committer | Ngo Quoc Cuong <cuongnq@vn.fujitsu.com> | 2017-07-18 09:03:39 +0000 |
commit | efae7d796a1750ce1aa34e42c1f5dd10cf22eace (patch) | |
tree | 485726a2f037b755bb437b04097be45a8586a49c /nova/db | |
parent | 247f9b8120fb901ec420a59a500db0db9dad445a (diff) | |
download | nova-efae7d796a1750ce1aa34e42c1f5dd10cf22eace.tar.gz |
Remove translation of log messages
The i18n team has decided not to translate the logs because it
seems like it not very useful; operators prefer to have them in
English so that they can search for those strings on the internet.
Partially fix on nova/conductor, nova/console, nova/consoleauth,
nova/db and nova/image other paths will be fixed on next commits
Change-Id: I132f60cb4743f85c96ec5231d6f860cfb0815758
Diffstat (limited to 'nova/db')
12 files changed, 51 insertions, 69 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index e0e01321f7..275340dbad 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -32,7 +32,6 @@ from oslo_log import log as logging from nova.cells import rpcapi as cells_rpcapi import nova.conf -from nova.i18n import _LE CONF = nova.conf.CONF @@ -1787,7 +1786,7 @@ def bw_usage_update(context, uuid, mac, start_period, bw_in, bw_out, uuid, mac, start_period, bw_in, bw_out, last_ctr_in, last_ctr_out, last_refreshed) except Exception: - LOG.exception(_LE("Failed to notify cells of bw_usage update")) + LOG.exception("Failed to notify cells of bw_usage update") return rv diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 675099425b..afe1b80e40 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -65,7 +65,7 @@ import nova.conf import nova.context from nova.db.sqlalchemy import models from nova import exception -from nova.i18n import _, _LI, _LE, _LW +from nova.i18n import _ from nova import safe_utils profiler_sqlalchemy = importutils.try_import('osprofiler.sqlalchemy') @@ -905,7 +905,7 @@ def floating_ip_get(context, id): if not result: raise exception.FloatingIpNotFound(id=id) except db_exc.DBError: - LOG.warning(_LW("Invalid floating IP ID %s in request"), id) + LOG.warning("Invalid floating IP ID %s in request", id) raise exception.InvalidID(id=id) return result @@ -1589,7 +1589,7 @@ def virtual_interface_create(context, values): vif_ref.update(values) vif_ref.save(context.session) except db_exc.DBError: - LOG.exception(_LE("VIF creation failed with a database error.")) + LOG.exception("VIF creation failed with a database error.") raise exception.VirtualInterfaceCreateException() return vif_ref @@ -1936,7 +1936,7 @@ def instance_get(context, instance_id, columns_to_join=None): except db_exc.DBError: # NOTE(sdague): catch all in case the db engine chokes on the # id because it's too long of an int to store. - LOG.warning(_LW("Invalid instance id %s in request"), instance_id) + LOG.warning("Invalid instance id %s in request", instance_id) raise exception.InvalidID(id=instance_id) @@ -3689,17 +3689,17 @@ def _refresh_quota_usages(quota_usage, until_refresh, in_use): :param in_use: Actual quota usage for the resource. """ if quota_usage.in_use != in_use: - LOG.info(_LI('quota_usages out of sync, updating. ' - 'project_id: %(project_id)s, ' - 'user_id: %(user_id)s, ' - 'resource: %(res)s, ' - 'tracked usage: %(tracked_use)s, ' - 'actual usage: %(in_use)s'), - {'project_id': quota_usage.project_id, - 'user_id': quota_usage.user_id, - 'res': quota_usage.resource, - 'tracked_use': quota_usage.in_use, - 'in_use': in_use}) + LOG.info('quota_usages out of sync, updating. ' + 'project_id: %(project_id)s, ' + 'user_id: %(user_id)s, ' + 'resource: %(res)s, ' + 'tracked usage: %(tracked_use)s, ' + 'actual usage: %(in_use)s', + {'project_id': quota_usage.project_id, + 'user_id': quota_usage.user_id, + 'res': quota_usage.resource, + 'tracked_use': quota_usage.in_use, + 'in_use': in_use}) else: LOG.debug('QuotaUsage has not changed, refresh is unnecessary for: %s', dict(quota_usage)) @@ -3896,8 +3896,8 @@ def quota_reserve(context, resources, project_quotas, user_quotas, deltas, context.session.add(usage_ref) if unders: - LOG.warning(_LW("Change will make usage less than 0 for the following " - "resources: %s"), unders) + LOG.warning("Change will make usage less than 0 for the following " + "resources: %s", unders) if overs: if project_quotas == user_quotas: @@ -5598,9 +5598,9 @@ def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, rd_bytes < current_usage['curr_read_bytes'] or wr_req < current_usage['curr_writes'] or wr_bytes < current_usage['curr_write_bytes']): - LOG.info(_LI("Volume(%s) has lower stats then what is in " - "the database. Instance must have been rebooted " - "or crashed. Updating totals."), id) + LOG.info("Volume(%s) has lower stats then what is in " + "the database. Instance must have been rebooted " + "or crashed. Updating totals.", id) if not update_totals: values['tot_reads'] = (models.VolumeUsage.tot_reads + current_usage['curr_reads']) @@ -5959,8 +5959,8 @@ def aggregate_metadata_add(context, aggregate_id, metadata, set_delete=False, if attempt < max_retries - 1: ctxt.reraise = False else: - LOG.warning(_LW("Add metadata failed for aggregate %(id)s " - "after %(retries)s retries"), + LOG.warning("Add metadata failed for aggregate %(id)s " + "after %(retries)s retries", {"id": aggregate_id, "retries": max_retries}) @@ -6380,7 +6380,7 @@ def _archive_if_instance_deleted(table, shadow_table, instances, conn, result_delete = conn.execute(delete_statement) return result_delete.rowcount except db_exc.DBReferenceError as ex: - LOG.warning(_LW('Failed to archive %(table)s: %(error)s'), + LOG.warning('Failed to archive %(table)s: %(error)s', {'table': table.__tablename__, 'error': six.text_type(ex)}) return 0 @@ -6472,8 +6472,8 @@ def _archive_deleted_rows_for_table(tablename, max_rows): # A foreign key constraint keeps us from deleting some of # these rows until we clean up a dependent table. Just # skip this table for now; we'll come back to it later. - LOG.warning(_LW("IntegrityError detected when archiving table " - "%(tablename)s: %(error)s"), + LOG.warning("IntegrityError detected when archiving table " + "%(tablename)s: %(error)s", {'tablename': tablename, 'error': six.text_type(ex)}) if ((max_rows is None or rows_archived < max_rows) diff --git a/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py b/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py index e59b12433a..6e7670f55b 100644 --- a/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py +++ b/nova/db/sqlalchemy/api_migrations/migrate_repo/versions/030_require_cell_setup.py @@ -14,7 +14,7 @@ from oslo_log import log as logging from sqlalchemy import MetaData, Table, func, select from nova import exception -from nova.i18n import _, _LW +from nova.i18n import _ from nova import objects LOG = logging.getLogger(__name__) @@ -54,7 +54,6 @@ def upgrade(migrate_engine): host_mappings = Table('host_mappings', meta, autoload=True) count = select([func.count()]).select_from(host_mappings).scalar() if count == 0: - msg = _LW('No host mappings were found, but are required for Ocata. ' - 'Please run nova-manage cell_v2 simple_cell_setup before ' - 'continuing.') - LOG.warning(msg) + LOG.warning('No host mappings were found, but are required for Ocata. ' + 'Please run nova-manage cell_v2 simple_cell_setup before ' + 'continuing.') diff --git a/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py b/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py index 317e3c3f93..efb29a40a1 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py @@ -21,8 +21,6 @@ from sqlalchemy import ForeignKey, Index, Integer, MetaData, String, Table from sqlalchemy import Text from sqlalchemy.types import NullType -from nova.i18n import _LE - LOG = logging.getLogger(__name__) @@ -81,7 +79,7 @@ def _create_shadow_tables(migrate_engine): shadow_table.create() except Exception: LOG.info(repr(shadow_table)) - LOG.exception(_LE('Exception while creating table.')) + LOG.exception('Exception while creating table.') raise @@ -1075,7 +1073,7 @@ def upgrade(migrate_engine): table.create() except Exception: LOG.info(repr(table)) - LOG.exception(_LE('Exception while creating table.')) + LOG.exception('Exception while creating table.') raise # task log unique constraint diff --git a/nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py b/nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py index d9484a7bfd..1d123869a9 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/234_add_expire_reservations_index.py @@ -15,8 +15,6 @@ from oslo_log import log as logging from sqlalchemy import Index, MetaData, Table -from nova.i18n import _LI - LOG = logging.getLogger(__name__) @@ -33,8 +31,8 @@ def upgrade(migrate_engine): reservations = Table('reservations', meta, autoload=True) if _get_deleted_expire_index(reservations): - LOG.info(_LI('Skipped adding reservations_deleted_expire_idx ' - 'because an equivalent index already exists.')) + LOG.info('Skipped adding reservations_deleted_expire_idx ' + 'because an equivalent index already exists.') return # Based on expire_reservations query diff --git a/nova/db/sqlalchemy/migrate_repo/versions/248_add_expire_reservations_index.py b/nova/db/sqlalchemy/migrate_repo/versions/248_add_expire_reservations_index.py index d9484a7bfd..1d123869a9 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/248_add_expire_reservations_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/248_add_expire_reservations_index.py @@ -15,8 +15,6 @@ from oslo_log import log as logging from sqlalchemy import Index, MetaData, Table -from nova.i18n import _LI - LOG = logging.getLogger(__name__) @@ -33,8 +31,8 @@ def upgrade(migrate_engine): reservations = Table('reservations', meta, autoload=True) if _get_deleted_expire_index(reservations): - LOG.info(_LI('Skipped adding reservations_deleted_expire_idx ' - 'because an equivalent index already exists.')) + LOG.info('Skipped adding reservations_deleted_expire_idx ' + 'because an equivalent index already exists.') return # Based on expire_reservations query diff --git a/nova/db/sqlalchemy/migrate_repo/versions/274_update_instances_project_id_index.py b/nova/db/sqlalchemy/migrate_repo/versions/274_update_instances_project_id_index.py index 3b8ba9f154..012cf4556a 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/274_update_instances_project_id_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/274_update_instances_project_id_index.py @@ -16,8 +16,6 @@ from oslo_log import log as logging from sqlalchemy import MetaData, Table, Index -from nova.i18n import _LI - LOG = logging.getLogger(__name__) @@ -33,8 +31,8 @@ def upgrade(migrate_engine): for index in instances.indexes: if [c.name for c in index.columns] == ['project_id', 'deleted']: - LOG.info(_LI('Skipped adding instances_project_id_deleted_idx ' - 'because an equivalent index already exists.')) + LOG.info('Skipped adding instances_project_id_deleted_idx ' + 'because an equivalent index already exists.') break else: index = Index('instances_project_id_deleted_idx', diff --git a/nova/db/sqlalchemy/migrate_repo/versions/277_add_fixed_ip_updated_index.py b/nova/db/sqlalchemy/migrate_repo/versions/277_add_fixed_ip_updated_index.py index afba49cd58..bd01c99ac0 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/277_add_fixed_ip_updated_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/277_add_fixed_ip_updated_index.py @@ -13,8 +13,6 @@ from oslo_log import log as logging from sqlalchemy import Index, MetaData, Table -from nova.i18n import _LI - LOG = logging.getLogger(__name__) @@ -37,8 +35,8 @@ def _get_table_index(migrate_engine): def upgrade(migrate_engine): meta, table, index = _get_table_index(migrate_engine) if index: - LOG.info(_LI('Skipped adding %s because an equivalent index' - ' already exists.'), INDEX_NAME) + LOG.info('Skipped adding %s because an equivalent index' + ' already exists.', INDEX_NAME) return columns = [getattr(table.c, col_name) for col_name in INDEX_COLUMNS] index = Index(INDEX_NAME, *columns) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/295_add_virtual_interfaces_uuid_index.py b/nova/db/sqlalchemy/migrate_repo/versions/295_add_virtual_interfaces_uuid_index.py index e3c9445ed2..2402721ceb 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/295_add_virtual_interfaces_uuid_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/295_add_virtual_interfaces_uuid_index.py @@ -14,8 +14,6 @@ from oslo_log import log as logging from sqlalchemy import MetaData, Table, Index -from nova.i18n import _LI - LOG = logging.getLogger(__name__) INDEX_COLUMNS = ['uuid'] @@ -37,8 +35,8 @@ def _get_table_index(migrate_engine): def upgrade(migrate_engine): meta, table, index = _get_table_index(migrate_engine) if index: - LOG.info(_LI('Skipped adding %s because an equivalent index' - ' already exists.'), INDEX_NAME) + LOG.info('Skipped adding %s because an equivalent index' + ' already exists.', INDEX_NAME) return columns = [getattr(table.c, col_name) for col_name in INDEX_COLUMNS] index = Index(INDEX_NAME, *columns) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/319_add_instances_deleted_created_at_index.py b/nova/db/sqlalchemy/migrate_repo/versions/319_add_instances_deleted_created_at_index.py index 5457f70af0..766e6a37cf 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/319_add_instances_deleted_created_at_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/319_add_instances_deleted_created_at_index.py @@ -16,8 +16,6 @@ from oslo_log import log as logging from sqlalchemy import MetaData, Table, Index -from nova.i18n import _LI - LOG = logging.getLogger(__name__) INDEX_COLUMNS = ['deleted', 'created_at'] @@ -39,8 +37,8 @@ def _get_table_index(migrate_engine): def upgrade(migrate_engine): meta, table, index = _get_table_index(migrate_engine) if index: - LOG.info(_LI('Skipped adding %s because an equivalent index' - ' already exists.'), INDEX_NAME) + LOG.info('Skipped adding %s because an equivalent index' + ' already exists.', INDEX_NAME) return columns = [getattr(table.c, col_name) for col_name in INDEX_COLUMNS] index = Index(INDEX_NAME, *columns) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/347_add_updated_at_index.py b/nova/db/sqlalchemy/migrate_repo/versions/347_add_updated_at_index.py index b87fcf6984..65d2ec62e0 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/347_add_updated_at_index.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/347_add_updated_at_index.py @@ -14,8 +14,6 @@ from oslo_log import log as logging from sqlalchemy import MetaData, Table, Index from sqlalchemy.engine import reflection -from nova.i18n import _LI - LOG = logging.getLogger(__name__) INDEX_COLUMNS_1 = ['project_id'] @@ -42,16 +40,16 @@ def upgrade(migrate_engine): meta.bind = migrate_engine table = Table(TABLE_NAME, meta, autoload=True) if _get_table_index(migrate_engine, TABLE_NAME, INDEX_COLUMNS_1): - LOG.info(_LI('Skipped adding %s because an equivalent index' - ' already exists.'), INDEX_NAME_1) + LOG.info('Skipped adding %s because an equivalent index' + ' already exists.', INDEX_NAME_1) else: columns = [getattr(table.c, col_name) for col_name in INDEX_COLUMNS_1] index = Index(INDEX_NAME_1, *columns) index.create(migrate_engine) if _get_table_index(migrate_engine, TABLE_NAME, INDEX_COLUMNS_2): - LOG.info(_LI('Skipped adding %s because an equivalent index' - ' already exists.'), INDEX_NAME_2) + LOG.info('Skipped adding %s because an equivalent index' + ' already exists.', INDEX_NAME_2) else: columns = [getattr(table.c, col_name) for col_name in INDEX_COLUMNS_2] index = Index(INDEX_NAME_2, *columns) diff --git a/nova/db/sqlalchemy/utils.py b/nova/db/sqlalchemy/utils.py index f408cb9bd8..85770d6258 100644 --- a/nova/db/sqlalchemy/utils.py +++ b/nova/db/sqlalchemy/utils.py @@ -23,7 +23,7 @@ from sqlalchemy.types import NullType from nova.db.sqlalchemy import api as db from nova import exception -from nova.i18n import _, _LE +from nova.i18n import _ LOG = logging.getLogger(__name__) @@ -109,8 +109,8 @@ def create_shadow_table(migrate_engine, table_name=None, table=None, # which raises unwrapped OperationalError, so we should catch it until # oslo.db would wraps all such exceptions LOG.info(repr(shadow_table)) - LOG.exception(_LE('Exception while creating table.')) + LOG.exception('Exception while creating table.') raise exception.ShadowTableExists(name=shadow_table_name) except Exception: LOG.info(repr(shadow_table)) - LOG.exception(_LE('Exception while creating table.')) + LOG.exception('Exception while creating table.') |