]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix missing translations for log messages
authorankitagrawal <ankit11.agrawal@nttdata.com>
Mon, 16 Mar 2015 13:01:59 +0000 (06:01 -0700)
committerankitagrawal <ankit11.agrawal@nttdata.com>
Thu, 7 May 2015 11:18:56 +0000 (04:18 -0700)
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

17 files changed:
cinder/db/sqlalchemy/api.py
cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py
cinder/db/sqlalchemy/migrate_repo/versions/002_quota_class.py
cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py
cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py
cinder/db/sqlalchemy/migrate_repo/versions/008_add_backup.py
cinder/db/sqlalchemy/migrate_repo/versions/009_add_snapshot_metadata_table.py
cinder/db/sqlalchemy/migrate_repo/versions/010_add_transfers_table.py
cinder/db/sqlalchemy/migrate_repo/versions/016_drop_sm_tables.py
cinder/db/sqlalchemy/migrate_repo/versions/017_add_encryption_information.py
cinder/db/sqlalchemy/migrate_repo/versions/018_add_qos_specs.py
cinder/db/sqlalchemy/migrate_repo/versions/020_add_volume_admin_metadata_table.py
cinder/db/sqlalchemy/migrate_repo/versions/023_add_expire_reservations_index.py
cinder/db/sqlalchemy/migrate_repo/versions/025_add_consistencygroup.py
cinder/db/sqlalchemy/migrate_repo/versions/026_add_consistencygroup_quota_class.py
cinder/db/sqlalchemy/migrate_repo/versions/032_add_volume_type_projects.py
cinder/hacking/checks.py

index b2dd5c8cdcd0dd1e2f7ef12b312d628a6572e5c9..17199ad99bbc036dd3d251ec4f76b8ac0674088f 100644 (file)
@@ -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()
index b22e43a1f7aa245106577a4d6af642ed43aa0655..4666a9a796ac7cff5795289e915a5744d22a51c1 100644 (file)
@@ -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()
index 0227ab46687ff9b44fa8a427453da3d5084823b1..6d801e0f449a02541c16bd6b10eb79c2cf7c0cf1 100644 (file)
@@ -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:
index 9f07a2f2d4f6ab200847af92e353da87d3bc3907..52e1a61d65ea04fd7fb26ce11fda8c1a8c7df847 100644 (file)
@@ -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
index 253ba65237082e857cf908d30fed11d23272d08d..745cdf43217ad79ea55c94251176c583c169b337 100644 (file)
@@ -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
index 59610adec14c5ca3f607949966a1aa40dd810c1c..9a899f37d268e2a5bda4d71fa6df94b96f01deed 100644 (file)
@@ -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
index b5377115e9de74110d6e5303fb9dfd0fa021401a..7c33382c8cc1a6d09599bbee42493615374fc7ec 100644 (file)
@@ -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
index 9f5b2dec3994af40a82a0230be0af8d538e492f1..d0ef39c5df884f1e3c374f009c9f739b751d23c5 100644 (file)
@@ -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
index 20aa713937385f79ae4c4e562318e70eb3c2fb36..62a84d6201e53c89cc9837b221a686051ea57641 100644 (file)
@@ -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
index 766eaffd00171adbcb8652087c0a5e916db0fa86..8659ea8e38cb1c77ff0e3340153a5d31412069c6 100644 (file)
@@ -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
index 643d6b785ce140660f10bfd57bcfa52640b42609..1ca1d9fdcc38a81bd070a42e85b36d72fd07d8b6 100644 (file)
@@ -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
index 5d52ccd86fc7c4b09692e015130ab64c6c96113e..0eb95b37406480a3826167b5fe2550271e1e5800 100644 (file)
@@ -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
index 07fa3f7a8f1eccbcae0763fb9f49237dee03e0a6..71000ef20052acede969382877dbdeebcca4ae89 100644 (file)
@@ -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.'))
index 82d48c16c9aaf14a929a95dc71a31f3f94ebac28..5aea1a09158ccd9df1733d63ff32832917616bac 100644 (file)
@@ -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
index 7d2413eaa7d21e1bb6d9b9ecb757297d60b80abc..5b3c5307d516b25710514accfd28acb581c9b97a 100644 (file)
@@ -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
 
 
index a72b8cb7a4cf294a3f56e69fd4553b2bd809e7cf..41846646f3220a95a57c64a157e00992f81f7891 100644 (file)
@@ -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
index 1b11eba595f1c3b80709e02f345f6ee56366153e..7a9b43603b619f9f1e4a8e92e8a9e30d9afb563e 100644 (file)
@@ -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: