Merge "Catch DBReferenceError exception during binding a router"
This commit is contained in:
commit
594b61ae9c
@ -220,6 +220,10 @@ class L3Scheduler(object):
|
|||||||
{'agent_id': chosen_agent.id,
|
{'agent_id': chosen_agent.id,
|
||||||
'router_id': router_id})
|
'router_id': router_id})
|
||||||
return
|
return
|
||||||
|
except db_exc.DBReferenceError:
|
||||||
|
LOG.debug('Router %s has already been removed '
|
||||||
|
'by concurrent operation', router_id)
|
||||||
|
return
|
||||||
|
|
||||||
LOG.debug('Router %(router_id)s is scheduled to L3 agent '
|
LOG.debug('Router %(router_id)s is scheduled to L3 agent '
|
||||||
'%(agent_id)s', {'router_id': router_id,
|
'%(agent_id)s', {'router_id': router_id,
|
||||||
|
@ -482,6 +482,12 @@ class L3SchedulerTestBaseMixin(object):
|
|||||||
args, kwargs = flog.call_args
|
args, kwargs = flog.call_args
|
||||||
self.assertIn('is scheduled', args[0])
|
self.assertIn('is scheduled', args[0])
|
||||||
|
|
||||||
|
def test_bind_absent_router(self):
|
||||||
|
scheduler = l3_agent_scheduler.ChanceScheduler()
|
||||||
|
# checking that bind_router() is not throwing
|
||||||
|
# when supplied with router_id of non-existing router
|
||||||
|
scheduler.bind_router(self.adminContext, "dummyID", self.agent1)
|
||||||
|
|
||||||
def test_bind_existing_router(self):
|
def test_bind_existing_router(self):
|
||||||
router = self._make_router(self.fmt,
|
router = self._make_router(self.fmt,
|
||||||
tenant_id=str(uuid.uuid4()),
|
tenant_id=str(uuid.uuid4()),
|
||||||
|
Loading…
Reference in New Issue
Block a user