rename neutron/common to tacker/common

Change-Id: Idc45de0fdcf9bcfe3b8b5a44af9baffde3ae64f6
This commit is contained in:
Isaku Yamahata 2014-06-26 17:05:42 +09:00
parent e78ae223da
commit ea44fc81bc
10 changed files with 70 additions and 108 deletions

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
""" """
Routines for configuring Neutron Routines for configuring Tacker
""" """
import os import os
@ -23,11 +23,10 @@ from oslo.config import cfg
from oslo import messaging from oslo import messaging
from paste import deploy from paste import deploy
from neutron.api.v2 import attributes from tacker.common import utils
from neutron.common import utils from tacker.openstack.common.db import options as db_options
from neutron.openstack.common.db import options as db_options from tacker.openstack.common import log as logging
from neutron.openstack.common import log as logging from tacker import version
from neutron import version
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -35,7 +34,7 @@ LOG = logging.getLogger(__name__)
core_opts = [ core_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0', cfg.StrOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")), help=_("The host IP to bind to")),
cfg.IntOpt('bind_port', default=9696, cfg.IntOpt('bind_port', default=8888,
help=_("The port to bind to")), help=_("The port to bind to")),
cfg.StrOpt('api_paste_config', default="api-paste.ini", cfg.StrOpt('api_paste_config', default="api-paste.ini",
help=_("The API paste config file to use")), help=_("The API paste config file to use")),
@ -45,14 +44,6 @@ core_opts = [
help=_("The policy file to use")), help=_("The policy file to use")),
cfg.StrOpt('auth_strategy', default='keystone', cfg.StrOpt('auth_strategy', default='keystone',
help=_("The type of authentication to use")), help=_("The type of authentication to use")),
cfg.StrOpt('core_plugin',
help=_("The core plugin Neutron will use")),
cfg.ListOpt('service_plugins', default=[],
help=_("The service plugins Neutron will use")),
cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00",
help=_("The base MAC address Neutron will use for VIFs")),
cfg.IntOpt('mac_generation_retries', default=16,
help=_("How many times Neutron will retry MAC generation")),
cfg.BoolOpt('allow_bulk', default=True, cfg.BoolOpt('allow_bulk', default=True,
help=_("Allow the usage of the bulk API")), help=_("Allow the usage of the bulk API")),
cfg.BoolOpt('allow_pagination', default=False, cfg.BoolOpt('allow_pagination', default=False,
@ -63,30 +54,8 @@ core_opts = [
help=_("The maximum number of items returned in a single " help=_("The maximum number of items returned in a single "
"response, value was 'infinite' or negative integer " "response, value was 'infinite' or negative integer "
"means no limit")), "means no limit")),
cfg.IntOpt('max_dns_nameservers', default=5,
help=_("Maximum number of DNS nameservers")),
cfg.IntOpt('max_subnet_host_routes', default=20,
help=_("Maximum number of host routes per subnet")),
cfg.IntOpt('max_fixed_ips_per_port', default=5,
help=_("Maximum number of fixed ips per port")),
cfg.IntOpt('dhcp_lease_duration', default=86400,
deprecated_name='dhcp_lease_time',
help=_("DHCP lease duration (in seconds). Use -1 to tell "
"dnsmasq to use infinite lease times.")),
cfg.BoolOpt('dhcp_agent_notification', default=True,
help=_("Allow sending resource operation"
" notification to DHCP agent")),
cfg.BoolOpt('allow_overlapping_ips', default=False,
help=_("Allow overlapping IP support in Neutron")),
cfg.StrOpt('host', default=utils.get_hostname(), cfg.StrOpt('host', default=utils.get_hostname(),
help=_("The hostname Neutron is running on")), help=_("The hostname Tacker is running on")),
cfg.BoolOpt('force_gateway_on_subnet', default=False,
help=_("Ensure that configured gateway is on subnet")),
cfg.BoolOpt('notify_nova_on_port_status_changes', default=True,
help=_("Send notification to nova when port status changes")),
cfg.BoolOpt('notify_nova_on_port_data_changes', default=True,
help=_("Send notification to nova when port data (fixed_ips/"
"floatingip) changes so nova can update its cache.")),
cfg.StrOpt('nova_url', cfg.StrOpt('nova_url',
default='http://127.0.0.1:8774/v2', default='http://127.0.0.1:8774/v2',
help=_('URL for connection to nova')), help=_('URL for connection to nova')),
@ -108,15 +77,12 @@ core_opts = [
cfg.StrOpt('nova_region_name', cfg.StrOpt('nova_region_name',
help=_('Name of nova region to use. Useful if keystone manages' help=_('Name of nova region to use. Useful if keystone manages'
' more than one region.')), ' more than one region.')),
cfg.IntOpt('send_events_interval', default=2,
help=_('Number of seconds between sending events to nova if '
'there are any events to send.')),
] ]
core_cli_opts = [ core_cli_opts = [
cfg.StrOpt('state_path', cfg.StrOpt('state_path',
default='/var/lib/neutron', default='/var/lib/tacker',
help=_("Where to store Neutron state files. " help=_("Where to store Tacker state files. "
"This directory must be writable by the agent.")), "This directory must be writable by the agent.")),
] ]
@ -125,7 +91,7 @@ cfg.CONF.register_opts(core_opts)
cfg.CONF.register_cli_opts(core_cli_opts) cfg.CONF.register_cli_opts(core_cli_opts)
# Ensure that the control exchange is set correctly # Ensure that the control exchange is set correctly
messaging.set_transport_defaults(control_exchange='neutron') messaging.set_transport_defaults(control_exchange='tacker')
_SQL_CONNECTION_DEFAULT = 'sqlite://' _SQL_CONNECTION_DEFAULT = 'sqlite://'
# Update the default QueuePool parameters. These can be tweaked by the # Update the default QueuePool parameters. These can be tweaked by the
# configuration variables - max_pool_size, max_overflow and pool_timeout # configuration variables - max_pool_size, max_overflow and pool_timeout
@ -135,29 +101,22 @@ db_options.set_defaults(sql_connection=_SQL_CONNECTION_DEFAULT,
def init(args, **kwargs): def init(args, **kwargs):
cfg.CONF(args=args, project='neutron', cfg.CONF(args=args, project='tacker',
version='%%prog %s' % version.version_info.release_string(), version='%%prog %s' % version.version_info.release_string(),
**kwargs) **kwargs)
# FIXME(ihrachys): if import is put in global, circular import # FIXME(ihrachys): if import is put in global, circular import
# failure occurs # failure occurs
from neutron.common import rpc as n_rpc from tacker.common import rpc as n_rpc
n_rpc.init(cfg.CONF) n_rpc.init(cfg.CONF)
# Validate that the base_mac is of the correct format
msg = attributes._validate_regex(cfg.CONF.base_mac,
attributes.MAC_PATTERN)
if msg:
msg = _("Base MAC: %s") % msg
raise Exception(msg)
def setup_logging(conf): def setup_logging(conf):
"""Sets up the logging options for a log with supplied name. """Sets up the logging options for a log with supplied name.
:param conf: a cfg.ConfOpts object :param conf: a cfg.ConfOpts object
""" """
product_name = "neutron" product_name = "tacker"
logging.setup(product_name) logging.setup(product_name)
LOG.info(_("Logging enabled!")) LOG.info(_("Logging enabled!"))

View File

@ -14,14 +14,14 @@
# under the License. # under the License.
""" """
Neutron base exception handling. Tacker base exception handling.
""" """
from neutron.openstack.common import excutils from tacker.openstack.common import excutils
class NeutronException(Exception): class TackerException(Exception):
"""Base Neutron Exception. """Base Tacker Exception.
To correctly use this class, inherit from it and define To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd a 'message' property. That message will get printf'd
@ -31,14 +31,14 @@ class NeutronException(Exception):
def __init__(self, **kwargs): def __init__(self, **kwargs):
try: try:
super(NeutronException, self).__init__(self.message % kwargs) super(TackerException, self).__init__(self.message % kwargs)
self.msg = self.message % kwargs self.msg = self.message % kwargs
except Exception: except Exception:
with excutils.save_and_reraise_exception() as ctxt: with excutils.save_and_reraise_exception() as ctxt:
if not self.use_fatal_exceptions(): if not self.use_fatal_exceptions():
ctxt.reraise = False ctxt.reraise = False
# at least get the core message out if something happened # at least get the core message out if something happened
super(NeutronException, self).__init__(self.message) super(TackerException, self).__init__(self.message)
def __unicode__(self): def __unicode__(self):
return unicode(self.msg) return unicode(self.msg)
@ -47,23 +47,23 @@ class NeutronException(Exception):
return False return False
class BadRequest(NeutronException): class BadRequest(TackerException):
message = _('Bad %(resource)s request: %(msg)s') message = _('Bad %(resource)s request: %(msg)s')
class NotFound(NeutronException): class NotFound(TackerException):
pass pass
class Conflict(NeutronException): class Conflict(TackerException):
pass pass
class NotAuthorized(NeutronException): class NotAuthorized(TackerException):
message = _("Not authorized.") message = _("Not authorized.")
class ServiceUnavailable(NeutronException): class ServiceUnavailable(TackerException):
message = _("The service is unavailable") message = _("The service is unavailable")
@ -96,11 +96,11 @@ class PolicyFileNotFound(NotFound):
message = _("Policy configuration policy.json could not be found") message = _("Policy configuration policy.json could not be found")
class PolicyInitError(NeutronException): class PolicyInitError(TackerException):
message = _("Failed to init policy %(policy)s because %(reason)s") message = _("Failed to init policy %(policy)s because %(reason)s")
class PolicyCheckError(NeutronException): class PolicyCheckError(TackerException):
message = _("Failed to check policy %(policy)s because %(reason)s") message = _("Failed to check policy %(policy)s because %(reason)s")
@ -108,7 +108,7 @@ class StateInvalid(BadRequest):
message = _("Unsupported port state: %(port_state)s") message = _("Unsupported port state: %(port_state)s")
class InUse(NeutronException): class InUse(TackerException):
message = _("The resource is inuse") message = _("The resource is inuse")
@ -188,7 +188,7 @@ class MalformedRequestBody(BadRequest):
message = _("Malformed request body: %(reason)s") message = _("Malformed request body: %(reason)s")
class Invalid(NeutronException): class Invalid(TackerException):
def __init__(self, message=None): def __init__(self, message=None):
self.message = message self.message = message
super(Invalid, self).__init__() super(Invalid, self).__init__()
@ -220,15 +220,15 @@ class IpAddressGenerationFailure(Conflict):
message = _("No more IP addresses available on network %(net_id)s.") message = _("No more IP addresses available on network %(net_id)s.")
class BridgeDoesNotExist(NeutronException): class BridgeDoesNotExist(TackerException):
message = _("Bridge %(bridge)s does not exist.") message = _("Bridge %(bridge)s does not exist.")
class PreexistingDeviceFailure(NeutronException): class PreexistingDeviceFailure(TackerException):
message = _("Creation failed. %(dev_name)s already exists.") message = _("Creation failed. %(dev_name)s already exists.")
class SudoRequired(NeutronException): class SudoRequired(TackerException):
message = _("Sudo privilege is required to run this command.") message = _("Sudo privilege is required to run this command.")
@ -262,7 +262,7 @@ class ExtensionsNotFound(NotFound):
message = _("Extensions not found: %(extensions)s") message = _("Extensions not found: %(extensions)s")
class InvalidContentType(NeutronException): class InvalidContentType(TackerException):
message = _("Invalid content type %(content_type)s") message = _("Invalid content type %(content_type)s")
@ -271,11 +271,11 @@ class ExternalIpAddressExhausted(BadRequest):
"network %(net_id)s.") "network %(net_id)s.")
class TooManyExternalNetworks(NeutronException): class TooManyExternalNetworks(TackerException):
message = _("More than one external network exists") message = _("More than one external network exists")
class InvalidConfigurationOption(NeutronException): class InvalidConfigurationOption(TackerException):
message = _("An invalid value was provided for %(opt_name)s: " message = _("An invalid value was provided for %(opt_name)s: "
"%(opt_value)s") "%(opt_value)s")
@ -290,7 +290,7 @@ class GatewayIpInUse(InUse):
"by port %(port_id)s. Unable to update.") "by port %(port_id)s. Unable to update.")
class NetworkVlanRangeError(NeutronException): class NetworkVlanRangeError(TackerException):
message = _("Invalid network VLAN range: '%(vlan_range)s' - '%(error)s'") message = _("Invalid network VLAN range: '%(vlan_range)s' - '%(error)s'")
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -300,15 +300,15 @@ class NetworkVlanRangeError(NeutronException):
super(NetworkVlanRangeError, self).__init__(**kwargs) super(NetworkVlanRangeError, self).__init__(**kwargs)
class NetworkVxlanPortRangeError(NeutronException): class NetworkVxlanPortRangeError(TackerException):
message = _("Invalid network VXLAN port range: '%(vxlan_range)s'") message = _("Invalid network VXLAN port range: '%(vxlan_range)s'")
class VxlanNetworkUnsupported(NeutronException): class VxlanNetworkUnsupported(TackerException):
message = _("VXLAN Network unsupported.") message = _("VXLAN Network unsupported.")
class DuplicatedExtension(NeutronException): class DuplicatedExtension(TackerException):
message = _("Found duplicate extension: %(alias)s") message = _("Found duplicate extension: %(alias)s")

