Skip to content

Commit

Permalink
Merge "Fix quota usage tracker for security group rules"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 24, 2015
2 parents 9e4627f + 851b1b4 commit c89be9a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions neutron/db/securitygroups_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,13 @@ def delete_security_group_rule(self, context, id):
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(
Expand Down

0 comments on commit c89be9a

Please sign in to comment.