Merge "Refactoring config options for ml2 plugin drivers"

This commit is contained in:
Jenkins 2016-10-04 19:53:52 +00:00 committed by Gerrit Code Review
commit b906aa99b0
7 changed files with 118 additions and 77 deletions

View File

@ -0,0 +1,98 @@
# Copyright (c) 2013 OpenStack Foundation
# 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 neutron._i18n import _
from neutron.plugins.common import constants as p_const
gre_opts = [
cfg.ListOpt('tunnel_id_ranges',
default=[],
help=_("Comma-separated list of <tun_min>:<tun_max> tuples "
"enumerating ranges of GRE tunnel IDs that are "
"available for tenant network allocation"))
]
flat_opts = [
cfg.ListOpt('flat_networks',
default='*',
help=_("List of physical_network names with which flat "
"networks can be created. Use default '*' to allow "
"flat networks with arbitrary physical_network names. "
"Use an empty list to disable flat networks."))
]
geneve_opts = [
cfg.ListOpt('vni_ranges',
default=[],
help=_("Comma-separated list of <vni_min>:<vni_max> tuples "
"enumerating ranges of Geneve VNI IDs that are "
"available for tenant network allocation")),
cfg.IntOpt('max_header_size',
default=p_const.GENEVE_ENCAP_MIN_OVERHEAD,
help=_("Geneve encapsulation header size is dynamic, this "
"value is used to calculate the maximum MTU "
"for the driver. "
"This is the sum of the sizes of the outer "
"ETH + IP + UDP + GENEVE header sizes. "
"The default size for this field is 50, which is the "
"size of the Geneve header without any additional "
"option headers.")),
]
vxlan_opts = [
cfg.ListOpt('vni_ranges',
default=[],
help=_("Comma-separated list of <vni_min>:<vni_max> tuples "
"enumerating ranges of VXLAN VNI IDs that are "
"available for tenant network allocation")),
cfg.StrOpt('vxlan_group',
help=_("Multicast group for VXLAN. When configured, will "
"enable sending all broadcast traffic to this multicast "
"group. When left unconfigured, will disable multicast "
"VXLAN mode.")),
]
vlan_opts = [
cfg.ListOpt('network_vlan_ranges',
default=[],
help=_("List of <physical_network>:<vlan_min>:<vlan_max> or "
"<physical_network> specifying physical_network names "
"usable for VLAN provider and tenant networks, as "
"well as ranges of VLAN tags on each available for "
"allocation to tenant networks."))
]
def register_ml2_drivers_gre_opts(cfg=cfg.CONF):
cfg.register_opts(gre_opts, "ml2_type_gre")
def register_ml2_drivers_flat_opts(cfg=cfg.CONF):
cfg.register_opts(flat_opts, "ml2_type_flat")
def register_ml2_drivers_geneve_opts(cfg=cfg.CONF):
cfg.register_opts(geneve_opts, "ml2_type_geneve")
def register_ml2_drivers_vxlan_opts(cfg=cfg.CONF):
cfg.register_opts(vxlan_opts, "ml2_type_vxlan")
def register_ml2_drivers_vlan_opts(cfg=cfg.CONF):
cfg.register_opts(vlan_opts, "ml2_type_vlan")

View File

@ -33,6 +33,7 @@ import neutron.conf.agent.ovs_conf
import neutron.conf.common
import neutron.conf.extensions.allowedaddresspairs
import neutron.conf.plugins.ml2.drivers.agent
import neutron.conf.plugins.ml2.drivers.driver_type
import neutron.conf.plugins.ml2.drivers.linuxbridge
import neutron.conf.quota
import neutron.conf.service
@ -55,11 +56,6 @@ import neutron.plugins.ml2.drivers.macvtap.agent.config
import neutron.plugins.ml2.drivers.mech_sriov.agent.common.config
import neutron.plugins.ml2.drivers.mech_sriov.mech_driver.mech_driver
import neutron.plugins.ml2.drivers.openvswitch.agent.common.config
import neutron.plugins.ml2.drivers.type_flat
import neutron.plugins.ml2.drivers.type_geneve
import neutron.plugins.ml2.drivers.type_gre
import neutron.plugins.ml2.drivers.type_vlan
import neutron.plugins.ml2.drivers.type_vxlan
import neutron.wsgi
@ -247,15 +243,15 @@ def list_ml2_conf_opts():
('ml2',
neutron.plugins.ml2.config.ml2_opts),
('ml2_type_flat',
neutron.plugins.ml2.drivers.type_flat.flat_opts),
neutron.conf.plugins.ml2.drivers.driver_type.flat_opts),
('ml2_type_vlan',
neutron.plugins.ml2.drivers.type_vlan.vlan_opts),
neutron.conf.plugins.ml2.drivers.driver_type.vlan_opts),
('ml2_type_gre',
neutron.plugins.ml2.drivers.type_gre.gre_opts),
neutron.conf.plugins.ml2.drivers.driver_type.gre_opts),
('ml2_type_vxlan',
neutron.plugins.ml2.drivers.type_vxlan.vxlan_opts),
neutron.conf.plugins.ml2.drivers.driver_type.vxlan_opts),
('ml2_type_geneve',
neutron.plugins.ml2.drivers.type_geneve.geneve_opts),
neutron.conf.plugins.ml2.drivers.driver_type.geneve_opts),
('securitygroup',
neutron.conf.agent.securitygroups_rpc.security_group_opts)
]

View File

