Fix quota usage tracker for security group rules
This simple patch ensures usage for security group rules is marked as dirty when a security group rule is deleted. To this aim, the security group rule is deleted using ORM in order to ensure the sqlalchemy even if fired. Closes-Bug: #1499339 Change-Id: I1e81fe03fed14ec438cea5d7675f66caeb91afd8
This commit is contained in:
parent
b688d8ba44
commit
851b1b4bbb
|
@ -614,8 +614,13 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||
raise ext_sg.SecurityGroupRuleInUse(id=id, reason=reason)
|
||||
|
||||
with context.session.begin(subtransactions=True):
|
||||
query = self._model_query(context, SecurityGroupRule)
|
||||
if query.filter(SecurityGroupRule.id == id).delete() == 0:
|
||||
query = self._model_query(context, SecurityGroupRule).filter(
|
||||
SecurityGroupRule.id == id)
|
||||
try:
|
||||
# As there is a filter on a primary key it is not possible for
|
||||
# MultipleResultsFound to be raised
|
||||
context.session.delete(query.one())
|
||||
except exc.NoResultFound:
|
||||
raise ext_sg.SecurityGroupRuleNotFound(id=id)
|
||||
|
||||
registry.notify(
|
||||
|
|
Loading…
Reference in New Issue