Browse Source

Catch nsgroup deletion exceptions and log

Commit I475a5c984aed7b6cae26951e64971ec463a43c5e
changed the error handling of this api, so the plugin  will need to handle the errors

Change-Id: I1ba3d0a64793674c97c62f6ff26fa00e34a7c4fe
(cherry picked from commit 4a0b872d77)
changes/58/737758/1
asarfaty 1 month ago
committed by Adit Sarfaty
parent
commit
09bfb99bb2
2 changed files with 22 additions and 4 deletions
  1. +15
    -3
      vmware_nsx/plugins/nsx_v3/plugin.py
  2. +7
    -1
      vmware_nsx/shell/admin/plugins/nsxv3/resources/securitygroups.py

+ 15
- 3
vmware_nsx/plugins/nsx_v3/plugin.py View File

@@ -329,7 +329,12 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
if section_id:
self.nsxlib.firewall_section.delete(section_id)
if ns_group_id:
self.nsxlib.ns_group.delete(ns_group_id)
try:
self.nsxlib.ns_group.delete(ns_group_id)
except Exception:
LOG.debug("While cleaning up duplicate sections NSGroup %s "
"was not found", ns_group_id)

# Ensure global variables are updated
self._ensure_default_rules()

@@ -3044,7 +3049,10 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
context = context.elevated()
super(NsxV3Plugin, self).delete_security_group(
context, secgroup_db['id'])
self.nsxlib.ns_group.delete(ns_group['id'])
try:
self.nsxlib.ns_group.delete(ns_group['id'])
except Exception:
pass
self.nsxlib.firewall_section.delete(firewall_section['id'])

if ex.__class__ is nsx_lib_exc.ResourceNotFound:
@@ -3106,7 +3114,11 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
context.session, id)
super(NsxV3Plugin, self).delete_security_group(context, id)
self.nsxlib.firewall_section.delete(section_id)
self.nsxlib.ns_group.delete(nsgroup_id)
try:
self.nsxlib.ns_group.delete(nsgroup_id)
except Exception:
LOG.debug("While deleting SG %s NSGroup %s was not found",
id, nsgroup_id)

def create_security_group_rule(self, context, security_group_rule):
bulk_rule = {'security_group_rules': [security_group_rule]}


+ 7
- 1
vmware_nsx/shell/admin/plugins/nsxv3/resources/securitygroups.py View File

@@ -220,7 +220,13 @@ def fix_security_groups(resource, event, trigger, **kwargs):
nsxlib.firewall_section.delete(sg['section-id'])
except Exception:
pass
nsxlib.ns_group.delete(sg['nsx-securitygroup-id'])

try:
nsxlib.ns_group.delete(sg['nsx-securitygroup-id'])
except Exception:
LOG.debug("NSGroup %s does not exists for delete request.",
sg['nsx-securitygroup-id'])

neutron_sg.delete_security_group_section_mapping(sg_id)
neutron_sg.delete_security_group_backend_mapping(sg_id)
nsgroup, fw_section = (


Loading…
Cancel
Save