NSX|P: Check for vpn service while updating GW
Change-Id: I567eee28dda1f35586328bb4f186e804a4113085
This commit is contained in:
parent
4b23c136de
commit
41392c8cec
|
@ -1286,7 +1286,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
self,
|
||||
org_tier0_uuid, orgaddr, org_enable_snat,
|
||||
new_tier0_uuid, newaddr, new_enable_snat,
|
||||
lb_exist, fw_exist, sr_currently_exists):
|
||||
tier1_services_exist, sr_currently_exists):
|
||||
"""Return a dictionary of flags indicating which actions should be
|
||||
performed on this router GW update.
|
||||
"""
|
||||
|
@ -1357,22 +1357,22 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
# Should remove the service router if the GW was removed,
|
||||
# or no service needs it: SNAT, LBaaS or FWaaS
|
||||
actions['remove_service_router'] = (
|
||||
not has_gw or not (fw_exist or lb_exist or new_with_snat))
|
||||
not has_gw or not (tier1_services_exist or new_with_snat))
|
||||
if actions['remove_service_router']:
|
||||
LOG.info("Removing service router [has GW: %s, FW %s, LB %s, "
|
||||
LOG.info("Removing service router [has GW: %s, services %s, "
|
||||
"SNAT %s]",
|
||||
has_gw, fw_exist, lb_exist, new_with_snat)
|
||||
has_gw, tier1_services_exist, new_with_snat)
|
||||
else:
|
||||
# currently there is no service router on the backend
|
||||
actions['remove_service_router'] = False
|
||||
# Should add service router if there is a GW
|
||||
# and there is a service that needs it: SNAT, LB or FWaaS
|
||||
actions['add_service_router'] = (
|
||||
has_gw is not None and (new_with_snat or fw_exist or lb_exist))
|
||||
has_gw is not None and (new_with_snat or tier1_services_exist))
|
||||
if actions['add_service_router']:
|
||||
LOG.info("Adding service router [has GW: %s, FW %s, LB %s, "
|
||||
LOG.info("Adding service router [has GW: %s, services %s, "
|
||||
"SNAT %s]",
|
||||
has_gw, fw_exist, lb_exist, new_with_snat)
|
||||
has_gw, tier1_services_exist, new_with_snat)
|
||||
|
||||
return actions
|
||||
|
||||
|
|
|
@ -1558,13 +1558,18 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||
router_subnets = self._find_router_subnets(
|
||||
context.elevated(), router_id)
|
||||
sr_currently_exists = self.verify_sr_at_backend(router_id)
|
||||
lb_exist = self.service_router_has_loadbalancers(context, router_id)
|
||||
fw_exist = self._router_has_edge_fw_rules(context, router)
|
||||
# TODO(asarfaty): Add vpnaas check here
|
||||
vpn_exist = self.service_router_has_vpnaas(context, router_id)
|
||||
lb_exist = False
|
||||
if not (fw_exist or vpn_exist):
|
||||
# This is a backend call, so do it only if must
|
||||
lb_exist = self.service_router_has_loadbalancers(
|
||||
context, router_id)
|
||||
tier1_services_exist = fw_exist or vpn_exist or lb_exist
|
||||
actions = self._get_update_router_gw_actions(
|
||||
org_tier0_uuid, orgaddr, org_enable_snat,
|
||||
new_tier0_uuid, newaddr, new_enable_snat,
|
||||
lb_exist, fw_exist, sr_currently_exists)
|
||||
tier1_services_exist, sr_currently_exists)
|
||||
|
||||
if actions['add_service_router']:
|
||||
self.create_service_router(context, router_id, router=router)
|
||||
|
|
|
@ -2182,12 +2182,13 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
|
|||
lb_exist = nsx_db.has_nsx_lbaas_loadbalancer_binding_by_router(
|
||||
context.session, nsx_router_id)
|
||||
fw_exist = self._router_has_edge_fw_rules(context, router)
|
||||
tier1_services_exist = lb_exist or fw_exist
|
||||
sr_currently_exists = self.verify_sr_at_backend(context, router_id)
|
||||
|
||||
actions = self._get_update_router_gw_actions(
|
||||
org_tier0_uuid, orgaddr, org_enable_snat,
|
||||
new_tier0_uuid, newaddr, new_enable_snat,
|
||||
lb_exist, fw_exist, sr_currently_exists)
|
||||
tier1_services_exist, sr_currently_exists)
|
||||
|
||||
if actions['add_service_router']:
|
||||
self.create_service_router(context, router_id, router=router)
|
||||
|
|
Loading…
Reference in New Issue