From 1adb8f575ec41edcade5ad10aad2c98ecd7bcc20 Mon Sep 17 00:00:00 2001 From: ankitagrawal Date: Mon, 16 Mar 2015 06:01:59 -0700 Subject: [PATCH] Fix missing translations for log messages Fixed log translations in sqlalchemy module for error, info and warning messages with appropriate marker function according to the logging standards [1]. As LOG.warn has deprecated [2] so I have changed LOG.warn to LOG.warning. [1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html [2] http://bugs.python.org/issue13235 Partial-Bug: 1431256 Change-Id: Icec6775ca54b47bd0aa7796d5656a0f42a599f51 --- cinder/db/sqlalchemy/api.py | 33 +++++++++---------- .../migrate_repo/versions/001_cinder_init.py | 6 ++-- .../migrate_repo/versions/002_quota_class.py | 3 +- .../versions/003_glance_metadata.py | 8 ++--- .../versions/004_volume_type_to_uuid.py | 6 ++-- .../migrate_repo/versions/008_add_backup.py | 6 ++-- .../009_add_snapshot_metadata_table.py | 6 ++-- .../versions/010_add_transfers_table.py | 6 ++-- .../versions/016_drop_sm_tables.py | 6 ++-- .../017_add_encryption_information.py | 18 +++++----- .../versions/018_add_qos_specs.py | 13 ++++---- .../020_add_volume_admin_metadata_table.py | 6 ++-- .../023_add_expire_reservations_index.py | 10 +++--- .../versions/025_add_consistencygroup.py | 26 +++++++-------- .../026_add_consistencygroup_quota_class.py | 14 ++++---- .../versions/032_add_volume_type_projects.py | 10 +++--- cinder/hacking/checks.py | 1 - 17 files changed, 89 insertions(+), 89 deletions(-) diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index b2dd5c8cd..17199ad99 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -218,9 +218,9 @@ def _retry_on_deadlock(f): try: return f(*args, **kwargs) except db_exc.DBDeadlock: - LOG.warn(_LW("Deadlock detected when running " - "'%(func_name)s': Retrying..."), - dict(func_name=f.__name__)) + LOG.warning(_LW("Deadlock detected when running " + "'%(func_name)s': Retrying..."), + dict(func_name=f.__name__)) # Retry! time.sleep(0.5) continue @@ -875,7 +875,7 @@ def quota_reserve(context, resources, quotas, deltas, expire, if unders: LOG.warning(_LW("Change will make usage less than 0 for the following " - "resources: %s") % unders) + "resources: %s"), unders) if overs: usages = dict((k, dict(in_use=v['in_use'], reserved=v['reserved'])) for k, v in usages.items()) @@ -1636,7 +1636,7 @@ def process_sort_params(sort_keys, sort_dirs, default_keys=None, # Verify sort direction for sort_dir in sort_dirs: if sort_dir not in ('asc', 'desc'): - msg = _LE("Unknown sort direction, must be 'desc' or 'asc'.") + msg = _("Unknown sort direction, must be 'desc' or 'asc'.") raise exception.InvalidInput(reason=msg) result_dirs.append(sort_dir) else: @@ -1647,7 +1647,7 @@ def process_sort_params(sort_keys, sort_dirs, default_keys=None, result_dirs.append(default_dir_value) # Unless more direction are specified, which is an error if len(result_dirs) > len(result_keys): - msg = _LE("Sort direction array size exceeds sort key array size.") + msg = _("Sort direction array size exceeds sort key array size.") raise exception.InvalidInput(reason=msg) # Ensure defaults are included @@ -2487,8 +2487,8 @@ def volume_type_destroy(context, id): results = model_query(context, models.Volume, session=session). \ filter_by(volume_type_id=id).all() if results: - msg = _('VolumeType %s deletion failed, VolumeType in use.') % id - LOG.error(msg) + LOG.error(_LE('VolumeType %s deletion failed, ' + 'VolumeType in use.'), id) raise exception.VolumeTypeInUse(volume_type_id=id) model_query(context, models.VolumeTypes, session=session).\ filter_by(id=id).\ @@ -2908,7 +2908,7 @@ def qos_specs_update(context, qos_specs_id, specs): value = dict(id=id, key=key, value=specs[key], specs_id=qos_specs_id, deleted=False) - LOG.debug('qos_specs_update() value: %s' % value) + LOG.debug('qos_specs_update() value: %s', value) spec_ref.update(value) spec_ref.save(session=session) @@ -3380,9 +3380,8 @@ def transfer_destroy(context, transfer_id): # If the volume state is not 'awaiting-transfer' don't change it, but # we can still mark the transfer record as deleted. if volume_ref['status'] != 'awaiting-transfer': - msg = _('Volume in unexpected state %s, ' - 'expected awaiting-transfer') % volume_ref['status'] - LOG.error(msg) + LOG.error(_LE('Volume in unexpected state %s, expected ' + 'awaiting-transfer'), volume_ref['status']) else: volume_ref['status'] = 'available' volume_ref.update(volume_ref) @@ -3610,13 +3609,13 @@ def purge_deleted_rows(context, age_in_days): try: age_in_days = int(age_in_days) except ValueError: - msg = _LE('Invalid value for age, %(age)s') - LOG.exception(msg, {'age': age_in_days}) - raise exception.InvalidParameterValue(msg % {'age': age_in_days}) - if age_in_days <= 0: - msg = _LE('Must supply a positive value for age') + msg = _('Invalid value for age, %(age)s') % {'age': age_in_days} LOG.exception(msg) raise exception.InvalidParameterValue(msg) + if age_in_days <= 0: + msg = _('Must supply a positive value for age') + LOG.error(msg) + raise exception.InvalidParameterValue(msg) engine = get_engine() session = get_session() diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py b/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py index b22e43a1f..4666a9a79 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py @@ -16,7 +16,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Integer, MetaData, String, Table -from cinder.i18n import _ +from cinder.i18n import _LE, _LI LOG = logging.getLogger(__name__) @@ -240,7 +240,7 @@ def upgrade(migrate_engine): table.create() except Exception: LOG.info(repr(table)) - LOG.exception(_('Exception while creating table.')) + LOG.exception(_LE('Exception while creating table.')) raise if migrate_engine.name == "mysql": @@ -275,5 +275,5 @@ def downgrade(migrate_engine): tables = define_tables(meta) tables.reverse() for table in tables: - LOG.info("dropping table %(table)s" % {'table': table}) + LOG.info(_LI("dropping table %(table)s"), {'table': table}) table.drop() diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py b/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py index 0227ab466..6d801e0f4 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py @@ -132,8 +132,7 @@ def downgrade(migrate_engine): fkey = ForeignKeyConstraint(**params) fkey.drop() except Exception: - msg = _LE("Dropping foreign key %s failed.") - LOG.error(msg, fk_name) + LOG.error(_LE("Dropping foreign key %s failed."), fk_name) quota_classes = Table('quota_classes', meta, autoload=True) try: diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py b/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py index 9f07a2f2d..52e1a61d6 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py @@ -16,7 +16,7 @@ from oslo_log import log as logging from sqlalchemy import Column, DateTime, Text, Boolean from sqlalchemy import MetaData, Integer, String, Table, ForeignKey -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -56,8 +56,8 @@ def upgrade(migrate_engine): try: volume_glance_metadata.create() except Exception: - LOG.exception(_("Exception while creating table " - "'volume_glance_metadata'")) + LOG.exception(_LE("Exception while creating table " + "'volume_glance_metadata'")) meta.drop_all(tables=[volume_glance_metadata]) raise @@ -71,5 +71,5 @@ def downgrade(migrate_engine): try: volume_glance_metadata.drop() except Exception: - LOG.error(_("volume_glance_metadata table not dropped")) + LOG.error(_LE("volume_glance_metadata table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py b/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py index 253ba6523..745cdf432 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py @@ -16,6 +16,8 @@ from migrate import ForeignKeyConstraint from oslo_log import log as logging from sqlalchemy import Integer, MetaData, String, Table +from cinder.i18n import _LI + LOG = logging.getLogger(__name__) @@ -77,7 +79,7 @@ def upgrade(migrate_engine): name=fkey_name) try: fkey.create() - LOG.info('Created foreign key %s' % fkey_name) + LOG.info(_LI('Created foreign key %s'), fkey_name) except Exception: if migrate_engine.url.get_dialect().name.startswith('sqlite'): pass @@ -156,7 +158,7 @@ def downgrade(migrate_engine): name=fkey_name) try: fkey.create() - LOG.info('Created foreign key %s' % fkey_name) + LOG.info(_LI('Created foreign key %s'), fkey_name) except Exception: if migrate_engine.url.get_dialect().name.startswith('sqlite'): pass diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py b/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py index 59610adec..9a899f37d 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py @@ -17,7 +17,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import MetaData, Integer, String, Table -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -54,7 +54,7 @@ def upgrade(migrate_engine): try: backups.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(backups)) + LOG.error(_LE("Table |%s| not created!"), repr(backups)) raise @@ -66,5 +66,5 @@ def downgrade(migrate_engine): try: backups.drop() except Exception: - LOG.error(_("backups table not dropped")) + LOG.error(_LE("backups table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/009_add_snapshot_metadata_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/009_add_snapshot_metadata_table.py index b5377115e..7c33382c8 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/009_add_snapshot_metadata_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/009_add_snapshot_metadata_table.py @@ -14,7 +14,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import Integer, MetaData, String, Table, ForeignKey -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -43,7 +43,7 @@ def upgrade(migrate_engine): try: snapshot_metadata.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(snapshot_metadata)) + LOG.error(_LE("Table |%s| not created!"), repr(snapshot_metadata)) raise @@ -56,5 +56,5 @@ def downgrade(migrate_engine): try: snapshot_metadata.drop() except Exception: - LOG.error(_("snapshot_metadata table not dropped")) + LOG.error(_LE("snapshot_metadata table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py index 9f5b2dec3..d0ef39c5d 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py @@ -14,7 +14,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import MetaData, String, Table, ForeignKey -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -46,7 +46,7 @@ def upgrade(migrate_engine): try: transfers.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(transfers)) + LOG.error(_LE("Table |%s| not created!"), repr(transfers)) raise @@ -59,5 +59,5 @@ def downgrade(migrate_engine): try: transfers.drop() except Exception: - LOG.error(_("transfers table not dropped")) + LOG.error(_LE("transfers table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py b/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py index 20aa71393..62a84d620 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py @@ -16,7 +16,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Integer, MetaData, String, Table -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -35,7 +35,7 @@ def upgrade(migrate_engine): try: table.drop() except Exception: - LOG.exception(_('Exception while dropping table %s.'), + LOG.exception(_LE('Exception while dropping table %s.'), repr(table)) raise @@ -98,6 +98,6 @@ def downgrade(migrate_engine): try: table.create() except Exception: - LOG.exception(_('Exception while creating table %s.'), + LOG.exception(_LE('Exception while creating table %s.'), repr(table)) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py b/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py index 766eaffd0..8659ea8e3 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py @@ -17,7 +17,7 @@ from oslo_log import log as logging from sqlalchemy import Column, ForeignKey, MetaData, Table from sqlalchemy import Boolean, DateTime, Integer, String -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -32,7 +32,7 @@ def upgrade(migrate_engine): try: volumes.create_column(encryption_key) except Exception: - LOG.error(_("Column |%s| not created!"), repr(encryption_key)) + LOG.error(_LE("Column |%s| not created!"), repr(encryption_key)) raise # encryption key UUID and volume type id -- must be stored per snapshot @@ -41,13 +41,13 @@ def upgrade(migrate_engine): try: snapshots.create_column(encryption_key) except Exception: - LOG.error(_("Column |%s| not created!"), repr(encryption_key)) + LOG.error(_LE("Column |%s| not created!"), repr(encryption_key)) raise volume_type = Column('volume_type_id', String(36)) try: snapshots.create_column(volume_type) except Exception: - LOG.error(_("Column |%s| not created!"), repr(volume_type)) + LOG.error(_LE("Column |%s| not created!"), repr(volume_type)) raise volume_types = Table('volume_types', meta, autoload=True) @@ -78,7 +78,7 @@ def upgrade(migrate_engine): try: encryption.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(encryption)) + LOG.error(_LE("Table |%s| not created!"), repr(encryption)) raise @@ -90,7 +90,7 @@ def downgrade(migrate_engine): try: volumes.c.encryption_key_id.drop() except Exception: - LOG.error(_("encryption_key_id column not dropped from volumes")) + LOG.error(_LE("encryption_key_id column not dropped from volumes")) raise # drop encryption key UUID and volume type id for snapshots @@ -98,12 +98,12 @@ def downgrade(migrate_engine): try: snapshots.c.encryption_key_id.drop() except Exception: - LOG.error(_("encryption_key_id column not dropped from snapshots")) + LOG.error(_LE("encryption_key_id column not dropped from snapshots")) raise try: snapshots.c.volume_type_id.drop() except Exception: - LOG.error(_("volume_type_id column not dropped from snapshots")) + LOG.error(_LE("volume_type_id column not dropped from snapshots")) raise # drop encryption types table @@ -111,5 +111,5 @@ def downgrade(migrate_engine): try: encryption.drop() except Exception: - LOG.error(_("encryption table not dropped")) + LOG.error(_LE("encryption table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py b/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py index 643d6b785..1ca1d9fdc 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py @@ -19,7 +19,7 @@ from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import ForeignKey, MetaData, String, Table from migrate import ForeignKeyConstraint -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -47,7 +47,7 @@ def upgrade(migrate_engine): try: quality_of_service_specs.create() except Exception: - LOG.error(_("Table quality_of_service_specs not created!")) + LOG.error(_LE("Table quality_of_service_specs not created!")) raise volume_types = Table('volume_types', meta, autoload=True) @@ -58,7 +58,8 @@ def upgrade(migrate_engine): volume_types.create_column(qos_specs_id) volume_types.update().values(qos_specs_id=None).execute() except Exception: - LOG.error(_("Added qos_specs_id column to volume type table failed.")) + LOG.error(_LE("Added qos_specs_id column to volume type table " + "failed.")) raise @@ -83,7 +84,7 @@ def downgrade(migrate_engine): fkey = ForeignKeyConstraint(**params) fkey.drop() except Exception: - LOG.error(_("Dropping foreign key volume_types_ibfk_1 failed")) + LOG.error(_LE("Dropping foreign key volume_types_ibfk_1 failed")) volume_types = Table('volume_types', meta, autoload=True) qos_specs_id = Column('qos_specs_id', String(36)) @@ -91,12 +92,12 @@ def downgrade(migrate_engine): try: volume_types.drop_column(qos_specs_id) except Exception: - LOG.error(_("Dropping qos_specs_id column failed.")) + LOG.error(_LE("Dropping qos_specs_id column failed.")) raise try: qos_specs.drop() except Exception: - LOG.error(_("Dropping quality_of_service_specs table failed.")) + LOG.error(_LE("Dropping quality_of_service_specs table failed.")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py b/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py index 5d52ccd86..0eb95b374 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py @@ -14,7 +14,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import Integer, MetaData, String, Table, ForeignKey -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -44,7 +44,7 @@ def upgrade(migrate_engine): try: volume_admin_metadata.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(volume_admin_metadata)) + LOG.error(_LE("Table |%s| not created!"), repr(volume_admin_metadata)) raise @@ -57,5 +57,5 @@ def downgrade(migrate_engine): try: volume_admin_metadata.drop() except Exception: - LOG.error(_("volume_admin_metadata table not dropped")) + LOG.error(_LE("volume_admin_metadata table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py b/cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py index 07fa3f7a8..71000ef20 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py @@ -15,7 +15,7 @@ from oslo_log import log as logging from sqlalchemy import Index, MetaData, Table -from cinder.i18n import _ +from cinder.i18n import _LI LOG = logging.getLogger(__name__) @@ -33,8 +33,8 @@ def upgrade(migrate_engine): reservations = Table('reservations', meta, autoload=True) if _get_deleted_expire_index(reservations): - LOG.info(_('Skipped adding reservations_deleted_expire_idx ' - 'because an equivalent index already exists.')) + LOG.info(_LI('Skipped adding reservations_deleted_expire_idx ' + 'because an equivalent index already exists.')) return # Based on expire_reservations query @@ -55,5 +55,5 @@ def downgrade(migrate_engine): if index: index.drop(migrate_engine) else: - LOG.info(_('Skipped removing reservations_deleted_expire_idx ' - 'because index does not exist.')) + LOG.info(_LI('Skipped removing reservations_deleted_expire_idx ' + 'because index does not exist.')) diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/025_add_consistencygroup.py b/cinder/db/sqlalchemy/migrate_repo/versions/025_add_consistencygroup.py index 82d48c16c..5aea1a091 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/025_add_consistencygroup.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/025_add_consistencygroup.py @@ -18,7 +18,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime from sqlalchemy import ForeignKey, MetaData, String, Table -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -50,7 +50,7 @@ def upgrade(migrate_engine): try: consistencygroups.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(consistencygroups)) + LOG.error(_LE("Table |%s| not created!"), repr(consistencygroups)) raise # New table @@ -76,7 +76,7 @@ def upgrade(migrate_engine): try: cgsnapshots.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(cgsnapshots)) + LOG.error(_LE("Table |%s| not created!"), repr(cgsnapshots)) raise # Add column to volumes table @@ -87,8 +87,8 @@ def upgrade(migrate_engine): volumes.create_column(consistencygroup_id) volumes.update().values(consistencygroup_id=None).execute() except Exception: - LOG.error(_("Adding consistencygroup_id column to volumes table" - " failed.")) + LOG.error(_LE("Adding consistencygroup_id column to volumes table" + " failed.")) raise # Add column to snapshots table @@ -100,8 +100,8 @@ def upgrade(migrate_engine): snapshots.create_column(cgsnapshot_id) snapshots.update().values(cgsnapshot_id=None).execute() except Exception: - LOG.error(_("Adding cgsnapshot_id column to snapshots table" - " failed.")) + LOG.error(_LE("Adding cgsnapshot_id column to snapshots table" + " failed.")) raise @@ -124,8 +124,8 @@ def downgrade(migrate_engine): fkey = ForeignKeyConstraint(**params) fkey.drop() except Exception: - LOG.error(_("Dropping foreign key 'cgsnapshot_id' in " - "the 'snapshots' table failed.")) + LOG.error(_LE("Dropping foreign key 'cgsnapshot_id' in " + "the 'snapshots' table failed.")) snapshots = Table('snapshots', meta, autoload=True) cgsnapshot_id = snapshots.columns.cgsnapshot_id @@ -146,8 +146,8 @@ def downgrade(migrate_engine): fkey = ForeignKeyConstraint(**params) fkey.drop() except Exception: - LOG.error(_("Dropping foreign key 'consistencygroup_id' in " - "the 'volumes' table failed.")) + LOG.error(_LE("Dropping foreign key 'consistencygroup_id' in " + "the 'volumes' table failed.")) volumes = Table('volumes', meta, autoload=True) consistencygroup_id = volumes.columns.consistencygroup_id @@ -158,7 +158,7 @@ def downgrade(migrate_engine): try: cgsnapshots.drop() except Exception: - LOG.error(_("cgsnapshots table not dropped")) + LOG.error(_LE("cgsnapshots table not dropped")) raise # Drop table @@ -166,5 +166,5 @@ def downgrade(migrate_engine): try: consistencygroups.drop() except Exception: - LOG.error(_("consistencygroups table not dropped")) + LOG.error(_LE("consistencygroups table not dropped")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/026_add_consistencygroup_quota_class.py b/cinder/db/sqlalchemy/migrate_repo/versions/026_add_consistencygroup_quota_class.py index 7d2413eaa..5b3c5307d 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/026_add_consistencygroup_quota_class.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/026_add_consistencygroup_quota_class.py @@ -18,7 +18,7 @@ from oslo_config import cfg from oslo_log import log as logging from sqlalchemy import MetaData, Table -from cinder.i18n import _ +from cinder.i18n import _LE, _LI # Get default values via config. The defaults will either # come from the default values set in the quota option @@ -45,8 +45,8 @@ def upgrade(migrate_engine): # Do not add entries if there are already 'consistencygroups' entries. if rows: - LOG.info(_("Found existing 'consistencygroups' entries in the" - "quota_classes table. Skipping insertion.")) + LOG.info(_LI("Found existing 'consistencygroups' entries in the " + "quota_classes table. Skipping insertion.")) return try: @@ -57,11 +57,11 @@ def upgrade(migrate_engine): 'resource': 'consistencygroups', 'hard_limit': CONF.quota_consistencygroups, 'deleted': False, }) - LOG.info(_("Added default consistencygroups quota class data into " - "the DB.")) + LOG.info(_LI("Added default consistencygroups quota class data into " + "the DB.")) except Exception: - LOG.error(_("Default consistencygroups quota class data not inserted " - "into the DB.")) + LOG.error(_LE("Default consistencygroups quota class data not " + "inserted into the DB.")) raise diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/032_add_volume_type_projects.py b/cinder/db/sqlalchemy/migrate_repo/versions/032_add_volume_type_projects.py index a72b8cb7a..41846646f 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/032_add_volume_type_projects.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/032_add_volume_type_projects.py @@ -14,7 +14,7 @@ from oslo_log import log as logging from sqlalchemy import Boolean, Column, DateTime, UniqueConstraint from sqlalchemy import Integer, MetaData, String, Table, ForeignKey -from cinder.i18n import _ +from cinder.i18n import _LE LOG = logging.getLogger(__name__) @@ -30,7 +30,7 @@ def upgrade(migrate_engine): # pylint: disable=E1120 volume_types.update().values(is_public=True).execute() except Exception: - LOG.error(_("Column |%s| not created!"), repr(is_public)) + LOG.error(_LE("Column |%s| not created!"), repr(is_public)) raise volume_type_projects = Table( @@ -50,7 +50,7 @@ def upgrade(migrate_engine): try: volume_type_projects.create() except Exception: - LOG.error(_("Table |%s| not created!"), repr(volume_type_projects)) + LOG.error(_LE("Table |%s| not created!"), repr(volume_type_projects)) raise @@ -63,12 +63,12 @@ def downgrade(migrate_engine): try: volume_types.drop_column(is_public) except Exception: - LOG.error(_("volume_types.is_public column not dropped")) + LOG.error(_LE("volume_types.is_public column not dropped")) raise volume_type_projects = Table('volume_type_projects', meta, autoload=True) try: volume_type_projects.drop() except Exception: - LOG.error(_("volume_type_projects table not dropped")) + LOG.error(_LE("volume_type_projects table not dropped")) raise diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index 1b11eba59..7a9b43603 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -215,7 +215,6 @@ def validate_log_translations(logical_line, filename): # of patches are done to address these issues. It should be # removed completely when bug 1433216 is closed. ignore_dirs = [ - "cinder/db", "cinder/openstack", "cinder/volume"] for directory in ignore_dirs: -- 2.45.2