

def reschedule_router(self, context, router_id, candidates=None):
    'Reschedule router to (a) new l3 agent(s)\n\n        Remove the router from the agent(s) currently hosting it and\n        schedule it again\n        '
    cur_agents = self.list_l3_agents_hosting_router(context, router_id)['agents']
    with cur_agents.session.begin(subtransactions=True):
        cur_agents_ids = [agent['id'] for agent in cur_agents]
        self._unschedule_router(context, router_id, cur_agents_ids)
        self.schedule_router(context, router_id, candidates=candidates)
        new_agents = self.list_l3_agents_hosting_router(context, router_id)['agents']
        if (not new_agents):
            raise l3agentscheduler.RouterReschedulingFailed(router_id=router_id)
    self._notify_agents_router_rescheduled(context, router_id, cur_agents, new_agents)

dataset/ETHPy150Open openstack/neutron/neutron/db/l3_agentschedulers_db.py L3AgentSchedulerDbMixin.reschedule_router/VarMisuse@35/113 `context`->`cur_agents`