Dont schedule Network, respecting network_auto_schedule config
Currently, if dhcp mapping from a network is removed, it is reassigned to the network. This is because of the Network Scheduler's schedule function, which considers balancing the networks with the agents, whether enable_dhcp is set on its subnets or not. It does not take into account the network_auto_schedule config option. This is particularly disturbing when considering backends which have their provide their own DHCP. With this patch, if network_auto_schedule is set to False, networks wont be automatically scheduled to DHCP Agents. If DHCP is to be mapped to a network, it can be mapped using the CLI itself. While it may seem that this change is breaking what is already working, but as mentioned earlier, if there are network backends which provide DHCP support themselves, they wont need the automatic mapping, which the term "network_auto_schedule" actually stands for. Closes-Bug: #1647421 Change-Id: If1a6a2a174d0f737415efa2abce518722316a77b
This commit is contained in:
parent
d15ad2e481
commit
139b496ef9
@ -475,7 +475,7 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
|
||||
return {'agents': []}
|
||||
|
||||
def schedule_network(self, context, created_network):
|
||||
if self.network_scheduler:
|
||||
if self.network_scheduler and cfg.CONF.network_auto_schedule:
|
||||
return self.network_scheduler.schedule(
|
||||
self, context, created_network)
|
||||
|
||||
|
@ -1354,6 +1354,35 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
|
||||
self._list_networks_hosted_by_dhcp_agent(invalid_agentid,
|
||||
exc.HTTPNotFound.code)
|
||||
|
||||
def test_network_no_reschedule(self):
|
||||
cfg.CONF.set_override('allow_overlapping_ips', True)
|
||||
cfg.CONF.set_override('network_auto_schedule', False)
|
||||
with self.subnet() as sb1, self.subnet():
|
||||
network1_id = sb1['subnet']['network_id']
|
||||
dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback()
|
||||
self._register_agent_states()
|
||||
hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP,
|
||||
DHCP_HOSTA)
|
||||
hostc_id = self._get_agent_id(constants.AGENT_TYPE_DHCP,
|
||||
DHCP_HOSTC)
|
||||
dhcp_rpc_cb.get_active_networks_info(
|
||||
self.adminContext, host=DHCP_HOSTA)
|
||||
dhcp_rpc_cb.get_active_networks_info(
|
||||
self.adminContext, host=DHCP_HOSTC)
|
||||
networks = self._list_networks_hosted_by_dhcp_agent(hostc_id)
|
||||
num_hostc_nets = len(networks['networks'])
|
||||
networks = self._list_networks_hosted_by_dhcp_agent(hosta_id)
|
||||
num_hosta_nets = len(networks['networks'])
|
||||
self.assertEqual(0, num_hosta_nets)
|
||||
self.assertEqual(0, num_hostc_nets)
|
||||
# After this patch, network which requires DHCP
|
||||
# has to be manually mapped
|
||||
self._add_network_to_dhcp_agent(hosta_id,
|
||||
network1_id)
|
||||
networks = self._list_networks_hosted_by_dhcp_agent(hosta_id)
|
||||
num_hosta_nets = len(networks['networks'])
|
||||
self.assertEqual(1, num_hosta_nets)
|
||||
|
||||
|
||||
class OvsDhcpAgentNotifierTestCase(test_agent.AgentDBTestMixIn,
|
||||
AgentSchedulerTestMixIn,
|
||||
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Neutron currently does not fully respect the network-auto-schedule
|
||||
configuration option. If the network-auto-schedule option is set to
|
||||
False, the network -
|
||||
a) Is still scheduled on the DHCP agent when it is created
|
||||
b) Is scheduled on a new DHCP agent if the old DHCP mapping is removed
|
||||
by the user/admin.
|
||||
It is especially necessary where the Network Backends provide DHCP
|
||||
directly. This has been fixed now and if the network-auto-schedule
|
||||
is set to False in the config file, networks would not be automatically
|
||||
scheduled to the DHCP Agents. If mapping/scheduling is required, it can
|
||||
be done manually or by setting the network-auto-schedule to True.
|
Loading…
Reference in New Issue
Block a user