View File

@ -16,7 +16,7 @@
"""Log helper functions.""" """Log helper functions."""
from neutron.openstack.common import log as logging from tacker.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -19,9 +19,9 @@ from oslo.config import cfg
from oslo import messaging from oslo import messaging
from oslo.messaging import serializer as om_serializer from oslo.messaging import serializer as om_serializer
from neutron.common import exceptions from tacker.common import exceptions
from neutron import context from tacker import context
from neutron.openstack.common import log as logging from tacker.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -37,14 +37,14 @@ EXTRA_EXMODS = []
TRANSPORT_ALIASES = { TRANSPORT_ALIASES = {
'neutron.openstack.common.rpc.impl_fake': 'fake', 'tacker.openstack.common.rpc.impl_fake': 'fake',
'neutron.openstack.common.rpc.impl_qpid': 'qpid', 'tacker.openstack.common.rpc.impl_qpid': 'qpid',
'neutron.openstack.common.rpc.impl_kombu': 'rabbit', 'tacker.openstack.common.rpc.impl_kombu': 'rabbit',
'neutron.openstack.common.rpc.impl_zmq': 'zmq', 'tacker.openstack.common.rpc.impl_zmq': 'zmq',
'neutron.rpc.impl_fake': 'fake', 'tacker.rpc.impl_fake': 'fake',
'neutron.rpc.impl_qpid': 'qpid', 'tacker.rpc.impl_qpid': 'qpid',
'neutron.rpc.impl_kombu': 'rabbit', 'tacker.rpc.impl_kombu': 'rabbit',
'neutron.rpc.impl_zmq': 'zmq', 'tacker.rpc.impl_zmq': 'zmq',
} }
@ -105,7 +105,7 @@ def get_notifier(service=None, host=None, publisher_id=None):
class PluginRpcSerializer(om_serializer.Serializer): class PluginRpcSerializer(om_serializer.Serializer):
"""This serializer is used to convert RPC common context into """This serializer is used to convert RPC common context into
Neutron Context. Tacker Context.
""" """
def __init__(self, base): def __init__(self, base):
super(PluginRpcSerializer, self).__init__() super(PluginRpcSerializer, self).__init__()

