Merge "Throw an exception in case of exceeding quota."
This commit is contained in:
commit
20e35d13bf
|
@ -186,10 +186,15 @@ def create_security_group_rule(body):
|
||||||
sgr = os_net.create_security_group_rule(**params)
|
sgr = os_net.create_security_group_rule(**params)
|
||||||
return sgr.id
|
return sgr.id
|
||||||
except os_exc.ConflictException as ex:
|
except os_exc.ConflictException as ex:
|
||||||
LOG.debug("Failed to create already existing security group "
|
if 'quota' in ex.details.lower():
|
||||||
"rule %s", body)
|
LOG.error("Failed to create security group rule %s: %s", body,
|
||||||
# Get existent sg rule id from exception message
|
ex.details)
|
||||||
return str(ex).split()[-1][:-1]
|
raise
|
||||||
|
else:
|
||||||
|
LOG.debug("Failed to create already existing security group "
|
||||||
|
"rule %s", body)
|
||||||
|
# Get existent sg rule id from exception message
|
||||||
|
return str(ex).split()[-1][:-1]
|
||||||
except os_exc.SDKException:
|
except os_exc.SDKException:
|
||||||
LOG.debug("Error creating security group rule")
|
LOG.debug("Error creating security group rule")
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in New Issue