Browse Source

NSX|P: Create/delete tier1 locale-service upon router create/delete

The NSX backend needs each logical router to have a locale-service
entry, which should also be deleted before the router is deleted.

Change-Id: If64c1b67c19906105b07c6facedf5d07ac36176d
changes/30/659230/3
Adit Sarfaty 2 years ago
parent
commit
5b591457c0
  1. 2
      devstack/tools/nsxp_cleanup.py
  2. 4
      vmware_nsx/plugins/nsx_p/plugin.py

2
devstack/tools/nsxp_cleanup.py

@ -174,7 +174,7 @@ class NSXClient(object):
# remove all nat rules from this router before deletion
self.cleanup_tier1_nat_rules(rtr['id'])
try:
self.nsxpolicy.tier1.remove_edge_cluster(rtr['id'])
self.nsxpolicy.tier1.delete_locale_service(rtr['id'])
except exceptions.ManagerError as e:
# Not always exists
pass

4
vmware_nsx/plugins/nsx_p/plugin.py

@ -1643,6 +1643,9 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
router_name, router['id'],
tier0=None,
tags=tags)
# Also create the empty locale-service as it must always exist
self.nsxpolicy.tier1.create_locale_service(router['id'])
#TODO(annak): narrow down the exception
except Exception as ex:
with excutils.save_and_reraise_exception():
@ -1675,6 +1678,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
context, router_id)
try:
self.nsxpolicy.tier1.delete_locale_service(router_id)
self.nsxpolicy.tier1.delete(router_id)
except nsx_lib_exc.ResourceNotFound:
# If the resource was not found on the backend do not worry about

Loading…
Cancel
Save