NSXv: do not fail on spoofgaurd policy error

Commit I2e69466e76b3b7339c6854e5c04f1309ede19f56 added exception
handling for spoofguard delete failures in delete port.
This commit does the same during update port.

Change-Id: Ideb808d68c4739ac48a0680885b10a708a737784
This commit is contained in:
Abhishek Raut 2016-07-08 16:43:39 -07:00
parent b571db235f
commit abb0775c2a
1 changed files with 15 additions and 7 deletions

View File

@ -1481,10 +1481,14 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
context.session, vnic_id, curr_sgids)
if cfg.CONF.nsxv.spoofguard_enabled:
if original_port[psec.PORTSECURITY]:
self._remove_vnic_from_spoofguard_policy(
context.session,
original_port['network_id'],
vnic_id)
try:
self._remove_vnic_from_spoofguard_policy(
context.session,
original_port['network_id'],
vnic_id)
except Exception as e:
LOG.error(_LE('Could not delete the spoofguard '
'policy. Exception %s'), e)
# remove vm from the exclusion list when it is detached
# from the device if it has no port security
if not original_port[psec.PORTSECURITY]:
@ -1508,9 +1512,13 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self._remove_vm_from_exclude_list(context, device_id,
id)
elif cfg.CONF.nsxv.spoofguard_enabled:
self._remove_vnic_from_spoofguard_policy(
context.session, original_port['network_id'],
vnic_id)
try:
self._remove_vnic_from_spoofguard_policy(
context.session, original_port['network_id'],
vnic_id)
except Exception as e:
LOG.error(_LE('Could not delete the spoofguard '
'policy. Exception %s'), e)
# Add vm to the exclusion list, since it has no port
# security now
self._add_vm_to_exclude_list(context, device_id, id)