Use new DB context when checking if agent is online during rescheduling
Commit 9ec466cd42
was not enough
since it checked l3 agents in the same transaction that was used
to fetch down bindings - so agents always were down even if actually
they went back online.
This commit adds context creation on each iteration to make sure
we use new transaction and fetch up-to-date info for the agent.
Closes-Bug: #1522436
Change-Id: I12a4e4f4e0c2042f0c0bf7eead42baca7b87a22b
This commit is contained in:
parent
ae8f046671
commit
70068992e3
|
@ -116,6 +116,10 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
|
|||
if binding.l3_agent_id in agents_back_online:
|
||||
continue
|
||||
else:
|
||||
# we need new context to make sure we use different DB
|
||||
# transaction - otherwise we may fetch same agent record
|
||||
# each time due to REPEATABLE_READ isolation level
|
||||
context = n_ctx.get_admin_context()
|
||||
agent = self._get_agent(context, binding.l3_agent_id)
|
||||
if agent.is_active:
|
||||
agents_back_online.add(binding.l3_agent_id)
|
||||
|
|
Loading…
Reference in New Issue