Remove log translations in cmd,common,data,db and network 2/5

Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.
This is the 2/5 commit.
Old commit will be abandoned: https://review.openstack.org/#/c/447822/

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Idd32423ebc0d92fa6311955e6a5edf088ab9219f
Depends-On: I9fd264a443c634465b8548067f86ac14c1a51faa
Partial-Bug: #1674542
This commit is contained in:
yfzhao 2017-03-24 16:13:48 +08:00
parent ed19930c72
commit b709ec37b6
21 changed files with 119 additions and 222 deletions

View File

@ -1,82 +0,0 @@
#!/usr/bin/env python
# Copyright 2011 OpenStack, LLC
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Starter script for All manila services.
This script attempts to start all the manila services in one process. Each
service is started in its own greenthread. Please note that exceptions and
sys.exit() on the starting of a service are logged and the script will
continue attempting to launch the rest of the services.
"""
import eventlet
eventlet.monkey_patch()
import sys
from oslo_config import cfg
from oslo_log import log
from oslo_log import versionutils
from manila import i18n
i18n.enable_lazy()
from manila.common import config # Need to register global_opts
from manila.i18n import _
from manila.i18n import _LE
from manila import service
from manila import utils
from manila import version
CONF = cfg.CONF
def main():
log.register_options(CONF)
config.set_middleware_defaults()
CONF(sys.argv[1:], project='manila',
version=version.version_string())
log.setup(CONF, "manila")
LOG = log.getLogger('manila.all')
msg = _('manila-all is deprecated in Newton and '
'will be removed in Ocata.')
versionutils.report_deprecated_feature(LOG, msg)
utils.monkey_patch()
launcher = service.process_launcher()
# manila-api
try:
server = service.WSGIService('osapi_share')
launcher.launch_service(server, workers=server.workers or 1)
except (Exception, SystemExit):
LOG.exception(_LE('Failed to load osapi_share'))
for binary in ['manila-share', 'manila-scheduler', 'manila-api',
'manila-data']:
try:
launcher.launch_service(service.Service.create(binary=binary))
except (Exception, SystemExit):
LOG.exception(_LE('Failed to load %s'), binary)
launcher.wait()
if __name__ == '__main__':
main()

View File

@ -21,7 +21,7 @@ from oslo_config import cfg
from oslo_log import log from oslo_log import log
from manila import exception from manila import exception
from manila.i18n import _, _LW from manila.i18n import _
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -78,7 +78,7 @@ class AuthClientLoader(object):
CONF, self.group) CONF, self.group)
if self.deprecated_opts_for_v2 and not self.auth_plugin: if self.deprecated_opts_for_v2 and not self.auth_plugin:
LOG.warning(_LW("Not specifying auth options is deprecated")) LOG.warning("Not specifying auth options is deprecated")
self.auth_plugin = v2.Password().load_from_options( self.auth_plugin = v2.Password().load_from_options(
**self.deprecated_opts_for_v2) **self.deprecated_opts_for_v2)

View File

@ -21,7 +21,7 @@ from oslo_log import log
from manila.common import constants from manila.common import constants
from manila import exception from manila import exception
from manila.i18n import _, _LW from manila.i18n import _
from manila.share import access as access_manager from manila.share import access as access_manager
from manila.share import rpcapi as share_rpc from manila.share import rpcapi as share_rpc
from manila import utils from manila import utils
@ -84,7 +84,7 @@ class DataServiceHelper(object):
self.deny_access_to_data_service( self.deny_access_to_data_service(
access_ref_list, share_instance_id) access_ref_list, share_instance_id)
except Exception: except Exception:
LOG.warning(_LW("Could not cleanup access rule of share %s."), LOG.warning("Could not cleanup access rule of share %s.",
self.share['id']) self.share['id'])
def cleanup_temp_folder(self, instance_id, mount_path): def cleanup_temp_folder(self, instance_id, mount_path):
@ -95,11 +95,11 @@ class DataServiceHelper(object):
os.rmdir(path) os.rmdir(path)
self._check_dir_not_exists(path) self._check_dir_not_exists(path)
except Exception: except Exception:
LOG.warning(_LW("Could not cleanup instance %(instance_id)s " LOG.warning("Could not cleanup instance %(instance_id)s "
"temporary folders for data copy of " "temporary folders for data copy of "
"share %(share_id)s."), { "share %(share_id)s.", {
'instance_id': instance_id, 'instance_id': instance_id,
'share_id': self.share['id']}) 'share_id': self.share['id']})
def cleanup_unmount_temp_folder(self, unmount_template, mount_path, def cleanup_unmount_temp_folder(self, unmount_template, mount_path,
share_instance_id): share_instance_id):
@ -108,11 +108,11 @@ class DataServiceHelper(object):
self.unmount_share_instance(unmount_template, mount_path, self.unmount_share_instance(unmount_template, mount_path,
share_instance_id) share_instance_id)
except Exception: except Exception:
LOG.warning(_LW("Could not unmount folder of instance" LOG.warning("Could not unmount folder of instance"
" %(instance_id)s for data copy of " " %(instance_id)s for data copy of "
"share %(share_id)s."), { "share %(share_id)s.", {
'instance_id': share_instance_id, 'instance_id': share_instance_id,
'share_id': self.share['id']}) 'share_id': self.share['id']})
def _change_data_access_to_instance(self, instance, accesses, deny=False): def _change_data_access_to_instance(self, instance, accesses, deny=False):
if not isinstance(accesses, list): if not isinstance(accesses, list):
@ -263,4 +263,4 @@ class DataServiceHelper(object):
os.rmdir(path) os.rmdir(path)
self._check_dir_not_exists(path) self._check_dir_not_exists(path)
except Exception: except Exception:
LOG.warning(_LW("Folder %s could not be removed."), path) LOG.warning("Folder %s could not be removed.", path)

View File

@ -22,7 +22,6 @@ from oslo_config import cfg
from oslo_log import log from oslo_log import log
import six import six
from manila.i18n import _, _LE, _LI, _LW
from manila.common import constants from manila.common import constants
from manila import context from manila import context
from manila.data import helper from manila.data import helper
@ -31,6 +30,8 @@ from manila import exception
from manila import manager from manila import manager
from manila.share import rpcapi as share_rpc from manila.share import rpcapi as share_rpc
from manila.i18n import _
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
data_opts = [ data_opts = [
@ -115,9 +116,9 @@ class DataManager(manager.Manager):
finally: finally:
self.busy_tasks_shares.pop(share_id, None) self.busy_tasks_shares.pop(share_id, None)
LOG.info(_LI( LOG.info(
"Completed copy operation of migrating share content from share " "Completed copy operation of migrating share content from share "
"instance %(instance_id)s to instance %(dest_instance_id)s."), "instance %(instance_id)s to instance %(dest_instance_id)s.",
{'instance_id': share_instance_id, {'instance_id': share_instance_id,
'dest_instance_id': dest_share_instance_id}) 'dest_instance_id': dest_share_instance_id})
@ -139,8 +140,8 @@ class DataManager(manager.Manager):
copy = self.busy_tasks_shares.get(share_id) copy = self.busy_tasks_shares.get(share_id)
if copy: if copy:
result = copy.get_progress() result = copy.get_progress()
LOG.info(_LI("Obtained following data copy information " LOG.info("Obtained following data copy information "
"of share %(share)s: %(info)s."), "of share %(share)s: %(info)s.",
{'share': share_id, {'share': share_id,
'info': six.text_type(result)}) 'info': six.text_type(result)})
return result return result
@ -230,9 +231,9 @@ class DataManager(manager.Manager):
copied = True copied = True
except Exception: except Exception:
LOG.exception(_LE("Failed to copy data from share instance " LOG.exception("Failed to copy data from share instance "
"%(share_instance_id)s to " "%(share_instance_id)s to "
"%(dest_share_instance_id)s."), "%(dest_share_instance_id)s.",
{'share_instance_id': share_instance_id, {'share_instance_id': share_instance_id,
'dest_share_instance_id': dest_share_instance_id}) 'dest_share_instance_id': dest_share_instance_id})
@ -240,38 +241,38 @@ class DataManager(manager.Manager):
helper_src.unmount_share_instance(connection_info_src['unmount'], helper_src.unmount_share_instance(connection_info_src['unmount'],
mount_path, share_instance_id) mount_path, share_instance_id)
except Exception: except Exception:
LOG.exception(_LE("Could not unmount folder of instance" LOG.exception("Could not unmount folder of instance"
" %s after its data copy."), share_instance_id) " %s after its data copy.", share_instance_id)
try: try:
helper_dest.unmount_share_instance( helper_dest.unmount_share_instance(
connection_info_dest['unmount'], mount_path, connection_info_dest['unmount'], mount_path,
dest_share_instance_id) dest_share_instance_id)
except Exception: except Exception:
LOG.exception(_LE("Could not unmount folder of instance" LOG.exception("Could not unmount folder of instance"
" %s after its data copy."), dest_share_instance_id) " %s after its data copy.", dest_share_instance_id)
try: try:
helper_src.deny_access_to_data_service( helper_src.deny_access_to_data_service(
access_ref_list_src, share_instance) access_ref_list_src, share_instance)
except Exception: except Exception:
LOG.exception(_LE("Could not deny access to instance" LOG.exception("Could not deny access to instance"
" %s after its data copy."), share_instance_id) " %s after its data copy.", share_instance_id)
try: try:
helper_dest.deny_access_to_data_service( helper_dest.deny_access_to_data_service(
access_ref_list_dest, dest_share_instance) access_ref_list_dest, dest_share_instance)
except Exception: except Exception:
LOG.exception(_LE("Could not deny access to instance" LOG.exception("Could not deny access to instance"
" %s after its data copy."), dest_share_instance_id) " %s after its data copy.", dest_share_instance_id)
if copy and copy.cancelled: if copy and copy.cancelled:
self.db.share_update( self.db.share_update(
context, src_share['id'], context, src_share['id'],
{'task_state': constants.TASK_STATE_DATA_COPYING_CANCELLED}) {'task_state': constants.TASK_STATE_DATA_COPYING_CANCELLED})
LOG.warning(_LW("Copy of data from share instance " LOG.warning("Copy of data from share instance "
"%(src_instance)s to share instance " "%(src_instance)s to share instance "
"%(dest_instance)s was cancelled."), "%(dest_instance)s was cancelled.",
{'src_instance': share_instance_id, {'src_instance': share_instance_id,
'dest_instance': dest_share_instance_id}) 'dest_instance': dest_share_instance_id})
raise exception.ShareDataCopyCancelled( raise exception.ShareDataCopyCancelled(

View File

@ -28,13 +28,12 @@ import sqlalchemy as sa
from sqlalchemy import Column, String from sqlalchemy import Column, String
from manila.db.migrations import utils from manila.db.migrations import utils
from manila.i18n import _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
def upgrade(): def upgrade():
LOG.info(_LI("Renaming consistency group tables")) LOG.info("Renaming consistency group tables")
# Rename tables # Rename tables
op.rename_table("consistency_groups", "share_groups") op.rename_table("consistency_groups", "share_groups")

View File

@ -29,8 +29,6 @@ from oslo_log import log
from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Boolean, Column, DateTime, ForeignKey
from sqlalchemy import Integer, MetaData, String, Table, UniqueConstraint from sqlalchemy import Integer, MetaData, String, Table, UniqueConstraint
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -399,7 +397,7 @@ def upgrade():
table.create() table.create()
except Exception: except Exception:
LOG.info(repr(table)) LOG.info(repr(table))
LOG.exception(_LE('Exception while creating table.')) LOG.exception('Exception while creating table.')
raise raise
if migrate_engine.name == "mysql": if migrate_engine.name == "mysql":

View File

@ -28,35 +28,32 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sa import sqlalchemy as sa
from manila.i18n import _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
def upgrade(): def upgrade():
LOG.info(_LI("Changing user_id length for share_networks")) LOG.info("Changing user_id length for share_networks")
op.alter_column("share_networks", "user_id", op.alter_column("share_networks", "user_id",
type_=sa.String(length=255)) type_=sa.String(length=255))
LOG.info(_LI("Changing project_id length for share_networks")) LOG.info("Changing project_id length for share_networks")
op.alter_column("share_networks", "project_id", op.alter_column("share_networks", "project_id",
type_=sa.String(length=255)) type_=sa.String(length=255))
LOG.info(_LI("Changing project_id length for security_services")) LOG.info("Changing project_id length for security_services")
op.alter_column("security_services", "project_id", op.alter_column("security_services", "project_id",
type_=sa.String(length=255)) type_=sa.String(length=255))
def downgrade(): def downgrade():
LOG.info(_LI("Changing back user_id length for share_networks")) LOG.info("Changing back user_id length for share_networks")
op.alter_column("share_networks", "user_id", op.alter_column("share_networks", "user_id",
type_=sa.String(length=36)) type_=sa.String(length=36))
LOG.info(_LI("Changing back project_id length for share_networks")) LOG.info("Changing back project_id length for share_networks")
op.alter_column("share_networks", "project_id", op.alter_column("share_networks", "project_id",
type_=sa.String(length=36)) type_=sa.String(length=36))
LOG.info(_LI("Changing back project_id length for security_services")) LOG.info("Changing back project_id length for security_services")
op.alter_column("security_services", "project_id", op.alter_column("security_services", "project_id",
type_=sa.String(length=36)) type_=sa.String(length=36))

View File

@ -29,8 +29,6 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sa import sqlalchemy as sa
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -39,7 +37,7 @@ def upgrade():
op.add_column('shares', sa.Column('is_public', sa.Boolean, op.add_column('shares', sa.Column('is_public', sa.Boolean,
default=False)) default=False))
except Exception: except Exception:
LOG.error(_LE("Column shares.is_public not created!")) LOG.error("Column shares.is_public not created!")
raise raise
@ -47,5 +45,5 @@ def downgrade():
try: try:
op.drop_column('shares', 'is_public') op.drop_column('shares', 'is_public')
except Exception: except Exception:
LOG.error(_LE("Column shares.is_public not dropped!")) LOG.error("Column shares.is_public not dropped!")
raise raise

View File

@ -38,9 +38,6 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sa import sqlalchemy as sa
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -161,40 +158,40 @@ def downgrade():
try: try:
op.drop_table('cgsnapshot_members') op.drop_table('cgsnapshot_members')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping 'cgsnapshot_members' table.")) LOG.exception("Error Dropping 'cgsnapshot_members' table.")
try: try:
op.drop_table('cgsnapshots') op.drop_table('cgsnapshots')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping 'cgsnapshots' table.")) LOG.exception("Error Dropping 'cgsnapshots' table.")
try: try:
op.drop_table('consistency_group_share_type_mappings') op.drop_table('consistency_group_share_type_mappings')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping " LOG.exception("Error Dropping "
"'consistency_group_share_type_mappings' table.")) "'consistency_group_share_type_mappings' table.")
try: try:
op.drop_column('shares', 'source_cgsnapshot_member_id') op.drop_column('shares', 'source_cgsnapshot_member_id')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping 'source_cgsnapshot_member_id' " LOG.exception("Error Dropping 'source_cgsnapshot_member_id' "
"column from 'shares' table.")) "column from 'shares' table.")
try: try:
op.drop_constraint(SHARES_CG_FK_CONSTRAINT_NAME, op.drop_constraint(SHARES_CG_FK_CONSTRAINT_NAME,
'shares', 'shares',
type_='foreignkey') type_='foreignkey')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping '%s' constraint.") % LOG.exception("Error Dropping '%s' constraint." %
SHARES_CG_FK_CONSTRAINT_NAME) SHARES_CG_FK_CONSTRAINT_NAME)
try: try:
op.drop_column('shares', 'consistency_group_id') op.drop_column('shares', 'consistency_group_id')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping 'consistency_group_id' column " LOG.exception("Error Dropping 'consistency_group_id' column "
"from 'shares' table.")) "from 'shares' table.")
try: try:
op.drop_table('consistency_groups') op.drop_table('consistency_groups')
except Exception: except Exception:
LOG.exception(_LE("Error Dropping 'consistency_groups' table.")) LOG.exception("Error Dropping 'consistency_groups' table.")

View File

@ -30,25 +30,24 @@ from oslo_utils import strutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.sql import table from sqlalchemy.sql import table
from manila.i18n import _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
def upgrade(): def upgrade():
LOG.info(_LI("Renaming column name shares.volume_type_id to " LOG.info("Renaming column name shares.volume_type_id to "
"shares.share_type.id")) "shares.share_type.id")
op.alter_column("shares", "volume_type_id", op.alter_column("shares", "volume_type_id",
new_column_name="share_type_id", new_column_name="share_type_id",
type_=sa.String(length=36)) type_=sa.String(length=36))
LOG.info(_LI("Renaming volume_types table to share_types")) LOG.info("Renaming volume_types table to share_types")
op.rename_table("volume_types", "share_types") op.rename_table("volume_types", "share_types")
op.drop_constraint('vt_name_uc', 'share_types', type_='unique') op.drop_constraint('vt_name_uc', 'share_types', type_='unique')
op.create_unique_constraint('st_name_uc', 'share_types', op.create_unique_constraint('st_name_uc', 'share_types',
['name', 'deleted']) ['name', 'deleted'])
LOG.info(_LI("Creating share_type_extra_specs table")) LOG.info("Creating share_type_extra_specs table")
st_es = op.create_table( st_es = op.create_table(
'share_type_extra_specs', 'share_type_extra_specs',
sa.Column('created_at', sa.DateTime), sa.Column('created_at', sa.DateTime),
@ -63,16 +62,16 @@ def upgrade():
sa.Column('spec_value', sa.String(length=255)), sa.Column('spec_value', sa.String(length=255)),
mysql_engine='InnoDB') mysql_engine='InnoDB')
LOG.info(_LI("Migrating volume_type_extra_specs to " LOG.info("Migrating volume_type_extra_specs to "
"share_type_extra_specs")) "share_type_extra_specs")
_copy_records(destination_table=st_es, up_migration=True) _copy_records(destination_table=st_es, up_migration=True)
LOG.info(_LI("Dropping volume_type_extra_specs table")) LOG.info("Dropping volume_type_extra_specs table")
op.drop_table("volume_type_extra_specs") op.drop_table("volume_type_extra_specs")
def downgrade(): def downgrade():
LOG.info(_LI("Creating volume_type_extra_specs table")) LOG.info("Creating volume_type_extra_specs table")
vt_es = op.create_table( vt_es = op.create_table(
'volume_type_extra_specs', 'volume_type_extra_specs',
sa.Column('created_at', sa.DateTime), sa.Column('created_at', sa.DateTime),
@ -86,21 +85,21 @@ def downgrade():
sa.Column('value', sa.String(length=255)), sa.Column('value', sa.String(length=255)),
mysql_engine='InnoDB') mysql_engine='InnoDB')
LOG.info(_LI("Migrating share_type_extra_specs to " LOG.info("Migrating share_type_extra_specs to "
"volume_type_extra_specs")) "volume_type_extra_specs")
_copy_records(destination_table=vt_es, up_migration=False) _copy_records(destination_table=vt_es, up_migration=False)
LOG.info(_LI("Dropping share_type_extra_specs table")) LOG.info("Dropping share_type_extra_specs table")
op.drop_table("share_type_extra_specs") op.drop_table("share_type_extra_specs")
LOG.info(_LI("Renaming share_types table to volume_types")) LOG.info("Renaming share_types table to volume_types")
op.drop_constraint('st_name_uc', 'share_types', type_='unique') op.drop_constraint('st_name_uc', 'share_types', type_='unique')
op.create_unique_constraint('vt_name_uc', 'share_types', op.create_unique_constraint('vt_name_uc', 'share_types',
['name', 'deleted']) ['name', 'deleted'])
op.rename_table("share_types", "volume_types") op.rename_table("share_types", "volume_types")
LOG.info(_LI("Renaming column name shares.share_type_id to " LOG.info("Renaming column name shares.share_type_id to "
"shares.volume_type.id")) "shares.volume_type.id")
op.alter_column("shares", "share_type_id", op.alter_column("shares", "share_type_id",
new_column_name="volume_type_id", new_column_name="volume_type_id",
type_=sa.String(length=36)) type_=sa.String(length=36))

View File

@ -29,8 +29,6 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sql import sqlalchemy as sql
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
drivers_private_data_table_name = 'drivers_private_data' drivers_private_data_table_name = 'drivers_private_data'
@ -54,7 +52,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Table |%s| not created!"), LOG.error("Table |%s| not created!",
drivers_private_data_table_name) drivers_private_data_table_name)
raise raise
@ -63,5 +61,5 @@ def downgrade():
try: try:
op.drop_table(drivers_private_data_table_name) op.drop_table(drivers_private_data_table_name)
except Exception: except Exception:
LOG.error(_LE("%s table not dropped"), drivers_private_data_table_name) LOG.error("%s table not dropped", drivers_private_data_table_name)
raise raise

View File

@ -29,7 +29,6 @@ from oslo_log import log
import sqlalchemy as sql import sqlalchemy as sql
from manila.common import constants from manila.common import constants
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
COLUMN_NAME = 'status' COLUMN_NAME = 'status'
@ -41,7 +40,7 @@ def upgrade():
try: try:
op.drop_column(t_name, COLUMN_NAME) op.drop_column(t_name, COLUMN_NAME)
except Exception: except Exception:
LOG.error(_LE("Column '%s' could not be dropped"), COLUMN_NAME) LOG.error("Column '%s' could not be dropped", COLUMN_NAME)
raise raise
@ -64,5 +63,5 @@ def downgrade():
), ),
) )
except Exception: except Exception:
LOG.error(_LE("Column '%s' could not be added"), COLUMN_NAME) LOG.error("Column '%s' could not be added", COLUMN_NAME)
raise raise

View File

@ -30,7 +30,6 @@ from oslo_log import log
from oslo_utils import uuidutils from oslo_utils import uuidutils
import sqlalchemy as sa import sqlalchemy as sa
from manila.i18n import _LE
SI_TABLE_NAME = 'share_instances' SI_TABLE_NAME = 'share_instances'
EL_TABLE_NAME = 'share_instance_export_locations' EL_TABLE_NAME = 'share_instance_export_locations'
@ -79,7 +78,7 @@ def upgrade():
nullable=False, nullable=False,
) )
except Exception: except Exception:
LOG.error(_LE("Failed to update '%s' table!"), LOG.error("Failed to update '%s' table!",
EL_TABLE_NAME) EL_TABLE_NAME)
raise raise
@ -101,7 +100,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Failed to create '%s' table!"), ELM_TABLE_NAME) LOG.error("Failed to create '%s' table!", ELM_TABLE_NAME)
raise raise
@ -109,12 +108,12 @@ def downgrade():
try: try:
op.drop_table(ELM_TABLE_NAME) op.drop_table(ELM_TABLE_NAME)
except Exception: except Exception:
LOG.error(_LE("Failed to drop '%s' table!"), ELM_TABLE_NAME) LOG.error("Failed to drop '%s' table!", ELM_TABLE_NAME)
raise raise
try: try:
op.drop_column(EL_TABLE_NAME, 'is_admin_only') op.drop_column(EL_TABLE_NAME, 'is_admin_only')
op.drop_column(EL_TABLE_NAME, 'uuid') op.drop_column(EL_TABLE_NAME, 'uuid')
except Exception: except Exception:
LOG.error(_LE("Failed to update '%s' table!"), EL_TABLE_NAME) LOG.error("Failed to update '%s' table!", EL_TABLE_NAME)
raise raise

View File

@ -26,7 +26,6 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sql import sqlalchemy as sql
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -52,7 +51,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Table |%s| not created!"), 'share_group_types') LOG.error("Table |%s| not created!", 'share_group_types')
raise raise
# Add share group specs # Add share group specs
@ -73,7 +72,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Table |%s| not created!"), 'share_group_type_specs') LOG.error("Table |%s| not created!", 'share_group_type_specs')
raise raise
# Add share group project types # Add share group project types
@ -95,7 +94,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Table |%s| not created!"), 'share_group_type_projects') LOG.error("Table |%s| not created!", 'share_group_type_projects')
raise raise
# Add mapping between group types and share types # Add mapping between group types and share types
@ -142,5 +141,5 @@ def downgrade():
try: try:
op.drop_table(table_name) op.drop_table(table_name)
except Exception: except Exception:
LOG.error(_LE("%s table not dropped") % table_name) LOG.error("%s table not dropped" % table_name)
raise raise

View File

@ -31,7 +31,6 @@ from oslo_utils import uuidutils
import sqlalchemy as sql import sqlalchemy as sql
from manila.db.migrations import utils from manila.db.migrations import utils
from manila.i18n import _LI, _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
TABLE_NAME = 'drivers_private_data' TABLE_NAME = 'drivers_private_data'
@ -45,7 +44,7 @@ def upgrade():
try: try:
op.drop_column(TABLE_NAME, COLUMN_HOST) op.drop_column(TABLE_NAME, COLUMN_HOST)
except Exception: except Exception:
LOG.error(_LE("Column '%s' could not be dropped"), COLUMN_HOST) LOG.error("Column '%s' could not be dropped", COLUMN_HOST)
raise raise
@ -57,7 +56,7 @@ def downgrade():
'session': uuidutils.generate_uuid()[:8] 'session': uuidutils.generate_uuid()[:8]
} }
LOG.info(_LI("Creating the migration table %(table)s"), { LOG.info("Creating the migration table %(table)s", {
'table': migration_table_name 'table': migration_table_name
}) })
migration_table = op.create_table( migration_table = op.create_table(
@ -76,11 +75,11 @@ def downgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
LOG.info(_LI("Copying data from %(from_table)s to the migration " LOG.info("Copying data from %(from_table)s to the migration "
"table %(migration_table)s") % { "table %(migration_table)s" % {
'from_table': TABLE_NAME, 'from_table': TABLE_NAME,
'migration_table': migration_table_name 'migration_table': migration_table_name
}) })
rows = [] rows = []
for row in op.get_bind().execute(from_table.select()): for row in op.get_bind().execute(from_table.select()):
rows.append({ rows.append({
@ -95,14 +94,14 @@ def downgrade():
}) })
op.bulk_insert(migration_table, rows) op.bulk_insert(migration_table, rows)
LOG.info(_LI("Dropping table %(from_table)s") % { LOG.info("Dropping table %(from_table)s" % {
'from_table': TABLE_NAME 'from_table': TABLE_NAME
}) })
op.drop_table(TABLE_NAME) op.drop_table(TABLE_NAME)
LOG.info(_LI("Rename the migration table %(migration_table)s to " LOG.info("Rename the migration table %(migration_table)s to "
"the original table %(from_table)s") % { "the original table %(from_table)s" % {
'migration_table': migration_table_name, 'migration_table': migration_table_name,
'from_table': TABLE_NAME 'from_table': TABLE_NAME
}) })
op.rename_table(migration_table_name, TABLE_NAME) op.rename_table(migration_table_name, TABLE_NAME)

View File

@ -28,14 +28,13 @@ import sqlalchemy as sa
from manila.common import constants from manila.common import constants
from manila.db.migrations import utils from manila.db.migrations import utils
from manila.i18n import _LI
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
def upgrade(): def upgrade():
LOG.info(_LI("Adding cast_rules_to_readonly column to share instances.")) LOG.info("Adding cast_rules_to_readonly column to share instances.")
op.add_column('share_instances', op.add_column('share_instances',
sa.Column('cast_rules_to_readonly', sa.Boolean, sa.Column('cast_rules_to_readonly', sa.Boolean,
@ -95,6 +94,6 @@ def upgrade():
def downgrade(): def downgrade():
LOG.info(_LI("Removing cast_rules_to_readonly column from share " LOG.info("Removing cast_rules_to_readonly column from share "
"instances.")) "instances.")
op.drop_column('share_instances', 'cast_rules_to_readonly') op.drop_column('share_instances', 'cast_rules_to_readonly')

View File

@ -26,7 +26,6 @@ from alembic import op
from oslo_log import log from oslo_log import log
import sqlalchemy as sql import sqlalchemy as sql
from manila.i18n import _LE
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -42,7 +41,7 @@ def upgrade():
share_types = sql.Table('share_types', meta, is_public.copy()) share_types = sql.Table('share_types', meta, is_public.copy())
share_types.update().values(is_public=True).execute() share_types.update().values(is_public=True).execute()
except Exception: except Exception:
LOG.error(_LE("Column |%s| not created!"), repr(is_public)) LOG.error("Column |%s| not created!", repr(is_public))
raise raise
try: try:
@ -61,7 +60,7 @@ def upgrade():
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
except Exception: except Exception:
LOG.error(_LE("Table |%s| not created!"), 'share_type_projects') LOG.error("Table |%s| not created!", 'share_type_projects')
raise raise
@ -69,11 +68,11 @@ def downgrade():
try: try:
op.drop_column('share_types', 'is_public') op.drop_column('share_types', 'is_public')
except Exception: except Exception:
LOG.error(_LE("share_types.is_public column not dropped")) LOG.error("share_types.is_public column not dropped")
raise raise
try: try:
op.drop_table('share_type_projects') op.drop_table('share_type_projects')
except Exception: except Exception:
LOG.error(_LE("share_type_projects table not dropped")) LOG.error("share_type_projects table not dropped")
raise raise

View File

@ -47,7 +47,7 @@ from sqlalchemy.sql import func
from manila.common import constants from manila.common import constants
from manila.db.sqlalchemy import models from manila.db.sqlalchemy import models
from manila import exception from manila import exception
from manila.i18n import _, _LE, _LI, _LW from manila.i18n import _
CONF = cfg.CONF CONF = cfg.CONF
@ -973,8 +973,8 @@ def quota_reserve(context, resources, project_quotas, user_quotas, deltas,
session.add(usage_ref) session.add(usage_ref)
if unders: if unders:
LOG.warning(_LW("Change will make usage less than 0 for the following " LOG.warning("Change will make usage less than 0 for the following "
"resources: %s"), unders) "resources: %s", unders)
if overs: if overs:
if project_quotas == user_quotas: if project_quotas == user_quotas:
usages = project_usages usages = project_usages
@ -3575,7 +3575,7 @@ def share_type_destroy(context, id):
session=session, session=session,
).filter_by(share_type_id=id).count() ).filter_by(share_type_id=id).count()
if results or share_group_count: if results or share_group_count:
LOG.error(_LE('ShareType %s deletion failed, ShareType in use.'), LOG.error('ShareType %s deletion failed, ShareType in use.',
id) id)
raise exception.ShareTypeInUse(share_type_id=id) raise exception.ShareTypeInUse(share_type_id=id)
model_query(context, models.ShareTypeExtraSpecs, session=session).\ model_query(context, models.ShareTypeExtraSpecs, session=session).\
@ -3803,15 +3803,15 @@ def purge_deleted_records(context, age_in_days):
deleted_count += 1 deleted_count += 1
except db_exc.DBError: except db_exc.DBError:
LOG.warning( LOG.warning(
_LW("Deleting soft-deleted resource %s " ("Deleting soft-deleted resource %s "
"failed, skipping."), record) "failed, skipping."), record)
if deleted_count != 0: if deleted_count != 0:
LOG.info(_LI("Deleted %(count)s records in " LOG.info("Deleted %(count)s records in "
"table %(table)s."), "table %(table)s.",
{'count': deleted_count, 'table': table}) {'count': deleted_count, 'table': table})
except db_exc.DBError: except db_exc.DBError:
LOG.warning(_LW("Querying table %s's soft-deleted records " LOG.warning("Querying table %s's soft-deleted records "
"failed, skipping."), table) "failed, skipping.", table)
session.commit() session.commit()
@ -4382,7 +4382,7 @@ def share_group_type_destroy(context, type_id):
share_group_type_id=type_id, share_group_type_id=type_id,
).count() ).count()
if results: if results:
LOG.error(_LE('Share group type %s deletion failed, it in use.'), LOG.error('Share group type %s deletion failed, it in use.',
type_id) type_id)
raise exception.ShareGroupTypeInUse(type_id=type_id) raise exception.ShareGroupTypeInUse(type_id=type_id)
model_query( model_query(

View File

@ -21,7 +21,7 @@ from oslo_log import log
import six import six
from manila import exception from manila import exception
from manila.i18n import _, _LE, _LW from manila.i18n import _
from manila.network.linux import ip_lib from manila.network.linux import ip_lib
from manila.network.linux import ovs_lib from manila.network.linux import ovs_lib
from manila import utils from manila import utils
@ -154,7 +154,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
namespace_obj.add_device_to_namespace(ns_dev) namespace_obj.add_device_to_namespace(ns_dev)
else: else:
LOG.warning(_LW("Device %s already exists."), device_name) LOG.warning("Device %s already exists.", device_name)
ns_dev.link.set_up() ns_dev.link.set_up()
@device_name_synchronized @device_name_synchronized
@ -170,7 +170,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
try: try:
ovs.delete_port(tap_name) ovs.delete_port(tap_name)
except RuntimeError: except RuntimeError:
LOG.error(_LE("Failed unplugging interface '%s'"), LOG.error("Failed unplugging interface '%s'",
device_name) device_name)
@ -199,7 +199,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
else: else:
ns_veth = ip.device(device_name) ns_veth = ip.device(device_name)
root_veth = ip.device(tap_name) root_veth = ip.device(tap_name)
LOG.warning(_LW("Device %s already exists."), device_name) LOG.warning("Device %s already exists.", device_name)
root_veth.link.set_up() root_veth.link.set_up()
ns_veth.link.set_up() ns_veth.link.set_up()
@ -212,5 +212,5 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
device.link.delete() device.link.delete()
LOG.debug("Unplugged interface '%s'", device_name) LOG.debug("Unplugged interface '%s'", device_name)
except RuntimeError: except RuntimeError:
LOG.error(_LE("Failed unplugging interface '%s'"), LOG.error("Failed unplugging interface '%s'",
device_name) device_name)

View File

@ -17,7 +17,6 @@ import re
from oslo_log import log from oslo_log import log
from manila.i18n import _LE
from manila import utils from manila import utils
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -46,7 +45,7 @@ class OVSBridge(object):
try: try:
return utils.execute(*full_args, run_as_root=True) return utils.execute(*full_args, run_as_root=True)
except Exception: except Exception:
LOG.exception(_LE("Unable to execute %(cmd)s."), LOG.exception("Unable to execute %(cmd)s.",
{'cmd': full_args}) {'cmd': full_args})
def reset_bridge(self): def reset_bridge(self):

View File

@ -23,7 +23,6 @@ from oslo_log import log
from manila.common import client_auth from manila.common import client_auth
from manila import context from manila import context
from manila import exception from manila import exception
from manila.i18n import _LE
from manila.network.neutron import constants as neutron_constants from manila.network.neutron import constants as neutron_constants
NEUTRON_GROUP = 'neutron' NEUTRON_GROUP = 'neutron'
@ -207,7 +206,7 @@ class API(object):
port = self.client.create_port(port_req_body).get('port', {}) port = self.client.create_port(port_req_body).get('port', {})
return port return port
except neutron_client_exc.NeutronClientException as e: except neutron_client_exc.NeutronClientException as e:
LOG.exception(_LE('Neutron error creating port on network %s'), LOG.exception('Neutron error creating port on network %s',
network_id) network_id)
if e.status_code == 409: if e.status_code == 409:
raise exception.PortLimitExceeded() raise exception.PortLimitExceeded()