Throw an exception in case of exceeding quota.
Sometimes we create a lot of security group rules, which might exceed
the quotas. In this patch we propose to distinguish conflict exceptions
for quota exceeding from rule already exists.
@@ -186,6 +186,11 @@ def create_security_group_rule(body):
sgr = os_net.create_security_group_rule(**params)
return sgr.id
except os_exc.ConflictException as ex:
+ if 'quota' in ex.details.lower():
+ LOG.error("Failed to create security group rule %s: %s", body,
+ ex.details)
+ raise
+ else:
LOG.debug("Failed to create already existing security group "
"rule %s", body)
# Get existent sg rule id from exception message
