oslo: migrate to namespace-less import paths

Oslo project decided to move away from using oslo.* namespace for all their
libraries [1], so we should migrate to new import path.

This patch applies new paths for:
- oslo.config
- oslo.db
- oslo.i18n
- oslo.messaging
- oslo.middleware
- oslo.rootwrap
- oslo.serialization
- oslo.utils

Added hacking check to enforce new import paths for all oslo libraries.

Updated setup.cfg entry points.

We'll cleanup old imports from oslo-incubator modules on demand or
if/when oslo officially deprecates old namespace in one of the next
cycles.

[1]: https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Depends-On: https://review.openstack.org/#/c/147248/
Depends-On: https://review.openstack.org/#/c/152292/
Depends-On: https://review.openstack.org/#/c/147240/

Closes-Bug: #1409733
Change-Id: If0dce29a0980206ace9866112be529436194d47e
This commit is contained in:
Ihar Hrachyshka 2015-01-08 17:25:23 +01:00
parent 38f2704a85
commit 7a2a85623d
366 changed files with 693 additions and 670 deletions

View File

@ -12,6 +12,7 @@ Neutron Specific Commandments
- [N320] Validate that LOG messages, except debug ones, have translations
- [N321] Validate that jsonutils module is used instead of json
- [N322] Detect common errors with assert_called_once_with
- [N323] Enforce namespace-less imports for oslo libraries
Creating Unit Tests
-------------------

View File

@ -15,7 +15,7 @@
import os
from oslo.config import cfg
from oslo_config import cfg
from neutron.common import config
from neutron.openstack.common import log as logging

View File

