Merge "dhcp: fix auto_scheduler_network understanding dhcp_agents_per_network"

This commit is contained in:
Zuul 2024-04-23 21:02:27 +00:00 committed by Gerrit Code Review
commit a02b46b5b7
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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)