View File

@ -16,9 +16,9 @@
from oslo.config import cfg from oslo.config import cfg
from oslo import messaging from oslo import messaging
from neutron.common import rpc as n_rpc from tacker.common import rpc as n_rpc
from neutron.openstack.common import log as logging from tacker.openstack.common import log as logging
from neutron.openstack.common import service from tacker.openstack.common import service
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -40,5 +40,5 @@
# describes parameters used by different unit/functional tests # describes parameters used by different unit/functional tests
# a plugin-specific testing mechanism should import this dictionary # a plugin-specific testing mechanism should import this dictionary
# and override the values in it if needed (e.g., run_tests.py in # and override the values in it if needed (e.g., run_tests.py in
# neutron/plugins/openvswitch/ ) # tacker/plugins/openvswitch/ )
test_config = {} test_config = {}

View File

@ -30,11 +30,14 @@ DHCP = 'q-dhcp-notifer'
FIREWALL_PLUGIN = 'q-firewall-plugin' FIREWALL_PLUGIN = 'q-firewall-plugin'
METERING_PLUGIN = 'q-metering-plugin' METERING_PLUGIN = 'q-metering-plugin'
LOADBALANCER_PLUGIN = 'n-lbaas-plugin' LOADBALANCER_PLUGIN = 'n-lbaas-plugin'
SERVICEVM_PLUGIN = 'q-servicevm-plugin'
L3_AGENT = 'l3_agent' L3_AGENT = 'l3_agent'
DHCP_AGENT = 'dhcp_agent' DHCP_AGENT = 'dhcp_agent'
METERING_AGENT = 'metering_agent' METERING_AGENT = 'metering_agent'
LOADBALANCER_AGENT = 'n-lbaas_agent' LOADBALANCER_AGENT = 'n-lbaas_agent'
SERVICEVM_AGENT = 'servicevm-agent'
SERVICEVM_AGENT_NAMEPSACE = 'servicevm-agent-namespace'
def get_topic_name(prefix, table, operation, host=None): def get_topic_name(prefix, table, operation, host=None):

