Merge "Register agent schedulers options in one place"
This commit is contained in:
commit
1baeeebcd5
@ -15,6 +15,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo.config import cfg
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
@ -31,6 +32,25 @@ from neutron.openstack.common import log as logging
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
AGENTS_SCHEDULER_OPTS = [
|
||||||
|
cfg.StrOpt('network_scheduler_driver',
|
||||||
|
default='neutron.scheduler.'
|
||||||
|
'dhcp_agent_scheduler.ChanceScheduler',
|
||||||
|
help=_('Driver to use for scheduling network to DHCP agent')),
|
||||||
|
cfg.StrOpt('router_scheduler_driver',
|
||||||
|
default='neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
|
||||||
|
help=_('Driver to use for scheduling '
|
||||||
|
'router to a default L3 agent')),
|
||||||
|
cfg.BoolOpt('network_auto_schedule', default=True,
|
||||||
|
help=_('Allow auto scheduling networks to DHCP agent.')),
|
||||||
|
cfg.BoolOpt('router_auto_schedule', default=True,
|
||||||
|
help=_('Allow auto scheduling routers to L3 agent.')),
|
||||||
|
cfg.IntOpt('dhcp_agents_per_network', default=1,
|
||||||
|
help=_('Number of DHCP agents scheduled to host a network.')),
|
||||||
|
]
|
||||||
|
|
||||||
|
cfg.CONF.register_opts(AGENTS_SCHEDULER_OPTS)
|
||||||
|
|
||||||
|
|
||||||
class NetworkDhcpAgentBinding(model_base.BASEV2):
|
class NetworkDhcpAgentBinding(model_base.BASEV2):
|
||||||
"""Represents binding between neutron networks and DHCP agents."""
|
"""Represents binding between neutron networks and DHCP agents."""
|
||||||
|
@ -50,7 +50,6 @@ from neutron.openstack.common import rpc
|
|||||||
from neutron.openstack.common.rpc import proxy
|
from neutron.openstack.common.rpc import proxy
|
||||||
from neutron.plugins.brocade.db import models as brocade_db
|
from neutron.plugins.brocade.db import models as brocade_db
|
||||||
from neutron.plugins.brocade import vlanbm as vbm
|
from neutron.plugins.brocade import vlanbm as vbm
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -69,7 +68,6 @@ PHYSICAL_INTERFACE_OPTS = [cfg.StrOpt('physical_interface', default='eth0')
|
|||||||
|
|
||||||
cfg.CONF.register_opts(SWITCH_OPTS, "SWITCH")
|
cfg.CONF.register_opts(SWITCH_OPTS, "SWITCH")
|
||||||
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
|
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
|
|
||||||
|
|
||||||
class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
DEFAULT_VLAN_RANGES = []
|
DEFAULT_VLAN_RANGES = []
|
||||||
DEFAULT_INTERFACE_MAPPINGS = []
|
DEFAULT_INTERFACE_MAPPINGS = []
|
||||||
@ -55,6 +54,5 @@ agent_opts = [
|
|||||||
cfg.CONF.register_opts(vlan_opts, "VLANS")
|
cfg.CONF.register_opts(vlan_opts, "VLANS")
|
||||||
cfg.CONF.register_opts(bridge_opts, "LINUX_BRIDGE")
|
cfg.CONF.register_opts(bridge_opts, "LINUX_BRIDGE")
|
||||||
cfg.CONF.register_opts(agent_opts, "AGENT")
|
cfg.CONF.register_opts(agent_opts, "AGENT")
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
config.register_agent_state_opts_helper(cfg.CONF)
|
config.register_agent_state_opts_helper(cfg.CONF)
|
||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
|
|
||||||
ml2_opts = [
|
ml2_opts = [
|
||||||
cfg.ListOpt('type_drivers',
|
cfg.ListOpt('type_drivers',
|
||||||
@ -36,4 +34,3 @@ ml2_opts = [
|
|||||||
|
|
||||||
|
|
||||||
cfg.CONF.register_opts(ml2_opts, "ml2")
|
cfg.CONF.register_opts(ml2_opts, "ml2")
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
|
@ -19,7 +19,6 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.openstack.common import rpc # noqa
|
from neutron.openstack.common import rpc # noqa
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
|
|
||||||
ovs_opts = [
|
ovs_opts = [
|
||||||
@ -56,7 +55,6 @@ cfg.CONF.register_opts(agent_opts, "AGENT")
|
|||||||
cfg.CONF.register_opts(ofc_opts, "OFC")
|
cfg.CONF.register_opts(ofc_opts, "OFC")
|
||||||
config.register_agent_state_opts_helper(cfg.CONF)
|
config.register_agent_state_opts_helper(cfg.CONF)
|
||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
|
|
||||||
# shortcuts
|
# shortcuts
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
nvp_opts = [
|
nvp_opts = [
|
||||||
cfg.IntOpt('max_lp_per_bridged_ls', default=64,
|
cfg.IntOpt('max_lp_per_bridged_ls', default=64,
|
||||||
help=_("Maximum number of ports of a logical switch on a "
|
help=_("Maximum number of ports of a logical switch on a "
|
||||||
@ -97,7 +95,6 @@ cluster_opts = [
|
|||||||
cfg.CONF.register_opts(connection_opts)
|
cfg.CONF.register_opts(connection_opts)
|
||||||
cfg.CONF.register_opts(cluster_opts)
|
cfg.CONF.register_opts(cluster_opts)
|
||||||
cfg.CONF.register_opts(nvp_opts, "NVP")
|
cfg.CONF.register_opts(nvp_opts, "NVP")
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
# NOTE(armando-migliaccio): keep the following code until we support
|
# NOTE(armando-migliaccio): keep the following code until we support
|
||||||
# NVP configuration files in older format (Grizzly or older).
|
# NVP configuration files in older format (Grizzly or older).
|
||||||
# ### BEGIN
|
# ### BEGIN
|
||||||
|
@ -18,7 +18,6 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.plugins.openvswitch.common import constants
|
from neutron.plugins.openvswitch.common import constants
|
||||||
from neutron import scheduler
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_BRIDGE_MAPPINGS = []
|
DEFAULT_BRIDGE_MAPPINGS = []
|
||||||
@ -75,4 +74,3 @@ cfg.CONF.register_opts(ovs_opts, "OVS")
|
|||||||
cfg.CONF.register_opts(agent_opts, "AGENT")
|
cfg.CONF.register_opts(agent_opts, "AGENT")
|
||||||
config.register_agent_state_opts_helper(cfg.CONF)
|
config.register_agent_state_opts_helper(cfg.CONF)
|
||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS)
|
|
||||||
|
@ -14,23 +14,3 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
|
|
||||||
AGENTS_SCHEDULER_OPTS = [
|
|
||||||
cfg.StrOpt('network_scheduler_driver',
|
|
||||||
default='neutron.scheduler.'
|
|
||||||
'dhcp_agent_scheduler.ChanceScheduler',
|
|
||||||
help=_('Driver to use for scheduling network to DHCP agent')),
|
|
||||||
cfg.StrOpt('router_scheduler_driver',
|
|
||||||
default='neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
|
|
||||||
help=_('Driver to use for scheduling '
|
|
||||||
'router to a default L3 agent')),
|
|
||||||
cfg.BoolOpt('network_auto_schedule', default=True,
|
|
||||||
help=_('Allow auto scheduling networks to DHCP agent.')),
|
|
||||||
cfg.BoolOpt('router_auto_schedule', default=True,
|
|
||||||
help=_('Allow auto scheduling routers to L3 agent.')),
|
|
||||||
cfg.IntOpt('dhcp_agents_per_network', default=1,
|
|
||||||
help=_('Number of DHCP agents scheduled to host a network.')),
|
|
||||||
]
|
|
||||||
|
@ -106,6 +106,9 @@ class NeutronManagerTestCase(base.BaseTestCase):
|
|||||||
self.assertIn(constants.DUMMY, svc_plugins.keys())
|
self.assertIn(constants.DUMMY, svc_plugins.keys())
|
||||||
|
|
||||||
def test_post_plugin_validation(self):
|
def test_post_plugin_validation(self):
|
||||||
|
cfg.CONF.import_opt('dhcp_agents_per_network',
|
||||||
|
'neutron.db.agentschedulers_db')
|
||||||
|
|
||||||
self.assertIsNone(validate_post_plugin_load())
|
self.assertIsNone(validate_post_plugin_load())
|
||||||
cfg.CONF.set_override('dhcp_agents_per_network', 2)
|
cfg.CONF.set_override('dhcp_agents_per_network', 2)
|
||||||
self.assertIsNone(validate_post_plugin_load())
|
self.assertIsNone(validate_post_plugin_load())
|
||||||
|
Loading…
Reference in New Issue
Block a user