dhcp: fix auto_scheduler_network understanding dhcp_agents_per_network
When using routed provided network, the condition is bypassing dhcp_agents_per_network which results that in a env with 3 agents and dhcp_agents_per_network=2, for a given network already well handled by 2 agents. If restarting the third agent It will start to handle the network also which will result to have 3 agents handling the network. Closes-bug: #2058908 Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> Change-Id: Ia05a879b0ed88172694bd6bffc6f7eb0d36bb6b0
This commit is contained in:
parent
49a25e7c04
commit
1bc945f0d5
|
@ -79,9 +79,10 @@ class AutoScheduler(object):
|
|||
if is_routed_network:
|
||||
if len(segments_on_network & segments_on_host) == 0:
|
||||
continue
|
||||
else:
|
||||
if len(agents) >= agents_per_network:
|
||||
continue
|
||||
# The following two checks apply to both routed and
|
||||
# non-routed networks
|
||||
if len(agents) >= agents_per_network:
|
||||
continue
|
||||
if any(dhcp_agent.id == agent.id for agent in agents):
|
||||
continue
|
||||
net = plugin.get_network(context, net_id)
|
||||
|
|
|
@ -381,6 +381,7 @@ class TestAutoScheduleSegments(test_plugin.Ml2PluginV2TestCase,
|
|||
self.ctx, [net_id])
|
||||
self.assertEqual(1, len(agents))
|
||||
|
||||
cfg.CONF.set_override('dhcp_agents_per_network', 2)
|
||||
seg2_id = self._create_segment(net_id, 'physnet2')
|
||||
self._create_subnet(seg2_id, net_id, '192.168.11.0/24')
|
||||
helpers.register_dhcp_agent(HOST_C)
|
||||
|
|
Loading…
Reference in New Issue