@ -18,9 +18,9 @@ import os
import eventlet
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from neutron.agent.common import config
from neutron.agent.linux import dhcp
@ -49,7 +49,7 @@ class DhcpAgent(manager.Manager):
client side to execute the methods here. For more information about
changing rpc interfaces, see doc/source/devref/rpc_api.rst.
"""
target = messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0')
def __init__(self, host=None):
super(DhcpAgent, self).__init__(host=host)
@ -125,7 +125,7 @@ class DhcpAgent(manager.Manager):
{'net_id': network.id, 'action': action})
except Exception as e:
self.schedule_resync(e, network.id)
if (isinstance(e, messaging.RemoteError)
if (isinstance(e, oslo_messaging.RemoteError)
and e.exc_type == 'NetworkNotFound'
or isinstance(e, exceptions.NetworkNotFound)):
LOG.warning(_LW("Network %s has been deleted."), network.id)
@ -400,7 +400,7 @@ class DhcpPluginApi(object):
self.context = context
self.host = cfg.CONF.host
self.use_namespaces = use_namespaces
target = messaging.Target(
target = oslo_messaging.Target(
topic=topic,
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.0')

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
DHCP_AGENT_OPTS = [
cfg.IntOpt('resync_interval', default=5,

View File

@ -19,7 +19,7 @@ import sys
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.dhcp import config as dhcp_config

View File

@ -15,7 +15,7 @@
import abc
from oslo.config import cfg
from oslo_config import cfg
import six
from neutron.common import constants as n_const

View File

@ -15,11 +15,11 @@
import eventlet
import netaddr
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import excutils
from oslo_utils import importutils
from oslo_utils import timeutils
from neutron.agent.common import config
from neutron.agent.l3 import dvr
@ -77,7 +77,7 @@ class L3PluginApi(object):
def __init__(self, topic, host):
self.host = host
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def get_routers(self, context, router_ids=None):
@ -89,9 +89,9 @@ class L3PluginApi(object):
def get_external_network_id(self, context):
"""Make a remote process call to retrieve the external network id.
@raise messaging.RemoteError: with TooManyExternalNetworks as
exc_type if there are more than one
external network
@raise oslo_messaging.RemoteError: with TooManyExternalNetworks as
exc_type if there are more than one
external network
"""
cctxt = self.client.prepare()
return cctxt.call(context, 'get_external_network_id', host=self.host)
@ -138,7 +138,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
- del_arp_entry
Needed by the L3 service when dealing with DVR
"""
target = messaging.Target(version='1.2')
target = oslo_messaging.Target(version='1.2')
def __init__(self, host, conf=None):
if conf:
@ -178,7 +178,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
try:
self.neutron_service_plugins = (
self.plugin_rpc.get_service_plugin_list(self.context))
except messaging.RemoteError as e:
except oslo_messaging.RemoteError as e:
with excutils.save_and_reraise_exception() as ctx:
ctx.reraise = False
LOG.warning(_LW('l3-agent cannot check service plugins '
@ -189,7 +189,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
'UnsupportedVersion you can ignore this '
'warning. Detail message: %s'), e)
self.neutron_service_plugins = None
except messaging.MessagingTimeout as e:
except oslo_messaging.MessagingTimeout as e:
with excutils.save_and_reraise_exception() as ctx:
if retry_count > 0:
ctx.reraise = False
@ -335,7 +335,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
self.target_ex_net_id = self.plugin_rpc.get_external_network_id(
self.context)
return self.target_ex_net_id
except messaging.RemoteError as e:
except oslo_messaging.RemoteError as e:
with excutils.save_and_reraise_exception() as ctx:
if e.exc_type == 'TooManyExternalNetworks':
ctx.reraise = False
@ -1172,7 +1172,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback,
routers = self.plugin_rpc.get_routers(context,
[self.conf.router_id])
except messaging.MessagingException:
except oslo_messaging.MessagingException:
LOG.exception(_LE("Failed synchronizing routers due to RPC error"))
else:
LOG.debug('Processing :%r', routers)

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
OPTS = [

View File

@ -15,7 +15,7 @@
import os
from oslo.config import cfg
from oslo_config import cfg
from neutron.common import constants as l3_constants
from neutron.i18n import _LE

View File

@ -16,7 +16,7 @@
import datetime
import Queue
from oslo.utils import timeutils
from oslo_utils import timeutils
# Lower value is higher priority
PRIORITY_RPC = 0

View File

@ -19,7 +19,7 @@ import sys
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.l3 import config as l3_config

View File

@ -22,8 +22,8 @@ import socket
import sys
import netaddr
from oslo.serialization import jsonutils
from oslo.utils import importutils
from oslo_serialization import jsonutils
from oslo_utils import importutils
import six
from neutron.agent.linux import ip_lib

View File

@ -16,8 +16,8 @@ import collections
import os.path
import eventlet
from oslo.config import cfg
from oslo_concurrency import lockutils
from oslo_config import cfg
from neutron.agent.common import config as agent_cfg
from neutron.agent.linux import ip_lib
@ -135,7 +135,7 @@ class ProcessMonitor(object):
"""Handle multiple process managers and watch over all of them.
:param config: oslo config object with the agent configuration.
:type config: oslo.config.ConfigOpts
:type config: oslo_config.ConfigOpts
:param root_helper: root helper to be used with new ProcessManagers
:type root_helper: str
:param resource_type: can be dhcp, router, load_balancer, etc.

View File

@ -16,8 +16,8 @@
import abc
import netaddr
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
import six
from neutron.agent.common import config

View File

@ -17,7 +17,7 @@ import eventlet
import os
import netaddr
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.linux import utils
from neutron.common import exceptions

View File

@ -14,7 +14,7 @@
# under the License.
import netaddr
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent import firewall
from neutron.agent.linux import ipset_manager

View File

@ -23,9 +23,9 @@ import os
import re
import sys
from oslo.config import cfg
from oslo.utils import excutils
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.agent.common import config
from neutron.agent.linux import iptables_comments as ic

View File

@ -18,7 +18,7 @@ import os
import stat
import netaddr
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.linux import external_process
from neutron.agent.linux import utils

View File

@ -17,8 +17,8 @@ import collections
import itertools
import operator
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from oslo_utils import excutils
import retrying
import six

View File

@ -16,8 +16,8 @@ import collections
import itertools
import uuid
from oslo.serialization import jsonutils
from oslo.utils import excutils
from oslo_serialization import jsonutils
from oslo_utils import excutils
from neutron.agent.linux import utils
from neutron.agent import ovsdb

View File

@ -15,7 +15,7 @@
import jinja2
import netaddr
from oslo.config import cfg
from oslo_config import cfg
import six
from neutron.agent.linux import utils

View File

@ -23,7 +23,7 @@ import tempfile
from eventlet.green import subprocess
from eventlet import greenthread
from oslo.utils import excutils
from oslo_utils import excutils
from neutron.common import constants
from neutron.common import utils

View File

@ -20,9 +20,9 @@ import socket
import eventlet
import httplib2
from neutronclient.v2_0 import client
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import excutils
import six.moves.urllib.parse as urlparse
import webob
@ -56,9 +56,10 @@ class MetadataPluginAPI(object):
"""
def __init__(self, topic):
target = messaging.Target(topic=topic,
namespace=n_const.RPC_NAMESPACE_METADATA,
version='1.0')
target = oslo_messaging.Target(
topic=topic,
namespace=n_const.RPC_NAMESPACE_METADATA,
version='1.0')
self.client = n_rpc.get_client(target)
def get_ports(self, context, filters):
@ -121,7 +122,7 @@ class MetadataProxyHandler(object):
if self.use_rpc:
try:
return self.plugin_rpc.get_ports(self.context, filters)
except (messaging.MessagingException, AttributeError):
except (oslo_messaging.MessagingException, AttributeError):
# TODO(obondarev): remove fallback once RPC is proven
# to work fine with metadata agent (K or L release at most)
LOG.warning(_LW('Server does not support metadata RPC, '

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from neutron.common import utils

View File

@ -15,7 +15,7 @@
import os
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.linux import external_process

View File

@ -19,7 +19,7 @@ import eventlet
eventlet.monkey_patch()
import httplib2
from oslo.config import cfg
from oslo_config import cfg
import six.moves.urllib.parse as urlparse
import webob

View File

@ -17,7 +17,7 @@ import sys
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config as agent_conf
from neutron.agent.metadata import agent

View File

@ -14,8 +14,8 @@
import abc
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
import six
interface_map = {

View File

@ -14,8 +14,8 @@
# under the License.
import itertools
from oslo import messaging
from oslo.utils import timeutils
import oslo_messaging
from oslo_utils import timeutils
from neutron.common import rpc as n_rpc
from neutron.common import topics
@ -58,7 +58,7 @@ def create_consumers(endpoints, prefix, topic_details, start_listening=True):
class PluginReportStateAPI(object):
def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def report_state(self, context, agent_state, use_call=False):
@ -82,7 +82,7 @@ class PluginApi(object):
'''
def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def get_device_details(self, context, device, agent_id, host=None):
@ -95,7 +95,7 @@ class PluginApi(object):
cctxt = self.client.prepare(version='1.3')
res = cctxt.call(context, 'get_devices_details_list',
devices=devices, agent_id=agent_id, host=host)
except messaging.UnsupportedVersion:
except oslo_messaging.UnsupportedVersion:
# If the server has not been upgraded yet, a DVR-enabled agent
# may not work correctly, however it can function in 'degraded'
# mode, in that DVR routers may not be in the system yet, and

View File

@ -16,9 +16,9 @@
import functools
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from neutron.agent import firewall
from neutron.common import constants
@ -96,8 +96,9 @@ class SecurityGroupServerRpcApi(object):
doc/source/devref/rpc_api.rst.
"""
def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0',
namespace=constants.RPC_NAMESPACE_SECGROUP)
target = oslo_messaging.Target(
topic=topic, version='1.0',
namespace=constants.RPC_NAMESPACE_SECGROUP)
self.client = n_rpc.get_client(target)
def security_group_rules_for_devices(self, context, devices):
@ -199,7 +200,7 @@ class SecurityGroupAgentRpc(object):
try:
self.plugin_rpc.security_group_info_for_devices(
self.context, devices=[])
except messaging.UnsupportedVersion:
except oslo_messaging.UnsupportedVersion:
LOG.warning(_LW('security_group_info_for_devices rpc call not '
'supported by the server, falling back to old '
'security_group_rules_for_devices which scales '

View File

@ -15,7 +15,7 @@
import urllib
from oslo.config import cfg
from oslo_config import cfg
from webob import exc
from neutron.common import constants

View File

@ -20,7 +20,7 @@ import imp
import itertools
import os
from oslo.config import cfg
from oslo_config import cfg
import routes
import six
import webob.dec

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import constants
from neutron.common import rpc as n_rpc
@ -48,7 +48,7 @@ class DhcpAgentNotifyAPI(object):
def __init__(self, topic=topics.DHCP_AGENT, plugin=None):
self._plugin = plugin
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
@property

View File

@ -15,7 +15,7 @@
import random
from oslo import messaging
import oslo_messaging
from neutron.common import constants
from neutron.common import rpc as n_rpc
@ -34,7 +34,7 @@ class L3AgentNotifyAPI(object):
"""API for plugin to notify L3 agent."""
def __init__(self, topic=topics.L3_AGENT):
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def _notification_host(self, context, method, payload, host):

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import constants
from neutron.common import rpc as n_rpc
@ -30,7 +30,7 @@ class MeteringAgentNotifyAPI(object):
def __init__(self, topic=topics.METERING_AGENT):
self.topic = topic
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def _agent_notification(self, context, method, routers):

View File

@ -16,10 +16,10 @@
import itertools
import operator
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo import messaging
from oslo.utils import excutils
from oslo_config import cfg
from oslo_db import exception as db_exc
import oslo_messaging
from oslo_utils import excutils
from neutron.api.v2 import attributes
from neutron.common import constants
@ -47,8 +47,9 @@ class DhcpRpcCallback(object):
# 1.0 - Initial version.
# 1.1 - Added get_active_networks_info, create_dhcp_port,
# and update_dhcp_port methods.
target = messaging.Target(namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.1')
target = oslo_messaging.Target(
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.1')
def _get_active_networks(self, context, **kwargs):
"""Retrieve and return a list of the active networks."""

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import log
from neutron.common import rpc as n_rpc
@ -28,7 +28,7 @@ class DVRServerRpcApi(object):
"""Agent-side RPC (stub) for agent-to-plugin interaction."""
def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
@log.log
@ -59,7 +59,7 @@ class DVRServerRpcCallback(object):
# History
# 1.0 Initial version
target = messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0')
@property
def plugin(self):

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.config import cfg
from oslo import messaging
from oslo.serialization import jsonutils
from oslo_config import cfg
import oslo_messaging
from oslo_serialization import jsonutils
from neutron.common import constants
from neutron.common import exceptions
@ -40,7 +40,7 @@ class L3RpcCallback(object):
# 1.2 Added methods for DVR support
# 1.3 Added a method that returns the list of activated services
# 1.4 Added L3 HA update_router_state
target = messaging.Target(version='1.4')
target = oslo_messaging.Target(version='1.4')
@property
def plugin(self):

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import constants
from neutron import manager
@ -30,8 +30,8 @@ class MetadataRpcCallback(object):
"""
# 1.0 MetadataPluginAPI BASE_RPC_API_VERSION
target = messaging.Target(version='1.0',
namespace=constants.RPC_NAMESPACE_METADATA)
target = oslo_messaging.Target(version='1.0',
namespace=constants.RPC_NAMESPACE_METADATA)
@property
def plugin(self):

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import constants
from neutron import manager
@ -37,8 +37,8 @@ class SecurityGroupServerRpcCallback(object):
# NOTE: target must not be overridden in subclasses
# to keep RPC API version consistent across plugins.
target = messaging.Target(version='1.2',
namespace=constants.RPC_NAMESPACE_SECGROUP)
target = oslo_messaging.Target(version='1.2',
namespace=constants.RPC_NAMESPACE_SECGROUP)
@property
def plugin(self):

View File

@ -17,8 +17,8 @@ import copy
import netaddr
import webob.exc
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.api import api_common
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api

View File

@ -20,7 +20,7 @@ Utility methods for working with WSGI servers redux
import sys
import netaddr
from oslo import i18n
import oslo_i18n
import six
import webob.dec
import webob.exc
@ -173,7 +173,7 @@ def translate(translatable, locale):
:returns: the translated object, or the object as-is if it
was not translated
"""
localize = i18n.translate
localize = oslo_i18n.translate
if isinstance(translatable, exceptions.NeutronException):
translatable.msg = localize(translatable.msg, locale)
elif isinstance(translatable, webob.exc.HTTPError):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from neutron.api import extensions
from neutron.api.v2 import base

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.config import cfg
from oslo_config import cfg
import routes as routes_mapper
import six.moves.urllib.parse as urlparse
import webob

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import i18n
import oslo_i18n
import webob.dec
from neutron.api.views import versions as versions_view
@ -43,7 +43,7 @@ class Versions(object):
if req.path != '/':
language = req.best_match_language()
msg = _('Unknown API version specified')
msg = i18n.translate(msg, language)
msg = oslo_i18n.translate(msg, language)
return webob.exc.HTTPNotFound(explanation=msg)
builder = versions_view.get_view_builder(req)

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo.middleware import request_id
from oslo_config import cfg
from oslo_middleware import request_id
import webob.dec
import webob.exc

View File

@ -18,8 +18,8 @@ import re
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from neutron.agent.common import config as agent_config
from neutron.agent.dhcp import config as dhcp_config

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import config as l3_config

View File

@ -20,7 +20,7 @@ from neutron.cmd.sanity import checks
from neutron.common import config
from neutron.i18n import _LE, _LW
from neutron.openstack.common import log as logging
from oslo.config import cfg
from oslo_config import cfg
LOG = logging.getLogger(__name__)

View File

@ -20,9 +20,9 @@ Routines for configuring Neutron
import os
import sys
from oslo.config import cfg
from oslo.db import options as db_options
from oslo import messaging
from oslo_config import cfg
from oslo_db import options as db_options
import oslo_messaging
from paste import deploy
from neutron.api.v2 import attributes
@ -134,7 +134,7 @@ cfg.CONF.register_opts(core_opts)
cfg.CONF.register_cli_opts(core_cli_opts)
# Ensure that the control exchange is set correctly
messaging.set_transport_defaults(control_exchange='neutron')
oslo_messaging.set_transport_defaults(control_exchange='neutron')
_SQL_CONNECTION_DEFAULT = 'sqlite://'
# Update the default QueuePool parameters. These can be tweaked by the
# configuration variables - max_pool_size, max_overflow and pool_timeout

View File

@ -17,7 +17,7 @@
Neutron base exception handling.
"""
from oslo.utils import excutils
from oslo_utils import excutils
class NeutronException(Exception):

View File

@ -17,7 +17,7 @@ import ConfigParser
import importlib
import os
from oslo.config import cfg
from oslo_config import cfg
from neutron.openstack.common import log as logging
@ -62,7 +62,7 @@ class NeutronModules(object):
def alembic_name(self, module):
return self.MODULES[module]['alembic-name']
# Return an INI parser for the child module. oslo.conf is a bit too
# Return an INI parser for the child module. oslo.config is a bit too
# magical in its INI loading, and in one notable case, we need to merge
# together the [service_providers] section across at least four
# repositories.

View File

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo import messaging
from oslo.messaging import serializer as om_serializer
from oslo_config import cfg
import oslo_messaging
from oslo_messaging import serializer as om_serializer
from neutron.common import exceptions
from neutron import context
@ -51,11 +51,11 @@ TRANSPORT_ALIASES = {
def init(conf):
global TRANSPORT, NOTIFIER
exmods = get_allowed_exmods()
TRANSPORT = messaging.get_transport(conf,
allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES)
TRANSPORT = oslo_messaging.get_transport(conf,
allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES)
serializer = RequestContextSerializer()
NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer)
NOTIFIER = oslo_messaging.Notifier(TRANSPORT, serializer=serializer)
def cleanup():
@ -81,17 +81,17 @@ def get_allowed_exmods():
def get_client(target, version_cap=None, serializer=None):
assert TRANSPORT is not None
serializer = RequestContextSerializer(serializer)
return messaging.RPCClient(TRANSPORT,
target,
version_cap=version_cap,
serializer=serializer)
return oslo_messaging.RPCClient(TRANSPORT,
target,
version_cap=version_cap,
serializer=serializer)
def get_server(target, endpoints, serializer=None):
assert TRANSPORT is not None
serializer = RequestContextSerializer(serializer)
return messaging.get_rpc_server(TRANSPORT, target, endpoints,
'eventlet', serializer)
return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
'eventlet', serializer)
def get_notifier(service=None, host=None, publisher_id=None):
@ -185,7 +185,7 @@ class Connection(object):
self.servers = []
def create_consumer(self, topic, endpoints, fanout=False):
target = messaging.Target(
target = oslo_messaging.Target(
topic=topic, server=cfg.CONF.host, fanout=fanout)
server = get_server(target, endpoints)
self.servers.append(server)

View File

@ -31,9 +31,9 @@ import socket
import uuid
from eventlet.green import subprocess
from oslo.config import cfg
from oslo.utils import excutils
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.common import constants as q_const
from neutron.openstack.common import log as logging

View File

@ -15,11 +15,11 @@
from eventlet import greenthread
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo import messaging
from oslo.serialization import jsonutils
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_db import exception as db_exc
import oslo_messaging
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import sqlalchemy as sa
from sqlalchemy.orm import exc
from sqlalchemy import sql
@ -222,7 +222,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase):
class AgentExtRpcCallback(object):
"""Processes the rpc report in plugin implementations."""
target = messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0')
START_TIME = timeutils.utcnow()
def __init__(self, plugin=None):

View File

@ -17,8 +17,8 @@ import datetime
import random
import time
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo.db.sqlalchemy import session
from oslo_config import cfg
from oslo_db.sqlalchemy import session
_FACADE = None

View File

@ -14,9 +14,9 @@
# under the License.
import netaddr
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.utils import excutils
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_utils import excutils
from sqlalchemy import and_
from sqlalchemy import event
from sqlalchemy import orm

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.db import exception as db_exc
from oslo_db import exception as db_exc
import sqlalchemy as sa
@ -26,7 +26,7 @@ from neutron.extensions import portbindings
from neutron.i18n import _LE
from neutron import manager
from neutron.openstack.common import log as logging
from oslo.config import cfg
from oslo_config import cfg
from sqlalchemy.orm import exc
LOG = logging.getLogger(__name__)

View File

@ -14,7 +14,7 @@
# under the License.
import netaddr
from oslo.config import cfg
from oslo_config import cfg
import sqlalchemy as sa
from sqlalchemy import orm

View File

@ -12,9 +12,9 @@
# 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 oslo.db import exception as db_exc
from oslo import messaging
from oslo_config import cfg
from oslo_db import exception as db_exc
import oslo_messaging
import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy import or_
@ -111,7 +111,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
try:
self.reschedule_router(context, binding.router_id)
except (l3agentscheduler.RouterReschedulingFailed,
messaging.RemoteError):
oslo_messaging.RemoteError):
# Catch individual router rescheduling errors here
# so one broken one doesn't stop the iteration.
LOG.exception(_LE("Failed to reschedule router %s"),

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from neutron.api.v2 import attributes
from neutron.common import constants as l3_const

View File

@ -15,7 +15,7 @@
import random
from oslo.db import exception as db_exc
from oslo_db import exception as db_exc
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc

View File

@ -14,9 +14,9 @@
#
import netaddr
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.utils import excutils
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_utils import excutils
import sqlalchemy as sa
from sqlalchemy import orm

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import messaging
import oslo_messaging
from neutron.common import constants as consts
from neutron.common import utils
@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
class MeteringRpcCallbacks(object):
target = messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0')
def __init__(self, meter_plugin):
self.meter_plugin = meter_plugin

View File

@ -15,8 +15,8 @@
from logging import config as logging_config
from alembic import context
from oslo.config import cfg
from oslo.db.sqlalchemy import session
from oslo_config import cfg
from oslo_db.sqlalchemy import session
import sqlalchemy as sa
from sqlalchemy import event

View File

@ -20,8 +20,8 @@ from alembic import config as alembic_config
from alembic import environment
from alembic import script as alembic_script
from alembic import util as alembic_util
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from neutron.common import repos

View File

@ -60,7 +60,7 @@ To manually test migration from ovs to ml2 with devstack:
import argparse
from oslo.db.sqlalchemy import session
from oslo_db.sqlalchemy import session
import sqlalchemy as sa
from neutron.extensions import portbindings

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo.db.sqlalchemy import models
from oslo_db.sqlalchemy import models
from sqlalchemy.ext import declarative
from sqlalchemy import orm

View File

@ -17,7 +17,7 @@ import shlex
import socket
import netaddr
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.linux import dhcp

View File

@ -15,8 +15,8 @@
import sys
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
from neutron.agent.common import config
from neutron.agent.linux import interface

View File

@ -16,7 +16,7 @@ import webob.exc
from neutron.api.v2 import attributes as attr
from neutron.common import exceptions as nexception
from oslo.config import cfg
from oslo_config import cfg
allowed_address_pair_opts = [
#TODO(limao): use quota framework when it support quota for attributes

View File

@ -15,7 +15,7 @@
import abc
from oslo.config import cfg
from oslo_config import cfg
from neutron.api import extensions
from neutron.api.v2 import attributes as attr

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo.utils import importutils
from oslo_config import cfg
from oslo_utils import importutils
import webob
from neutron.api import extensions

View File

@ -16,7 +16,7 @@
import abc
import netaddr
from oslo.config import cfg
from oslo_config import cfg
import six
from neutron.api import extensions

View File

@ -53,6 +53,10 @@ log_translation_hint = re.compile(
for level, hint in _all_log_levels.iteritems()))
oslo_namespace_imports_dot = re.compile(r"from[\s]*oslo[.]")
oslo_namespace_imports_root = re.compile(r"from[\s]*oslo[\s]*import[\s]*")
def validate_log_translations(logical_line, physical_line, filename):
# Translations are not required in the test directory
if "neutron/tests" in filename:
@ -114,8 +118,22 @@ def check_assert_called_once_with(logical_line, filename):
yield (0, msg)
def check_oslo_namespace_imports(logical_line, blank_before, filename):
if re.match(oslo_namespace_imports_dot, logical_line):
msg = ("N323: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'),
logical_line)
yield(0, msg)
elif re.match(oslo_namespace_imports_root, logical_line):
msg = ("N323: '%s' must be used instead of '%s'.") % (
logical_line.replace('from oslo import ', 'import oslo_'),
logical_line)
yield(0, msg)
def factory(register):
register(validate_log_translations)
register(use_jsonutils)
register(check_assert_called_once_with)
register(no_translate_debug_logs)
register(check_oslo_namespace_imports)

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo import i18n
import oslo_i18n
_translators = i18n.TranslatorFactory(domain='neutron')
_translators = oslo_i18n.TranslatorFactory(domain='neutron')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -15,9 +15,9 @@
import weakref
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from neutron.common import utils
from neutron.i18n import _LE, _LI
@ -36,7 +36,7 @@ CORE_PLUGINS_NAMESPACE = 'neutron.core_plugins'
class Manager(periodic_task.PeriodicTasks):
# Set RPC API version to 1.0 by default.
target = messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0')
def __init__(self, host=None):
if not host:

View File

@ -17,7 +17,7 @@ import eventlet
from novaclient import exceptions as nova_exceptions
import novaclient.v1_1.client as nclient
from novaclient.v1_1.contrib import server_external_events
from oslo.config import cfg
from oslo_config import cfg
from sqlalchemy.orm import attributes as sql_attr
from neutron.common import constants

View File

@ -22,9 +22,9 @@ import time
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import excutils
from neutron.agent.linux import ovs_lib
from neutron.agent.linux import utils
@ -73,7 +73,7 @@ class IVSBridge(ovs_lib.OVSBridge):
class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
target = messaging.Target(version='1.1')
target = oslo_messaging.Target(version='1.1')
def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'):
super(RestProxyAgent, self).__init__()

View File

@ -17,7 +17,7 @@
This module manages configuration options
"""
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config as agconfig
from neutron.common import utils

View File

@ -17,9 +17,9 @@ import re
import string
import time
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.db.sqlalchemy import session
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import session
import sqlalchemy as sa
from neutron.db import model_base

View File

@ -22,8 +22,8 @@ It is intended to be used in conjunction with the Big Switch ML2 driver or the
Big Switch core plugin.
"""
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.api import extensions as neutron_extensions
from neutron.common import exceptions

View File

@ -46,9 +46,9 @@ import httplib
import re
import eventlet
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from sqlalchemy.orm import exc as sqlexc
from neutron.agent import securitygroups_rpc as sg_rpc
@ -98,7 +98,7 @@ class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
def __init__(self, topic):
self.topic = topic
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def port_update(self, context, port):

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
import sqlalchemy as sa
from sqlalchemy import orm

View File

@ -36,9 +36,9 @@ import weakref
import eventlet
import eventlet.corolocal
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import excutils
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import excutils
from neutron.common import exceptions
from neutron.i18n import _LE, _LI, _LW

View File

@ -22,7 +22,7 @@ from __future__ import print_function
import re
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
from six import moves
from wsgiref import simple_server

View File

@ -19,10 +19,10 @@
"""Implentation of Brocade Neutron Plugin."""
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo_config import cfg
from oslo_context import context as oslo_context
import oslo_messaging
from oslo_utils import importutils
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
@ -80,7 +80,7 @@ cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
class BridgeRpcCallbacks(object):
"""Agent callback."""
target = messaging.Target(version='1.2')
target = oslo_messaging.Target(version='1.2')
# Device names start with "tap"
# history
# 1.1 Support Security Group RPC
@ -177,7 +177,7 @@ class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
def __init__(self, topic):
self.topic = topic
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
self.topic_network_delete = topics.get_topic_name(topic,
topics.NETWORK,

View File

@ -19,7 +19,7 @@ Neutron network life-cycle management.
"""
from ncclient import manager
from oslo.utils import excutils
from oslo_utils import excutils
from neutron.i18n import _LE
from neutron.openstack.common import log as logging

View File

@ -18,11 +18,11 @@ import pprint
import sys
import time
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_concurrency import lockutils
from oslo_config import cfg
import oslo_messaging
from oslo_utils import importutils
from oslo_utils import timeutils
from neutron.agent.common import config
from neutron.agent.linux import external_process
@ -54,7 +54,7 @@ class CiscoDeviceManagementApi(object):
def __init__(self, topic, host):
self.host = host
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def report_dead_hosting_devices(self, context, hd_ids=None):
@ -94,7 +94,7 @@ class CiscoCfgAgent(manager.Manager):
The main entry points in this class are the `process_services()` and
`_backlog_task()` .
"""
target = messaging.Target(version='1.1')
target = oslo_messaging.Target(version='1.1')
OPTS = [
cfg.IntOpt('rpc_loop_interval', default=10,

View File

@ -21,7 +21,7 @@ import xml.etree.ElementTree as ET
import ciscoconfparse
from ncclient import manager
from oslo.config import cfg
from oslo_config import cfg
from neutron.i18n import _LE, _LI, _LW
from neutron.plugins.cisco.cfg_agent import cfg_exceptions as cfg_exc

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import excutils
from oslo.utils import importutils
from oslo_utils import excutils
from oslo_utils import importutils
from neutron.i18n import _LE
from neutron.openstack.common import log as logging

View File

@ -14,7 +14,7 @@
import logging
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
from neutron.plugins.cisco.cfg_agent.device_drivers import devicedriver_api

View File

@ -14,8 +14,8 @@
import datetime
from oslo.config import cfg
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import timeutils
from neutron.agent.linux import utils as linux_utils
from neutron.i18n import _LI, _LW

View File

@ -16,8 +16,8 @@ import collections
import eventlet
import netaddr
from oslo import messaging
from oslo.utils import excutils
import oslo_messaging
from oslo_utils import excutils
from neutron.common import constants as l3_constants
from neutron.common import rpc as n_rpc
@ -90,7 +90,7 @@ class CiscoRoutingPluginApi(object):
def __init__(self, topic, host):
self.host = host
target = messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)
def get_routers(self, context, router_ids=None, hd_ids=None):
@ -281,7 +281,7 @@ class RoutingServiceHelper(object):
if device_ids:
return self.plugin_rpc.get_routers(self.context,
hd_ids=device_ids)
except messaging.MessagingException:
except oslo_messaging.MessagingException:
LOG.exception(_LE("RPC Error in fetching routers from plugin"))
self.fullsync = True

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
from oslo_config import cfg
from neutron.agent.common import config

View File

@ -16,9 +16,9 @@ import random
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as k_client
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from oslo_config import cfg
from oslo_utils import importutils
from oslo_utils import timeutils
from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload

View File

@ -14,8 +14,8 @@
import copy
from oslo.config import cfg
from oslo_concurrency import lockutils
from oslo_config import cfg
from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload
from sqlalchemy.sql import expression as expr

View File

@ -14,8 +14,8 @@
import netaddr
from oslo.config import cfg
from oslo.utils import excutils
from oslo_config import cfg
from oslo_utils import excutils
from neutron.i18n import _LE
from neutron import manager

View File

@ -14,7 +14,7 @@
import eventlet
from oslo.config import cfg
from oslo_config import cfg
from sqlalchemy.orm import exc
from sqlalchemy.sql import expression as expr

Some files were not shown because too many files have changed in this diff Show More