Add nova-powervm translation domain

Since nova-powervm is not in tree with nova, it can't use nova's
translation domain.  This change introduces i18n.py and the
nova-powervm domain.

Change-Id: I9d3565e6ad1737629350fe02c7a41d56b0cf401a
This commit is contained in:
Kyle L. Henderson 2015-10-28 19:53:44 -05:00
parent b8199619f2
commit ded3c4b7ca
17 changed files with 65 additions and 26 deletions

View File

@ -21,7 +21,6 @@ import oslo_log.log as logging
from oslo_utils import units from oslo_utils import units
import six import six
from nova.i18n import _LW
from nova import image from nova import image
import pypowervm.const as pvm_const import pypowervm.const as pvm_const
import pypowervm.tasks.scsi_mapper as tsk_map import pypowervm.tasks.scsi_mapper as tsk_map
@ -29,6 +28,7 @@ import pypowervm.util as pvm_util
import pypowervm.wrappers.virtual_io_server as pvm_vios import pypowervm.wrappers.virtual_io_server as pvm_vios
from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -19,7 +19,6 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from nova import exception as nova_exc from nova import exception as nova_exc
from nova.i18n import _LI, _LE
from pypowervm import exceptions as pvm_exc from pypowervm import exceptions as pvm_exc
from pypowervm.tasks import scsi_mapper as tsk_map from pypowervm.tasks import scsi_mapper as tsk_map
from pypowervm.tasks import storage as tsk_stg from pypowervm.tasks import storage as tsk_stg
@ -29,6 +28,8 @@ from pypowervm.wrappers import virtual_io_server as pvm_vios
from nova_powervm.virt.powervm.disk import driver as disk_dvr from nova_powervm.virt.powervm.disk import driver as disk_dvr
from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm import vios from nova_powervm.virt.powervm import vios
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm

View File

