From d3c757134dfb20d0e5755447918e3fc6b413f7d8 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 18 Apr 2019 16:34:26 +0200 Subject: [PATCH] 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 ba600a32a542ffcb95b84e5e413f1595c25ca7dd) --- neutron/db/l3_dvrscheduler_db.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neutron/db/l3_dvrscheduler_db.py b/neutron/db/l3_dvrscheduler_db.py index 79bfda3aaec..de518a55d75 100644 --- a/neutron/db/l3_dvrscheduler_db.py +++ b/neutron/db/l3_dvrscheduler_db.py @@ -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),