]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensure allocation pools are deleted from database
authorGary Kotton <gkotton@redhat.com>
Thu, 27 Dec 2012 14:16:46 +0000 (14:16 +0000)
committerGary Kotton <gkotton@redhat.com>
Thu, 27 Dec 2012 14:16:46 +0000 (14:16 +0000)
Fixes bug 1091946

Change-Id: I4330f7a81e4745d5885d58fe7c8a010d18a8e004

quantum/db/models_v2.py

index 557dcc5fc73ab32e28398ca43abb45d1c2483ee3..760355beb3459edc5d56ff7ef418e632a84ff8b1 100644 (file)
@@ -69,7 +69,8 @@ class IPAllocationPool(model_base.BASEV2, HasId):
     last_ip = sa.Column(sa.String(64), nullable=False)
     available_ranges = orm.relationship(IPAvailabilityRange,
                                         backref='ipallocationpool',
-                                        lazy="dynamic")
+                                        lazy="dynamic",
+                                        cascade='delete')
 
     def __repr__(self):
         return "%s - %s" % (self.first_ip, self.last_ip)
@@ -136,7 +137,8 @@ class Subnet(model_base.BASEV2, HasId, HasTenant):
     gateway_ip = sa.Column(sa.String(64))
     allocation_pools = orm.relationship(IPAllocationPool,
                                         backref='subnet',
-                                        lazy="dynamic")
+                                        lazy="dynamic",
+                                        cascade='delete')
     enable_dhcp = sa.Column(sa.Boolean())
     dns_nameservers = orm.relationship(DNSNameServer,
                                        backref='subnet',