ipallocationpools remains after subnet deletion

Bug #1091946 reported by Itsuro Oda
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Gary Kotton
Folsom
Fix Released
High
Gary Kotton

Bug Description

It seems ipallocationpools table is not deleted at all.

---
$ quantum net-create net1
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| id | 4d9ce72f-fd4c-47e8-aa00-8602c2e122ac |
| name | net1 |
| provider:network_type | local |
| provider:physical_network | |
| provider:segmentation_id | |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | d77feb1a8f8749569f779c5ae20e68d2 |
+---------------------------+--------------------------------------+
$ quantum subnet-create --name sub1 net1 10.0.0.0/24 --enable_dhcp=false
Created a new subnet:
+------------------+--------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------+
| allocation_pools | {"start": "10.0.0.2", "end": "10.0.0.254"} |
| cidr | 10.0.0.0/24 |
| dns_nameservers | |
| enable_dhcp | False |
| gateway_ip | 10.0.0.1 |
| host_routes | |
| id | b7baffd3-65f3-4261-b284-de84376e7d9c |
| ip_version | 4 |
| name | sub1 |
| network_id | 4d9ce72f-fd4c-47e8-aa00-8602c2e122ac |
| tenant_id | d77feb1a8f8749569f779c5ae20e68d2 |
+------------------+--------------------------------------------+
$ quantum subnet-delete sub1
Deleted subnet: sub1
$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 73
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use ovs_quantum
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from ipallocationpools;
+--------------------------------------+-----------+----------+------------+
| id | subnet_id | first_ip | last_ip |
+--------------------------------------+-----------+----------+------------+
| bdd1aa31-b3c7-40d4-baaa-04f84d288855 | NULL | 10.0.0.2 | 10.0.0.254 |
+--------------------------------------+-----------+----------+------------+
1 row in set (0.01 sec)

mysql>
---

Revision history for this message
Itsuro Oda (oda-g) wrote :

I use current stable/folsom (commit b15099c78fa542b77c37195bfed7598b6fd702eb).

Thanks.

Gary Kotton (garyk)
Changed in quantum:
status: New → Confirmed
tags: added: folsom-backport-potential
Revision history for this message
Itsuro Oda (oda-g) wrote :

This patch seems fixing this problem. But please ask to an sclalchemy specialist.
Thanks.
--- a/quantum/db/models_v2.py
+++ b/quantum/db/models_v2.py
@@ -65,7 +65,7 @@ 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)
@@ -132,7 +132,7 @@ 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',

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/18684

Changed in quantum:
assignee: nobody → Gary Kotton (garyk)
status: Confirmed → In Progress
Revision history for this message
Gary Kotton (garyk) wrote :

Hi,
Yes, this solves the problem. I have taken the chutzpah to fix it upstream.
Thanks
Gary

Changed in quantum:
milestone: none → grizzly-2
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/18684
Committed: http://github.com/openstack/quantum/commit/7de8e37d83db20360ea950dba8c6c0d827aee94e
Submitter: Jenkins
Branch: master

commit 7de8e37d83db20360ea950dba8c6c0d827aee94e
Author: Gary Kotton <email address hidden>
Date: Thu Dec 27 14:16:46 2012 +0000

    Ensure allocation pools are deleted from database

    Fixes bug 1091946

    Change-Id: I4330f7a81e4745d5885d58fe7c8a010d18a8e004

Changed in quantum:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/18818

Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (stable/folsom)

Reviewed: https://review.openstack.org/18818
Committed: http://github.com/openstack/quantum/commit/579727a74d52d32a0b2f291f031aba9b60b04ebe
Submitter: Jenkins
Branch: stable/folsom

commit 579727a74d52d32a0b2f291f031aba9b60b04ebe
Author: Gary Kotton <email address hidden>
Date: Thu Dec 27 14:16:46 2012 +0000

    Ensure allocation pools are deleted from database

    Fixes bug 1091946

    Change-Id: I4330f7a81e4745d5885d58fe7c8a010d18a8e004

tags: added: in-stable-folsom
Mark McLoughlin (markmc)
tags: removed: folsom-backport-potential in-stable-folsom
Thierry Carrez (ttx)
Changed in quantum:
milestone: grizzly-2 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.