summaryrefslogtreecommitdiff
path: root/neutron/db/securitygroups_db.py
diff options
context:
space:
mode:
authorKevin Benton <kevin@benton.pub>2016-03-24 22:14:58 -0700
committerKevin Benton <kevin@benton.pub>2016-07-27 12:01:55 -0700
commit4e8cc683496b1d8ebd727106390ba3ce660796f8 (patch)
treeead05c728e1be8b982dca9c9e418ee7dfd814bfa /neutron/db/securitygroups_db.py
parentf3cde0c31bfce0207fd94e31d7c70a88884c33a7 (diff)
downloadneutron-4e8cc683496b1d8ebd727106390ba3ce660796f8.tar.gz
Increment revision numbers on object changes
This adds the logic to increment the revision numbers for objects whenever there are changes and it exposes the revision number via a field in the API. This is handled with a new default service plugin that subscribes to DB events and bumps revision numbers for any objects that were modified. It also handles the logic for bumping the revision number of a parent in a relationship where the children aren't top-level neutron objects that would be tracked individually. This is accomplished with a 'revises_on_change' attribute on the child models that the service plugin will use to find the parent and bump its revision. API tests are included to test the revision numbers added to each standard attribute enabled object. Partially-Implements: bp/push-notifications Change-Id: I476d3e03c8ee763cc4be6d679fe9f501eb3a19b5
Diffstat (limited to 'neutron/db/securitygroups_db.py')
-rw-r--r--neutron/db/securitygroups_db.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/neutron/db/securitygroups_db.py b/neutron/db/securitygroups_db.py
index 53703e89d0..1abb655b4a 100644
--- a/neutron/db/securitygroups_db.py
+++ b/neutron/db/securitygroups_db.py
@@ -73,7 +73,7 @@ class SecurityGroupPortBinding(model_base.BASEV2):
security_group_id = sa.Column(sa.String(36),
sa.ForeignKey("securitygroups.id"),
primary_key=True)
-
+ revises_on_change = ('ports', )
# Add a relationship to the Port model in order to instruct SQLAlchemy to
# eagerly load security group bindings
ports = orm.relationship(
@@ -95,7 +95,7 @@ class SecurityGroupRule(model_base.HasStandardAttributes, model_base.BASEV2,
sa.ForeignKey("securitygroups.id",
ondelete="CASCADE"),
nullable=True)
-
+ revises_on_change = ('security_group', )
direction = sa.Column(sa.Enum('ingress', 'egress',
name='securitygrouprules_direction'))
ethertype = sa.Column(sa.String(40))