' by L3 agent %(agent_id)s',
{'router_id': sync_router['id'],
'agent_id': l3_agents[0]['id']})
- return
+ return []
active_l3_agents = plugin.get_l3_agents(context, active=True)
if not active_l3_agents:
LOG.warn(_LW('No active L3 agents'))
- return
+ return []
new_l3agents = plugin.get_l3_agent_candidates(context,
sync_router,
active_l3_agents)
def test__bind_routers_ha_no_binding(self):
self._test__bind_routers_ha(has_binding=False)
+ def test__get_candidates_iterable_on_early_returns(self):
+ plugin = mock.MagicMock()
+ # non-distributed router already hosted
+ plugin.get_l3_agents_hosting_routers.return_value = [{'id': 'a1'}]
+ router = {'distributed': False, 'id': 'falafel'}
+ iter(self.scheduler._get_candidates(plugin, mock.MagicMock(), router))
+ # distributed router but no agents
+ router['distributed'] = True
+ plugin.get_l3_agents.return_value = []
+ iter(self.scheduler._get_candidates(plugin, mock.MagicMock(), router))
+
class L3SchedulerBaseMixin(object):