@ -22,6 +22,7 @@ import six
from neutron._i18n import _, _LI, _LW
from neutron.common import _deprecate
from neutron.common import exceptions as n_exc
from neutron.conf.plugins.ml2.drivers import driver_type
from neutron.db.models.plugins.ml2 import flatallocation as type_flat_model
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2 import driver_api as api
@ -29,16 +30,7 @@ from neutron.plugins.ml2.drivers import helpers
LOG = log.getLogger(__name__)
flat_opts = [
cfg.ListOpt('flat_networks',
default='*',
help=_("List of physical_network names with which flat "
"networks can be created. Use default '*' to allow "
"flat networks with arbitrary physical_network names. "
"Use an empty list to disable flat networks."))
]
cfg.CONF.register_opts(flat_opts, "ml2_type_flat")
driver_type.register_ml2_drivers_flat_opts()
_deprecate._moved_global('FlatAllocation', new_module=type_flat_model)

View File

@ -18,8 +18,9 @@ from neutron_lib import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log
from neutron._i18n import _, _LE
from neutron._i18n import _LE
from neutron.common import _deprecate
from neutron.conf.plugins.ml2.drivers import driver_type
from neutron.db.models.plugins.ml2 import geneveallocation \
as geneve_model
from neutron.plugins.common import constants as p_const
@ -30,25 +31,7 @@ LOG = log.getLogger(__name__)
_deprecate._moved_global('GeneveAllocation', new_module=geneve_model)
_deprecate._moved_global('GeneveEndpoints', new_module=geneve_model)
geneve_opts = [
cfg.ListOpt('vni_ranges',
default=[],
help=_("Comma-separated list of <vni_min>:<vni_max> tuples "
"enumerating ranges of Geneve VNI IDs that are "
"available for tenant network allocation")),
cfg.IntOpt('max_header_size',
default=p_const.GENEVE_ENCAP_MIN_OVERHEAD,
help=_("Geneve encapsulation header size is dynamic, this "
"value is used to calculate the maximum MTU "
"for the driver. "
"This is the sum of the sizes of the outer "
"ETH + IP + UDP + GENEVE header sizes. "
"The default size for this field is 50, which is the "
"size of the Geneve header without any additional "
"option headers.")),
]
cfg.CONF.register_opts(geneve_opts, "ml2_type_geneve")
driver_type.register_ml2_drivers_geneve_opts()
class GeneveTypeDriver(type_tunnel.EndpointTunnelTypeDriver):

View File

@ -17,23 +17,16 @@ from neutron_lib import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log
from neutron._i18n import _, _LE
from neutron._i18n import _LE
from neutron.common import _deprecate
from neutron.conf.plugins.ml2.drivers import driver_type
from neutron.db.models.plugins.ml2 import gre_allocation_endpoints as gre_model
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2.drivers import type_tunnel
LOG = log.getLogger(__name__)
gre_opts = [
cfg.ListOpt('tunnel_id_ranges',
default=[],
help=_("Comma-separated list of <tun_min>:<tun_max> tuples "
"enumerating ranges of GRE tunnel IDs that are "
"available for tenant network allocation"))
]
cfg.CONF.register_opts(gre_opts, "ml2_type_gre")
driver_type.register_ml2_drivers_gre_opts()
_deprecate._moved_global('GreAllocation', new_module=gre_model)

View File

@ -22,6 +22,7 @@ from six import moves
from neutron._i18n import _, _LE, _LI, _LW
from neutron.common import _deprecate
from neutron.conf.plugins.ml2.drivers import driver_type
from neutron.db import api as db_api
from neutron.db.models.plugins.ml2 import vlanallocation as vlan_alloc_model
from neutron.plugins.common import constants as p_const
@ -31,20 +32,10 @@ from neutron.plugins.ml2.drivers import helpers
LOG = log.getLogger(__name__)
vlan_opts = [
cfg.ListOpt('network_vlan_ranges',
default=[],
help=_("List of <physical_network>:<vlan_min>:<vlan_max> or "
"<physical_network> specifying physical_network names "
"usable for VLAN provider and tenant networks, as "
"well as ranges of VLAN tags on each available for "
"allocation to tenant networks."))
]
cfg.CONF.register_opts(vlan_opts, "ml2_type_vlan")
_deprecate._moved_global('VlanAllocation', new_module=vlan_alloc_model)
driver_type.register_ml2_drivers_vlan_opts()
class VlanTypeDriver(helpers.SegmentTypeDriver):
"""Manage state for VLAN networks with ML2.

View File

@ -17,8 +17,9 @@ from neutron_lib import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log
from neutron._i18n import _, _LE
from neutron._i18n import _LE
from neutron.common import _deprecate
from neutron.conf.plugins.ml2.drivers import driver_type
from neutron.db.models.plugins.ml2 import vxlanallocation as vxlan_model
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2.drivers import type_tunnel
@ -28,20 +29,7 @@ LOG = log.getLogger(__name__)
_deprecate._moved_global('VxlanAllocation', new_module=vxlan_model)
_deprecate._moved_global('VxlanEndpoints', new_module=vxlan_model)
vxlan_opts = [
cfg.ListOpt('vni_ranges',
default=[],
help=_("Comma-separated list of <vni_min>:<vni_max> tuples "
"enumerating ranges of VXLAN VNI IDs that are "
"available for tenant network allocation")),
cfg.StrOpt('vxlan_group',
help=_("Multicast group for VXLAN. When configured, will "
"enable sending all broadcast traffic to this multicast "
"group. When left unconfigured, will disable multicast "
"VXLAN mode.")),
]
cfg.CONF.register_opts(vxlan_opts, "ml2_type_vxlan")
driver_type.register_ml2_drivers_vxlan_opts()
class VxlanTypeDriver(type_tunnel.EndpointTunnelTypeDriver):