From f3c1853c395fd6b98e6d8cb9040f835010a6b625 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Thu, 18 Mar 2021 10:56:23 +0200 Subject: [PATCH] V2T migration: Update FWaaS group status from driver When the migration takes place, the rpc queues are not working so the group's status should be updated in the DB directly Change-Id: I7a1afe751f329eabb055dccb7d5367c47de12426 --- .../fwaas/nsx_v3/edge_fwaas_driver_base.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vmware_nsx/services/fwaas/nsx_v3/edge_fwaas_driver_base.py b/vmware_nsx/services/fwaas/nsx_v3/edge_fwaas_driver_base.py index e7e52083f1..561309d50b 100644 --- a/vmware_nsx/services/fwaas/nsx_v3/edge_fwaas_driver_base.py +++ b/vmware_nsx/services/fwaas/nsx_v3/edge_fwaas_driver_base.py @@ -13,12 +13,21 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron_lib import constants as nl_constants from neutron_lib import context as n_context from neutron_lib.exceptions import firewall_v2 as exceptions +from oslo_config import cfg from oslo_log import log as logging from vmware_nsx.services.fwaas.common import fwaas_driver_base +try: + from neutron_fwaas.db.firewall.v2 import firewall_db_v2 +except ImportError: + # FWaaS project no found + from vmware_nsx.services.fwaas.common import fwaas_mocks \ + as firewall_db_v2 + LOG = logging.getLogger(__name__) @@ -61,6 +70,14 @@ class CommonEdgeFwaasV3Driver(fwaas_driver_base.EdgeFwaasDriverBaseV2): "%s", router_id, e) raise self.driver_exception(driver=self.driver_name) + if cfg.CONF.api_replay_mode and len(routers) > 0: + # In api replay mode the RPC isn't working so the FW group status + # should be updated directly + with context.session.begin(subtransactions=True): + group = (context.session.query(firewall_db_v2.FirewallGroup). + filter_by(id=fwg_id).one()) + group['status'] = nl_constants.ACTIVE + def should_apply_firewall_to_router(self, router_data): """Return True if the firewall rules should be added the router""" if not router_data.get('external_gateway_info'):