NSX|V3: Fix FW(v2) status when deleting an illegal port

When adding an illegal port to the FW, the status of the fw will be
set to ERROR.
When deleting it, the status should be back to normal. For that to happen
the driver cannot ignore this port, but need to return it as a dummy one.

Change-Id: Ieecdc2a37f92276b5a7c0257c1ef46e772b57a49
This commit is contained in:
Adit Sarfaty
2018-10-28 11:03:25 +02:00
parent be03a1e710
commit 730990881a
2 changed files with 12 additions and 5 deletions

View File

@@ -107,15 +107,19 @@ class NsxFwaasCallbacksV2(firewall_l3_agent_v2.L3WithFWaaS):
LOG.error("NSX-V3 FWaaS V2 plugin does not support %s "
"ports", port['device_owner'])
return
# since this is a deletion of an illegal port, add this port
# with a dummy router so that the FWaaS plugin will notice the
# change and change the FW status.
router_info = 'Dummy'
else:
router_id = port['device_id']
router = self.core_plugin.get_router(context, router_id)
router_info = self._router_dict_to_obj(router)
if router_info:
if router_info in in_ns_ports:
in_ns_ports[router_info].append(port_id)
else:
in_ns_ports[router_info] = [port_id]
if router_info:
if router_info in in_ns_ports:
in_ns_ports[router_info].append(port_id)
else:
in_ns_ports[router_info] = [port_id]
return list(in_ns_ports.items())
def delete_firewall_group(self, context, firewall_group, host):

View File

@@ -73,6 +73,9 @@ class EdgeFwaasV3DriverV2(base_driver.CommonEdgeFwaasV3Driver):
routers = set()
# the apply_list is a list of tuples: routerInfo, port-id
for router_info, port_id in apply_list:
# Skip dummy entries that were added only to avoid errors
if isinstance(router_info, str):
continue
# Skip unsupported routers
if not self.should_apply_firewall_to_router(router_info.router):
continue