@ -19,8 +19,10 @@ import random
from oslo_config import cfg from oslo_config import cfg
import oslo_log.log as logging import oslo_log.log as logging
from nova.i18n import _LI, _LE
from nova_powervm.virt.powervm.disk import driver as disk_drv from nova_powervm.virt.powervm.disk import driver as disk_drv
from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm import vios from nova_powervm.virt.powervm import vios
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
@ -31,7 +33,6 @@ import pypowervm.wrappers.cluster as pvm_clust
import pypowervm.wrappers.storage as pvm_stg import pypowervm.wrappers.storage as pvm_stg
import pypowervm.wrappers.virtual_io_server as pvm_vios import pypowervm.wrappers.virtual_io_server as pvm_vios
from nova_powervm.virt.powervm import exception as npvmex
ssp_opts = [ ssp_opts = [
cfg.StrOpt('cluster_name', cfg.StrOpt('cluster_name',

View File

@ -21,7 +21,6 @@ from nova.console import type as console_type
from nova import context as ctx from nova import context as ctx
from nova import exception from nova import exception
from nova import image from nova import image
from nova.i18n import _LI, _LW, _LE, _
from nova.objects import flavor as flavor_obj from nova.objects import flavor as flavor_obj
from nova import utils as n_utils from nova import utils as n_utils
from nova.virt import configdrive from nova.virt import configdrive
@ -49,6 +48,10 @@ from pypowervm.wrappers import virtual_io_server as pvm_vios
from nova_powervm.virt.powervm.disk import driver as disk_dvr from nova_powervm.virt.powervm.disk import driver as disk_dvr
from nova_powervm.virt.powervm import host as pvm_host from nova_powervm.virt.powervm import host as pvm_host
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import image as img from nova_powervm.virt.powervm import image as img
from nova_powervm.virt.powervm import live_migration as lpm from nova_powervm.virt.powervm import live_migration as lpm
from nova_powervm.virt.powervm import mgmt from nova_powervm.virt.powervm import mgmt

View File

@ -18,10 +18,11 @@
import abc import abc
from nova import exception as nex from nova import exception as nex
from nova.i18n import _
import six import six
from nova_powervm.virt.powervm.i18n import _
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class AbstractMediaException(nex.NovaException): class AbstractMediaException(nex.NovaException):

View File

@ -18,14 +18,13 @@ import math
from nova.compute import arch from nova.compute import arch
from nova.compute import hv_type from nova.compute import hv_type
from nova.compute import vm_mode from nova.compute import vm_mode
from nova.i18n import _LW
import subprocess
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from pypowervm.tasks.monitor import util as pcm_util from pypowervm.tasks.monitor import util as pcm_util
import subprocess
from nova_powervm.virt.powervm.i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -0,0 +1,25 @@
# Copyright 2015 IBM Corp.
#
# 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.
import oslo_i18n
# Initialize message translators and short cut methods
_translators = oslo_i18n.TranslatorFactory(domain='nova-powervm')
_ = _translators.primary
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -17,7 +17,6 @@
import abc import abc
from nova import exception from nova import exception
from nova.i18n import _, _LE, _LI
from pypowervm.tasks import management_console as mgmt_task from pypowervm.tasks import management_console as mgmt_task
from pypowervm.tasks import migration as mig from pypowervm.tasks import migration as mig
from pypowervm.tasks import storage as stor_task from pypowervm.tasks import storage as stor_task
@ -27,6 +26,9 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import six import six
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm import media from nova_powervm.virt.powervm import media
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm

View File

@ -16,7 +16,6 @@
import copy import copy
from nova.api.metadata import base as instance_metadata from nova.api.metadata import base as instance_metadata
from nova.i18n import _LI, _LW
from nova.network import model as network_model from nova.network import model as network_model
from nova.virt import configdrive from nova.virt import configdrive
import os import os
@ -36,6 +35,8 @@ from pypowervm.wrappers import storage as pvm_stg
from pypowervm.wrappers import virtual_io_server as pvm_vios from pypowervm.wrappers import virtual_io_server as pvm_vios
from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,11 +14,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova.i18n import _LI
from oslo_log import log as logging from oslo_log import log as logging
from taskflow import task from taskflow import task
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm import image from nova_powervm.virt.powervm import image
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -17,13 +17,16 @@
import eventlet import eventlet
from nova import exception from nova import exception
from nova.i18n import _LI, _LW, _LE, _
from nova import utils from nova import utils
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from taskflow import task from taskflow import task
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova.i18n import _LI, _LW
from pypowervm.tasks import scsi_mapper as pvm_smap from pypowervm.tasks import scsi_mapper as pvm_smap
from oslo_log import log as logging from oslo_log import log as logging
@ -23,6 +22,8 @@ from taskflow.types import failure as task_fail
from nova_powervm.virt.powervm.disk import driver as disk_driver from nova_powervm.virt.powervm.disk import driver as disk_driver
from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm import exception as npvmex
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import media from nova_powervm.virt.powervm import media
from nova_powervm.virt.powervm import mgmt from nova_powervm.virt.powervm import mgmt

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova.i18n import _LI
from pypowervm.tasks import power from pypowervm.tasks import power
from pypowervm.tasks import storage as pvm_stg from pypowervm.tasks import storage as pvm_stg
@ -22,6 +21,7 @@ from oslo_log import log as logging
from taskflow import task from taskflow import task
from taskflow.types import failure as task_fail from taskflow.types import failure as task_fail
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -15,14 +15,12 @@
# under the License. # under the License.
import json import json
import re
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import re
from nova.compute import power_state from nova.compute import power_state
from nova import exception from nova import exception
from nova.i18n import _LI, _LE, _
from nova.virt import hardware from nova.virt import hardware
from pypowervm import exceptions as pvm_exc from pypowervm import exceptions as pvm_exc
from pypowervm.helpers import log_helper as pvm_log from pypowervm.helpers import log_helper as pvm_log
@ -39,6 +37,11 @@ from pypowervm.wrappers import managed_system as pvm_ms
from pypowervm.wrappers import network as pvm_net from pypowervm.wrappers import network as pvm_net
from pypowervm.wrappers import shared_proc_pool as pvm_spp from pypowervm.wrappers import shared_proc_pool as pvm_spp
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -19,11 +19,12 @@ from oslo_log import log as logging
from taskflow import task from taskflow import task
from nova.compute import task_states from nova.compute import task_states
from nova.i18n import _LI, _LW
from pypowervm.tasks import vfc_mapper as pvm_vfcm from pypowervm.tasks import vfc_mapper as pvm_vfcm
from pypowervm.wrappers import virtual_io_server as pvm_vios from pypowervm.wrappers import virtual_io_server as pvm_vios
from nova_powervm.virt import powervm from nova_powervm.virt import powervm
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm.volume import driver as v_driver from nova_powervm.virt.powervm.volume import driver as v_driver
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,14 +14,16 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova.i18n import _, _LI, _LW, _LE
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from taskflow import task from taskflow import task
from nova_powervm.virt.powervm import exception as p_exc from nova_powervm.virt.powervm import exception as p_exc
from nova_powervm.virt.powervm.i18n import _
from nova_powervm.virt.powervm.i18n import _LE
from nova_powervm.virt.powervm.i18n import _LI
from nova_powervm.virt.powervm.i18n import _LW
from nova_powervm.virt.powervm import vios from nova_powervm.virt.powervm import vios
from nova_powervm.virt.powervm import vm from nova_powervm.virt.powervm import vm
from nova_powervm.virt.powervm.volume import driver as v_driver from nova_powervm.virt.powervm.volume import driver as v_driver

View File

@ -29,6 +29,3 @@ commands = python setup.py build_sphinx
[flake8] [flake8]
ignore = E125,E712,H104,H405,H904 ignore = E125,E712,H104,H405,H904
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
[hacking]
import_exceptions = nova.i18n