Don't count ports with inactive bindings as serviceable dvr ports

In case of live migration, binding of port on src host is first switched
to be INACTIVE and then L3 agent should remove qrouter namespace from
compute node if that was last port connected to this router on host.
Because of bug which didn't check if port which is on host has ACTIVE
or INACTIVE binding, router namespace wasn't cleaned properly.
Now it is cleaned as only ports with ACTIVE binding are count
as serviceable ports on compute node.

Change-Id: I01173ad64a19fc05a888c601b81ec097d579a7cf
Closes-Bug: #1825205
(cherry picked from commit ba600a32a5)
This commit is contained in:
Slawek Kaplonski 2019-04-18 16:34:26 +02:00
parent 39fbdfd9c3
commit d3c757134d
1 changed files with 2 additions and 0 deletions

View File

@ -465,6 +465,8 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin):
query = query.join(Port.fixed_ips)
query = query.filter(
IPAllocation.subnet_id.in_(subnet_ids))
query = query.filter(
ml2_models.PortBinding.status == n_const.ACTIVE)
device_filter = or_(
models_v2.Port.device_owner.startswith(
n_const.DEVICE_OWNER_COMPUTE_PREFIX),