Merge "NSXv3: Raise the proper exception if nsgroup doesn't exists"
This commit is contained in:
commit
acd51c023b
@ -144,7 +144,7 @@ def add_nsgroup_member(nsgroup_id, target_type, target_id):
|
||||
members = {'members': [member_expr]}
|
||||
try:
|
||||
return _update_nsgroup_with_members(nsgroup_id, members, ADD_MEMBERS)
|
||||
except nsx_exc.StaleRevision:
|
||||
except (nsx_exc.StaleRevision, nsx_exc.ResourceNotFound):
|
||||
raise
|
||||
except nsx_exc.ManagerError:
|
||||
# REVISIT(roeyc): A ManagerError might have been raised for a
|
||||
|
@ -23,8 +23,9 @@ import uuid
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
|
||||
from vmware_nsx._i18n import _, _LW
|
||||
from vmware_nsx._i18n import _, _LW, _LE
|
||||
from vmware_nsx.common import exceptions as nsx_exc
|
||||
from vmware_nsx.common import utils
|
||||
from vmware_nsx.db import nsx_models
|
||||
@ -263,6 +264,9 @@ def update_lport_with_security_groups(context, lport_id, original, updated):
|
||||
firewall.remove_nsgroup_member(
|
||||
nsgroup_id, firewall.LOGICAL_PORT, lport_id)
|
||||
raise nsx_exc.SecurityGroupMaximumCapacityReached(sg_id=sg_id)
|
||||
except nsx_exc.ResourceNotFound:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_LE("NSGroup %s doesn't exists"), nsgroup_id)
|
||||
for sg_id in removed:
|
||||
nsgroup_id, s = get_sg_mappings(context.session, sg_id)
|
||||
firewall.remove_nsgroup_member(
|
||||
|
Loading…
x
Reference in New Issue
Block a user