From: daisy-ycguo <daisy.ycguo@gmail.com>
Date: Wed, 21 Nov 2012 16:16:04 +0000 (+0800)
Subject: Provide i18n to those messages without _()
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e78667da0dbcb6b65dc9017822854c9e97f5a4ab;p=openstack-build%2Fcinder-build.git

Provide i18n to those messages without _()

bug 1081498

There are a few log messages without _(), but a lot messages with _().
Wrap these log messages with _() in order to make the code consistent.

Change-Id: Ie8961453569e9a75bd0fd0733344db8059d05222
---

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 6ca30faa9..e46faf4b1 100644
--- a/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py
+++ b/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py
@@ -240,7 +240,7 @@ def upgrade(migrate_engine):
             table.create()
         except Exception:
             LOG.info(repr(table))
-            LOG.exception('Exception while creating table.')
+            LOG.exception(_('Exception while creating table.'))
             raise
 
     if migrate_engine.name == "mysql":
@@ -269,4 +269,4 @@ def upgrade(migrate_engine):
 
 
 def downgrade(migrate_engine):
-    LOG.exception('Downgrade from initial Cinder install is unsupported.')
+    LOG.exception(_('Downgrade from initial Cinder install is unsupported.'))
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 ff990a9e5..6fdf0750c 100644
--- a/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py
+++ b/cinder/db/sqlalchemy/migrate_repo/versions/003_glance_metadata.py
@@ -55,8 +55,8 @@ def upgrade(migrate_engine):
     try:
         volume_glance_metadata.create()
     except Exception:
-        LOG.exception("Exception while creating table "
-                      "'volume_glance_metedata'")
+        LOG.exception(_("Exception while creating table "
+                        "'volume_glance_metedata'"))
         meta.drop_all(tables=[volume_glance_metadata])
         raise
 
diff --git a/cinder/db/sqlalchemy/session.py b/cinder/db/sqlalchemy/session.py
index 26b02299d..e1b06fb3a 100644
--- a/cinder/db/sqlalchemy/session.py
+++ b/cinder/db/sqlalchemy/session.py
@@ -68,7 +68,7 @@ def ping_listener(dbapi_conn, connection_rec, connection_proxy):
         dbapi_conn.cursor().execute('select 1')
     except dbapi_conn.OperationalError, ex:
         if ex.args[0] in (2006, 2013, 2014, 2045, 2055):
-            LOG.warn('Got mysql server has gone away: %s', ex)
+            LOG.warn(_('Got mysql server has gone away: %s'), ex)
             raise DisconnectionError("Database server went away")
         else:
             raise
diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py
index 8b2fc3be1..1cce2f3f8 100644
--- a/cinder/volume/drivers/nfs.py
+++ b/cinder/volume/drivers/nfs.py
@@ -191,7 +191,7 @@ class NfsDriver(driver.VolumeDriver):
                 self._ensure_share_mounted(share)
                 self._mounted_shares.append(share)
             except Exception, exc:
-                LOG.warning('Exception during mounting %s' % (exc,))
+                LOG.warning(_('Exception during mounting %s') % (exc,))
 
         LOG.debug('Available shares %s' % str(self._mounted_shares))