diff --git a/neutron/db/agentschedulers_db.py b/neutron/db/agentschedulers_db.py index 964b1d20a..5eaa7a296 100644 --- a/neutron/db/agentschedulers_db.py +++ b/neutron/db/agentschedulers_db.py @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.config import cfg import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -31,6 +32,25 @@ from neutron.openstack.common import log as logging 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): """Represents binding between neutron networks and DHCP agents.""" diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 137fb979e..f90f98653 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -50,7 +50,6 @@ from neutron.openstack.common import rpc from neutron.openstack.common.rpc import proxy from neutron.plugins.brocade.db import models as brocade_db from neutron.plugins.brocade import vlanbm as vbm -from neutron import scheduler 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(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE") -cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin, diff --git a/neutron/plugins/linuxbridge/common/config.py b/neutron/plugins/linuxbridge/common/config.py index dc35f7650..6a12f037e 100644 --- a/neutron/plugins/linuxbridge/common/config.py +++ b/neutron/plugins/linuxbridge/common/config.py @@ -20,7 +20,6 @@ from oslo.config import cfg from neutron.agent.common import config -from neutron import scheduler DEFAULT_VLAN_RANGES = [] DEFAULT_INTERFACE_MAPPINGS = [] @@ -55,6 +54,5 @@ agent_opts = [ cfg.CONF.register_opts(vlan_opts, "VLANS") cfg.CONF.register_opts(bridge_opts, "LINUX_BRIDGE") 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_root_helper(cfg.CONF) diff --git a/neutron/plugins/ml2/config.py b/neutron/plugins/ml2/config.py index 867fd8fcf..90033e3d4 100644 --- a/neutron/plugins/ml2/config.py +++ b/neutron/plugins/ml2/config.py @@ -15,8 +15,6 @@ from oslo.config import cfg -from neutron import scheduler - ml2_opts = [ cfg.ListOpt('type_drivers', @@ -36,4 +34,3 @@ ml2_opts = [ cfg.CONF.register_opts(ml2_opts, "ml2") -cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) diff --git a/neutron/plugins/nec/common/config.py b/neutron/plugins/nec/common/config.py index fb5ad2b8c..669887f59 100644 --- a/neutron/plugins/nec/common/config.py +++ b/neutron/plugins/nec/common/config.py @@ -19,7 +19,6 @@ from oslo.config import cfg from neutron.agent.common import config from neutron.openstack.common import rpc # noqa -from neutron import scheduler ovs_opts = [ @@ -56,7 +55,6 @@ cfg.CONF.register_opts(agent_opts, "AGENT") cfg.CONF.register_opts(ofc_opts, "OFC") config.register_agent_state_opts_helper(cfg.CONF) config.register_root_helper(cfg.CONF) -cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) # shortcuts CONF = cfg.CONF diff --git a/neutron/plugins/nicira/common/config.py b/neutron/plugins/nicira/common/config.py index 17017f74a..6d2d74f3b 100644 --- a/neutron/plugins/nicira/common/config.py +++ b/neutron/plugins/nicira/common/config.py @@ -16,8 +16,6 @@ from oslo.config import cfg -from neutron import scheduler - nvp_opts = [ cfg.IntOpt('max_lp_per_bridged_ls', default=64, 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(cluster_opts) 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 # NVP configuration files in older format (Grizzly or older). # ### BEGIN diff --git a/neutron/plugins/openvswitch/common/config.py b/neutron/plugins/openvswitch/common/config.py index 90578aeb3..f4bd2c2e9 100644 --- a/neutron/plugins/openvswitch/common/config.py +++ b/neutron/plugins/openvswitch/common/config.py @@ -18,7 +18,6 @@ from oslo.config import cfg from neutron.agent.common import config from neutron.plugins.openvswitch.common import constants -from neutron import scheduler DEFAULT_BRIDGE_MAPPINGS = [] @@ -71,4 +70,3 @@ cfg.CONF.register_opts(ovs_opts, "OVS") cfg.CONF.register_opts(agent_opts, "AGENT") config.register_agent_state_opts_helper(cfg.CONF) config.register_root_helper(cfg.CONF) -cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) diff --git a/neutron/scheduler/__init__.py b/neutron/scheduler/__init__.py index b2660c90f..7506a2914 100644 --- a/neutron/scheduler/__init__.py +++ b/neutron/scheduler/__init__.py @@ -14,23 +14,3 @@ # 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 - - -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.')), -] diff --git a/neutron/tests/unit/test_neutron_manager.py b/neutron/tests/unit/test_neutron_manager.py index c4b91f662..16033e3ca 100644 --- a/neutron/tests/unit/test_neutron_manager.py +++ b/neutron/tests/unit/test_neutron_manager.py @@ -106,6 +106,9 @@ class NeutronManagerTestCase(base.BaseTestCase): self.assertIn(constants.DUMMY, svc_plugins.keys()) def test_post_plugin_validation(self): + cfg.CONF.import_opt('dhcp_agents_per_network', + 'neutron.db.agentschedulers_db') + self.assertIsNone(validate_post_plugin_load()) cfg.CONF.set_override('dhcp_agents_per_network', 2) self.assertIsNone(validate_post_plugin_load())