From 54d23acf3ebbb371fdb51b76a4a22635cdd166e2 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Thu, 26 Jun 2014 17:11:37 +0900 Subject: [PATCH] rename various files of neutron/*.py to tacker/*.py Change-Id: Iaad5851d1a6dc68bfa68dcf6ee6da2b226fad469 --- neutron/manager.py | 225 ------------------------ {neutron => tacker}/__init__.py | 2 +- {neutron => tacker}/auth.py | 12 +- {neutron => tacker}/context.py | 10 +- {neutron => tacker}/hacking/__init__.py | 0 {neutron => tacker}/hacking/checks.py | 6 +- {neutron => tacker}/hooks.py | 0 tacker/manager.py | 165 +++++++++++++++++ {neutron => tacker}/policy.py | 32 ++-- {neutron => tacker}/service.py | 93 ++-------- {neutron => tacker}/version.py | 2 +- {neutron => tacker}/wsgi.py | 32 ++-- 12 files changed, 228 insertions(+), 351 deletions(-) delete mode 100644 neutron/manager.py rename {neutron => tacker}/__init__.py (94%) rename {neutron => tacker}/auth.py (89%) rename {neutron => tacker}/context.py (96%) rename {neutron => tacker}/hacking/__init__.py (100%) rename {neutron => tacker}/hacking/checks.py (91%) rename {neutron => tacker}/hooks.py (100%) create mode 100644 tacker/manager.py rename {neutron => tacker}/policy.py (95%) rename {neutron => tacker}/service.py (71%) rename {neutron => tacker}/version.py (93%) rename {neutron => tacker}/wsgi.py (98%) diff --git a/neutron/manager.py b/neutron/manager.py deleted file mode 100644 index 2c4e7f994..000000000 --- a/neutron/manager.py +++ /dev/null @@ -1,225 +0,0 @@ -# Copyright 2011 VMware, Inc -# 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 weakref - -from oslo.config import cfg - -from neutron.common import rpc_compat -from neutron.common import utils -from neutron.openstack.common import importutils -from neutron.openstack.common import log as logging -from neutron.openstack.common import periodic_task -from neutron.plugins.common import constants - -from stevedore import driver - - -LOG = logging.getLogger(__name__) - - -class Manager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks): - - # Set RPC API version to 1.0 by default. - RPC_API_VERSION = '1.0' - - def __init__(self, host=None): - if not host: - host = cfg.CONF.host - self.host = host - super(Manager, self).__init__() - - def periodic_tasks(self, context, raise_on_error=False): - self.run_periodic_tasks(context, raise_on_error=raise_on_error) - - def init_host(self): - """Handle initialization if this is a standalone service. - - Child classes should override this method. - - """ - pass - - def after_start(self): - """Handler post initialization stuff. - - Child classes can override this method. - """ - pass - - -def validate_post_plugin_load(): - """Checks if the configuration variables are valid. - - If the configuration is invalid then the method will return an error - message. If all is OK then it will return None. - """ - if ('dhcp_agents_per_network' in cfg.CONF and - cfg.CONF.dhcp_agents_per_network <= 0): - msg = _("dhcp_agents_per_network must be >= 1. '%s' " - "is invalid.") % cfg.CONF.dhcp_agents_per_network - return msg - - -def validate_pre_plugin_load(): - """Checks if the configuration variables are valid. - - If the configuration is invalid then the method will return an error - message. If all is OK then it will return None. - """ - if cfg.CONF.core_plugin is None: - msg = _('Neutron core_plugin not configured!') - return msg - - -class NeutronManager(object): - """Neutron's Manager class. - - Neutron's Manager class is responsible for parsing a config file and - instantiating the correct plugin that concretely implements - neutron_plugin_base class. - The caller should make sure that NeutronManager is a singleton. - """ - _instance = None - - def __init__(self, options=None, config_file=None): - # If no options have been provided, create an empty dict - if not options: - options = {} - - msg = validate_pre_plugin_load() - if msg: - LOG.critical(msg) - raise Exception(msg) - - # NOTE(jkoelker) Testing for the subclass with the __subclasshook__ - # breaks tach monitoring. It has been removed - # intentionally to allow v2 plugins to be monitored - # for performance metrics. - plugin_provider = cfg.CONF.core_plugin - LOG.info(_("Loading core plugin: %s"), plugin_provider) - self.plugin = self._get_plugin_instance('neutron.core_plugins', - plugin_provider) - msg = validate_post_plugin_load() - if msg: - LOG.critical(msg) - raise Exception(msg) - - # core plugin as a part of plugin collection simplifies - # checking extensions - # TODO(enikanorov): make core plugin the same as - # the rest of service plugins - self.service_plugins = {constants.CORE: self.plugin} - self._load_service_plugins() - - def _get_plugin_instance(self, namespace, plugin_provider): - try: - # Try to resolve plugin by name - mgr = driver.DriverManager(namespace, plugin_provider) - plugin_class = mgr.driver - except RuntimeError as e1: - # fallback to class name - try: - plugin_class = importutils.import_class(plugin_provider) - except ImportError as e2: - LOG.exception(_("Error loading plugin by name, %s"), e1) - LOG.exception(_("Error loading plugin by class, %s"), e2) - raise ImportError(_("Plugin not found.")) - return plugin_class() - - def _load_services_from_core_plugin(self): - """Puts core plugin in service_plugins for supported services.""" - LOG.debug(_("Loading services supported by the core plugin")) - - # supported service types are derived from supported extensions - for ext_alias in getattr(self.plugin, - "supported_extension_aliases", []): - if ext_alias in constants.EXT_TO_SERVICE_MAPPING: - service_type = constants.EXT_TO_SERVICE_MAPPING[ext_alias] - self.service_plugins[service_type] = self.plugin - LOG.info(_("Service %s is supported by the core plugin"), - service_type) - - def _load_service_plugins(self): - """Loads service plugins. - - Starts from the core plugin and checks if it supports - advanced services then loads classes provided in configuration. - """ - # load services from the core plugin first - self._load_services_from_core_plugin() - - plugin_providers = cfg.CONF.service_plugins - LOG.debug(_("Loading service plugins: %s"), plugin_providers) - for provider in plugin_providers: - if provider == '': - continue - - LOG.info(_("Loading Plugin: %s"), provider) - plugin_inst = self._get_plugin_instance('neutron.service_plugins', - provider) - - # only one implementation of svc_type allowed - # specifying more than one plugin - # for the same type is a fatal exception - if plugin_inst.get_plugin_type() in self.service_plugins: - raise ValueError(_("Multiple plugins for service " - "%s were configured"), - plugin_inst.get_plugin_type()) - - self.service_plugins[plugin_inst.get_plugin_type()] = plugin_inst - - # search for possible agent notifiers declared in service plugin - # (needed by agent management extension) - if (hasattr(self.plugin, 'agent_notifiers') and - hasattr(plugin_inst, 'agent_notifiers')): - self.plugin.agent_notifiers.update(plugin_inst.agent_notifiers) - - LOG.debug(_("Successfully loaded %(type)s plugin. " - "Description: %(desc)s"), - {"type": plugin_inst.get_plugin_type(), - "desc": plugin_inst.get_plugin_description()}) - - @classmethod - @utils.synchronized("manager") - def _create_instance(cls): - if not cls.has_instance(): - cls._instance = cls() - - @classmethod - def has_instance(cls): - return cls._instance is not None - - @classmethod - def clear_instance(cls): - cls._instance = None - - @classmethod - def get_instance(cls): - # double checked locking - if not cls.has_instance(): - cls._create_instance() - return cls._instance - - @classmethod - def get_plugin(cls): - # Return a weakref to minimize gc-preventing references. - return weakref.proxy(cls.get_instance().plugin) - - @classmethod - def get_service_plugins(cls): - # Return weakrefs to minimize gc-preventing references. - return dict((x, weakref.proxy(y)) - for x, y in cls.get_instance().service_plugins.iteritems()) diff --git a/neutron/__init__.py b/tacker/__init__.py similarity index 94% rename from neutron/__init__.py rename to tacker/__init__.py index b2c81bde7..027716d84 100644 --- a/neutron/__init__.py +++ b/tacker/__init__.py @@ -18,4 +18,4 @@ import gettext -gettext.install('neutron', unicode=1) +gettext.install('tacker', unicode=1) diff --git a/neutron/auth.py b/tacker/auth.py similarity index 89% rename from neutron/auth.py rename to tacker/auth.py index 52b32f847..fa162143e 100644 --- a/neutron/auth.py +++ b/tacker/auth.py @@ -18,15 +18,15 @@ from oslo.config import cfg import webob.dec import webob.exc -from neutron import context -from neutron.openstack.common import log as logging -from neutron.openstack.common.middleware import request_id -from neutron import wsgi +from tacker import context +from tacker.openstack.common import log as logging +from tacker.openstack.common.middleware import request_id +from tacker import wsgi LOG = logging.getLogger(__name__) -class NeutronKeystoneContext(wsgi.Middleware): +class TackerKeystoneContext(wsgi.Middleware): """Make a request context from keystone headers.""" @webob.dec.wsgify @@ -56,7 +56,7 @@ class NeutronKeystoneContext(wsgi.Middleware): request_id=req_id) # Inject the context... - req.environ['neutron.context'] = ctx + req.environ['tacker.context'] = ctx return self.application diff --git a/neutron/context.py b/tacker/context.py similarity index 96% rename from neutron/context.py rename to tacker/context.py index da4376e71..e7b173c3f 100644 --- a/neutron/context.py +++ b/tacker/context.py @@ -21,11 +21,11 @@ import copy import datetime -from neutron.db import api as db_api -from neutron.openstack.common import context as common_context -from neutron.openstack.common import local -from neutron.openstack.common import log as logging -from neutron import policy +from tacker.db import api as db_api +from tacker.openstack.common import context as common_context +from tacker.openstack.common import local +from tacker.openstack.common import log as logging +from tacker import policy LOG = logging.getLogger(__name__) diff --git a/neutron/hacking/__init__.py b/tacker/hacking/__init__.py similarity index 100% rename from neutron/hacking/__init__.py rename to tacker/hacking/__init__.py diff --git a/neutron/hacking/checks.py b/tacker/hacking/checks.py similarity index 91% rename from neutron/hacking/checks.py rename to tacker/hacking/checks.py index 899d76243..3d49546d5 100644 --- a/neutron/hacking/checks.py +++ b/tacker/hacking/checks.py @@ -19,7 +19,7 @@ import pep8 """ Guidelines for writing new hacking checks - - Use only for Neutron specific tests. OpenStack general tests + - Use only for Tacker specific tests. OpenStack general tests should be submitted to the common 'hacking' module. - Pick numbers in the range N3xx. Find the current test with the highest allocated number and then pick the next value. @@ -27,7 +27,7 @@ Guidelines for writing new hacking checks on the N3xx value. - List the new rule in the top level HACKING.rst file - Add test cases for each new rule to - neutron/tests/unit/test_hacking.py + tacker/tests/unit/test_hacking.py """ @@ -37,7 +37,7 @@ log_translation = re.compile( def validate_log_translations(logical_line, physical_line, filename): # Translations are not required in the test directory - if "neutron/tests" in filename: + if "tacker/tests" in filename: return if pep8.noqa(physical_line): return diff --git a/neutron/hooks.py b/tacker/hooks.py similarity index 100% rename from neutron/hooks.py rename to tacker/hooks.py diff --git a/tacker/manager.py b/tacker/manager.py new file mode 100644 index 000000000..3fe3c2564 --- /dev/null +++ b/tacker/manager.py @@ -0,0 +1,165 @@ +# Copyright 2011 VMware, Inc +# 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. + +from oslo.config import cfg + +from tacker.common import rpc_compat +from tacker.common import utils +from tacker.openstack.common import importutils +from tacker.openstack.common import log as logging +from tacker.openstack.common import periodic_task +from tacker.plugins.common import constants + + +LOG = logging.getLogger(__name__) + + +class Manager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks): + + # Set RPC API version to 1.0 by default. + RPC_API_VERSION = '1.0' + + def __init__(self, host=None): + if not host: + host = cfg.CONF.host + self.host = host + super(Manager, self).__init__() + + def periodic_tasks(self, context, raise_on_error=False): + self.run_periodic_tasks(context, raise_on_error=raise_on_error) + + def init_host(self): + """Handle initialization if this is a standalone service. + + Child classes should override this method. + + """ + pass + + def after_start(self): + """Handler post initialization stuff. + + Child classes can override this method. + """ + pass + + +def validate_post_plugin_load(): + """Checks if the configuration variables are valid. + + If the configuration is invalid then the method will return an error + message. If all is OK then it will return None. + """ + pass + + +def validate_pre_plugin_load(): + """Checks if the configuration variables are valid. + + If the configuration is invalid then the method will return an error + message. If all is OK then it will return None. + """ + pass + + +class TackerManager(object): + """Tacker's Manager class. + + Tacker's Manager class is responsible for parsing a config file and + instantiating the correct plugin that concretely implement + tacker_plugin_base class. + The caller should make sure that TackerManager is a singleton. + """ + _instance = None + + def __init__(self, options=None, config_file=None): + # If no options have been provided, create an empty dict + if not options: + options = {} + + msg = validate_pre_plugin_load() + if msg: + LOG.critical(msg) + raise Exception(msg) + + msg = validate_post_plugin_load() + if msg: + LOG.critical(msg) + raise Exception(msg) + + self.service_plugins = {} + self._load_service_plugins() + + def _load_service_plugins(self): + """Loads service plugins. + + Starts from the core plugin and checks if it supports + advanced services then loads classes provided in configuration. + """ + # plugin_providers = cfg.CONF.service_plugins + plugin_providers = ['tacker.vm.plugin.ServiceVMPlugin'] + LOG.debug(_("Loading service plugins: %s"), plugin_providers) + for provider in plugin_providers: + if provider == '': + continue + try: + LOG.info(_("Loading Plugin: %s"), provider) + plugin_class = importutils.import_class(provider) + except ImportError: + LOG.exception(_("Error loading plugin")) + raise ImportError(_("Plugin not found.")) + plugin_inst = plugin_class() + + # only one implementation of svc_type allowed + # specifying more than one plugin + # for the same type is a fatal exception + if plugin_inst.get_plugin_type() in self.service_plugins: + raise ValueError(_("Multiple plugins for service " + "%s were configured"), + plugin_inst.get_plugin_type()) + + self.service_plugins[plugin_inst.get_plugin_type()] = plugin_inst + + # # search for possible agent notifiers declared in service plugin + # # (needed by agent management extension) + # if (hasattr(self.plugin, 'agent_notifiers') and + # hasattr(plugin_inst, 'agent_notifiers')): + # self.plugin.agent_notifiers.update(plugin_inst.agent_notifiers) + + LOG.debug(_("Successfully loaded %(type)s plugin. " + "Description: %(desc)s"), + {"type": plugin_inst.get_plugin_type(), + "desc": plugin_inst.get_plugin_description()}) + + @classmethod + @utils.synchronized("manager") + def _create_instance(cls): + if cls._instance is None: + cls._instance = cls() + + @classmethod + def get_instance(cls): + # double checked locking + if cls._instance is None: + cls._create_instance() + return cls._instance + + @classmethod + def get_plugin(cls): + return cls.get_instance().plugin + + @classmethod + def get_service_plugins(cls): + return cls.get_instance().service_plugins diff --git a/neutron/policy.py b/tacker/policy.py similarity index 95% rename from neutron/policy.py rename to tacker/policy.py index 747638287..90917811a 100644 --- a/neutron/policy.py +++ b/tacker/policy.py @@ -16,20 +16,20 @@ # under the License. """ -Policy engine for neutron. Largely copied from nova. +Policy engine for tacker. Largely copied from nova. """ import itertools import re from oslo.config import cfg -from neutron.api.v2 import attributes -from neutron.common import exceptions -import neutron.common.utils as utils -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils -from neutron.openstack.common import log as logging -from neutron.openstack.common import policy +from tacker.api.v1 import attributes +from tacker.common import exceptions +import tacker.common.utils as utils +from tacker.openstack.common import excutils +from tacker.openstack.common import importutils +from tacker.openstack.common import log as logging +from tacker.openstack.common import policy LOG = logging.getLogger(__name__) @@ -53,7 +53,7 @@ DEPRECATED_ACTION_MAP = { 'set': ['create', 'update'] } -cfg.CONF.import_opt('policy_file', 'neutron.common.config') +cfg.CONF.import_opt('policy_file', 'tacker.common.config') def reset(): @@ -264,12 +264,12 @@ class OwnerCheck(policy.Check): # check more general # FIXME(ihrachys): if import is put in global, circular # import failure occurs - from neutron import manager - f = getattr(manager.NeutronManager.get_instance().plugin, + from tacker import manager + f = getattr(manager.TackerManager.get_instance().plugin, 'get_%s' % parent_res) - # f *must* exist, if not found it is better to let neutron + # f *must* exist, if not found it is better to let tacker # explode. Check will be performed with admin context - context = importutils.import_module('neutron.context') + context = importutils.import_module('tacker.context') try: data = f(context.get_admin_context(), target[parent_foreign_key], @@ -329,7 +329,7 @@ def _prepare_check(context, action, target): def check(context, action, target, plugin=None, might_not_exist=False): """Verifies that the action is valid on the target in this context. - :param context: neutron context + :param context: tacker context :param action: string representing the action to be checked this should be colon separated for clarity. :param target: dictionary representing the object of the action @@ -351,7 +351,7 @@ def check(context, action, target, plugin=None, might_not_exist=False): def enforce(context, action, target, plugin=None): """Verifies that the action is valid on the target in this context. - :param context: neutron context + :param context: tacker context :param action: string representing the action to be checked this should be colon separated for clarity. :param target: dictionary representing the object of the action @@ -360,7 +360,7 @@ def enforce(context, action, target, plugin=None): :param plugin: currently unused and deprecated. Kept for backward compatibility. - :raises neutron.exceptions.PolicyNotAuthorized: if verification fails. + :raises tacker.exceptions.PolicyNotAuthorized: if verification fails. """ rule, target, credentials = _prepare_check(context, action, target) diff --git a/neutron/service.py b/tacker/service.py similarity index 71% rename from neutron/service.py rename to tacker/service.py index c26182bc5..04ef544b1 100644 --- a/neutron/service.py +++ b/tacker/service.py @@ -19,19 +19,15 @@ import os import random from oslo.config import cfg -from oslo.messaging import server as rpc_server -from neutron.common import config -from neutron.common import rpc_compat -from neutron import context -from neutron.db import api as session -from neutron import manager -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils -from neutron.openstack.common import log as logging -from neutron.openstack.common import loopingcall -from neutron.openstack.common import service as common_service -from neutron import wsgi +from tacker.common import config +from tacker.common import rpc_compat +from tacker import context +from tacker.openstack.common import excutils +from tacker.openstack.common import importutils +from tacker.openstack.common import log as logging +from tacker.openstack.common import loopingcall +from tacker import wsgi service_opts = [ @@ -41,9 +37,6 @@ service_opts = [ cfg.IntOpt('api_workers', default=0, help=_('Number of separate worker processes for service')), - cfg.IntOpt('rpc_workers', - default=0, - help=_('Number of RPC worker processes for service')), cfg.IntOpt('periodic_fuzzy_delay', default=5, help=_('Range of seconds to randomly delay when starting the ' @@ -76,11 +69,11 @@ class WsgiService(object): self.wsgi_app.wait() -class NeutronApiService(WsgiService): - """Class for neutron-api service.""" +class TackerApiService(WsgiService): + """Class for tacker-api service.""" @classmethod - def create(cls, app_name='neutron'): + def create(cls, app_name='tacker'): # Setup logging early, supplying both the CLI options and the # configuration mapping from the config file @@ -108,73 +101,17 @@ def serve_wsgi(cls): return service -class RpcWorker(object): - """Wraps a worker to be handled by ProcessLauncher""" - def __init__(self, plugin): - self._plugin = plugin - self._servers = [] - - def start(self): - # We may have just forked from parent process. A quick disposal of the - # existing sql connections avoids producing errors later when they are - # discovered to be broken. - session.get_engine().pool.dispose() - self._servers = self._plugin.start_rpc_listeners() - - def wait(self): - for server in self._servers: - if isinstance(server, rpc_server.MessageHandlingServer): - server.wait() - - def stop(self): - for server in self._servers: - if isinstance(server, rpc_server.MessageHandlingServer): - server.kill() - self._servers = [] - - -def serve_rpc(): - plugin = manager.NeutronManager.get_plugin() - - # If 0 < rpc_workers then start_rpc_listeners would be called in a - # subprocess and we cannot simply catch the NotImplementedError. It is - # simpler to check this up front by testing whether the plugin supports - # multiple RPC workers. - if not plugin.rpc_workers_supported(): - LOG.debug(_("Active plugin doesn't implement start_rpc_listeners")) - if 0 < cfg.CONF.rpc_workers: - msg = _("'rpc_workers = %d' ignored because start_rpc_listeners " - "is not implemented.") - LOG.error(msg, cfg.CONF.rpc_workers) - raise NotImplementedError - - try: - rpc = RpcWorker(plugin) - - if cfg.CONF.rpc_workers < 1: - rpc.start() - return rpc - else: - launcher = common_service.ProcessLauncher(wait_interval=1.0) - launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers) - return launcher - except Exception: - with excutils.save_and_reraise_exception(): - LOG.exception(_('Unrecoverable error: please check log ' - 'for details.')) - - def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error(_('No known API applications configured.')) return - server = wsgi.Server("Neutron") + server = wsgi.Server("Tacker") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host, workers=cfg.CONF.api_workers) # Dump all option values here after all options are parsed cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) - LOG.info(_("Neutron service started, listening on %(host)s:%(port)s"), + LOG.info(_("Tacker service started, listening on %(host)s:%(port)s"), {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port}) return server @@ -248,7 +185,7 @@ class Service(rpc_compat.Service): if not binary: binary = os.path.basename(inspect.stack()[-1][1]) if not topic: - topic = binary.rpartition('neutron-')[2] + topic = binary.rpartition('tacker-')[2] topic = topic.replace("-", "_") if not manager: manager = CONF.get('%s_manager' % topic, None) @@ -295,5 +232,5 @@ class Service(rpc_compat.Service): def report_state(self): """Update the state of this service.""" - # Todo(gongysh) report state to neutron server + # Todo(gongysh) report state to tacker server pass diff --git a/neutron/version.py b/tacker/version.py similarity index 93% rename from neutron/version.py rename to tacker/version.py index 181926489..5ae7569c9 100644 --- a/neutron/version.py +++ b/tacker/version.py @@ -16,4 +16,4 @@ import pbr.version -version_info = pbr.version.VersionInfo('neutron') +version_info = pbr.version.VersionInfo('tacker') diff --git a/neutron/wsgi.py b/tacker/wsgi.py similarity index 98% rename from neutron/wsgi.py rename to tacker/wsgi.py index 9242530d5..c02288e50 100644 --- a/neutron/wsgi.py +++ b/tacker/wsgi.py @@ -30,22 +30,22 @@ from xml.etree import ElementTree as etree from xml.parsers import expat import eventlet.wsgi -eventlet.patcher.monkey_patch(all=False, socket=True, thread=True) +#eventlet.patcher.monkey_patch(all=False, socket=True, thread=True) from oslo.config import cfg import routes.middleware import webob.dec import webob.exc -from neutron.common import constants -from neutron.common import exceptions as exception -from neutron import context -from neutron.db import api -from neutron.openstack.common import excutils -from neutron.openstack.common import gettextutils -from neutron.openstack.common import jsonutils -from neutron.openstack.common import log as logging -from neutron.openstack.common import service as common_service -from neutron.openstack.common import systemd +from tacker.common import constants +from tacker.common import exceptions as exception +from tacker import context +from tacker.db import api +from tacker.openstack.common import excutils +from tacker.openstack.common import gettextutils +from tacker.openstack.common import jsonutils +from tacker.openstack.common import log as logging +from tacker.openstack.common import service as common_service +from tacker.openstack.common import systemd socket_opts = [ cfg.IntOpt('backlog', @@ -356,14 +356,14 @@ class Request(webob.Request): """ if not self.accept_language: return None - all_languages = gettextutils.get_available_languages('neutron') + all_languages = gettextutils.get_available_languages('tacker') return self.accept_language.best_match(all_languages) @property def context(self): - if 'neutron.context' not in self.environ: - self.environ['neutron.context'] = context.get_admin_context() - return self.environ['neutron.context'] + if 'tacker.context' not in self.environ: + self.environ['tacker.context'] = context.get_admin_context() + return self.environ['tacker.context'] class ActionDispatcher(object): @@ -887,7 +887,7 @@ class Application(object): which would result in a call to the `Wadl` class as - import neutron.api.fancy_api + import tacker.api.fancy_api fancy_api.Wadl(latest_version='1.3') You could of course re-implement the `factory` method in subclasses,