View File

@ -32,14 +32,14 @@ import uuid
from eventlet.green import subprocess from eventlet.green import subprocess
from oslo.config import cfg from oslo.config import cfg
from neutron.common import constants as q_const from tacker.common import constants as q_const
from neutron.openstack.common import lockutils from tacker.openstack.common import lockutils
from neutron.openstack.common import log as logging from tacker.openstack.common import log as logging
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
SYNCHRONIZED_PREFIX = 'neutron-' SYNCHRONIZED_PREFIX = 'tacker-'
synchronized = lockutils.synchronized_with_prefix(SYNCHRONIZED_PREFIX) synchronized = lockutils.synchronized_with_prefix(SYNCHRONIZED_PREFIX)
@ -140,21 +140,21 @@ def find_config_file(options, config_file):
root = os.path.join(dir_to_common, '..', '..', '..', '..') root = os.path.join(dir_to_common, '..', '..', '..', '..')
# Handle standard directory search for the config file # Handle standard directory search for the config file
config_file_dirs = [fix_path(os.path.join(os.getcwd(), 'etc')), config_file_dirs = [fix_path(os.path.join(os.getcwd(), 'etc')),
fix_path(os.path.join('~', '.neutron-venv', 'etc', fix_path(os.path.join('~', '.tacker-venv', 'etc',
'neutron')), 'tacker')),
fix_path('~'), fix_path('~'),
os.path.join(cfg.CONF.state_path, 'etc'), os.path.join(cfg.CONF.state_path, 'etc'),
os.path.join(cfg.CONF.state_path, 'etc', 'neutron'), os.path.join(cfg.CONF.state_path, 'etc', 'tacker'),
fix_path(os.path.join('~', '.local', fix_path(os.path.join('~', '.local',
'etc', 'neutron')), 'etc', 'tacker')),
'/usr/etc/neutron', '/usr/etc/tacker',
'/usr/local/etc/neutron', '/usr/local/etc/tacker',
'/etc/neutron/', '/etc/tacker/',
'/etc'] '/etc']
if 'plugin' in options: if 'plugin' in options:
config_file_dirs = [ config_file_dirs = [
os.path.join(x, 'neutron', 'plugins', options['plugin']) os.path.join(x, 'tacker', 'plugins', options['plugin'])
for x in config_file_dirs for x in config_file_dirs
] ]