Security group quota error handling
When adding a new rule to a secruity group that would exceede the
quota, the error message displays a quota error, rather than rule
already exists error. It does this my first checking for an
"OverQuotaClient" error, then if that except doesn't trigger it
checks for any other conflict
Change-Id: I8eaa0f00b25c8c3b75fef2bf46979f1f248c6896
Closes-Bug: #1699724
(cherry picked from commit 3929a8b7cd
)
This commit is contained in:
parent
e9e8b8cc3c
commit
97475c085a
|
@ -377,8 +377,12 @@ class SecurityGroupManager(object):
|
|||
'remote_group_id': group_id}}
|
||||
try:
|
||||
rule = self.client.create_security_group_rule(body)
|
||||
except neutron_exc.OverQuotaClient:
|
||||
raise exceptions.Conflict(
|
||||
_('Security group rule quotas exceed.'))
|
||||
except neutron_exc.Conflict:
|
||||
raise exceptions.Conflict(_('Security group rule already exists.'))
|
||||
raise exceptions.Conflict(
|
||||
_('Security group rule already exists.'))
|
||||
rule = rule.get('security_group_rule')
|
||||
sg_dict = self._sg_name_dict(parent_group_id, [rule])
|
||||
return SecurityGroupRule(rule, sg_dict)
|
||||
|
|
Loading…
Reference in New Issue