Fix dirty DB entries left on deleting vdr with GW

Neutron allows deleting a router with gw set. For distributed router's
gw, we actually nees a plr and a internal virtualwire to support
implementation. When deleting a distributed router, we needs to verify
and clear all these components.

Change-Id: I7088a90acf1635ea0dbc20bbc6835835df24b07e
Fixes-bug: #1505008
This commit is contained in:
linb 2015-08-25 14:48:34 +08:00 committed by garyk
parent cacf38b3d1
commit 58e92df85f
1 changed files with 5 additions and 0 deletions

View File

@ -1390,6 +1390,11 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
def delete_router(self, context, id):
self._check_router_in_use(context, id)
router_driver = self._find_router_driver(context, id)
# Clear vdr's gw relative components if the router has gw info
if router_driver.get_type() == "distributed":
router = self.get_router(context, id)
if router.get(l3.EXTERNAL_GW_INFO):
router_driver._update_router_gw_info(context, id, {})
super(NsxVPluginV2, self).delete_router(context, id)
router_driver.delete_router(context, id)