delete_subnet since ipallocationranges has a foreign key to the subnet

Bug #1020563 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Gary Kotton

Bug Description

After create_net and create_subnet , then delete_subnet fails with the following errors:
This bug can be reproduced by executing delete_subnet just after stack.sh has finished.

ubuntu@t1:~/devstack$ quantumv2 --os-token ADMIN --os-url http://localhost:9696/ delete_subnet 7e183f5b-e37f-4708-aecb-d6a555801678
ERROR: cliff.app (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`ovs_quantum`.`ipallocationranges`, CONSTRAINT `ipallocationranges_ibfk_1` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`))') 'DELETE FROM subnets WHERE subnets.id = {'message': u"(IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`ovs_quantum`.`ipallocationranges`, CONSTRAINT `ipallocationranges_ibfk_1` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`))') 'DELETE FROM subnets WHERE subnets.id = %s' ('7e183f5b-e37f-4708-aecb-d6a555801678',)"}' ('7e183f5b-e37f-4708-aecb-d6a555801678',)

QuantumDbPluginV2:delete_subnet() in db/db_base_plugin_v2.py does not remove
an entry in IPAllocationRange tables that refers to the subnet to be deleted.

I also confirms that delete_subnet succeeded after I deleted the entry in IPAllocationRange tables that refers to the subnet.

(environment)
quantum: commit b0f43d7
devstack: commit 5a70e3f + https://review.openstack.org/#/c/9161 .

Akihiro Motoki (amotoki)
Changed in quantum:
assignee: nobody → Akihiro Motoki (amotoki)
Revision history for this message
dan wendlandt (danwent) wrote :

Thanks for filing this bug and working on a fix!

Changed in quantum:
milestone: none → folsom-2
importance: Undecided → High
status: New → In Progress
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/9285

Changed in quantum:
assignee: Akihiro Motoki (amotoki) → Gary Kotton (garyk)
Revision history for this message
dan wendlandt (danwent) wrote :

Hi akihiro,

Since today is the last day to get fixes in for Folsom-2, garyk did a quick patch to fix this. However, gary did not yet explore why the unit tests did not catch this issue (it seems there is a gap in quantum/tests/unit/test_db_plugin.py that is not correctly testing delete_subnet). If you wanted to look into this and propose a fix, that would be very helpful.

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

Reviewed: https://review.openstack.org/9285
Committed: http://github.com/openstack/quantum/commit/06900100ad6ddf81c7e5d48a17db079969dd80ce
Submitter: Jenkins
Branch: master

commit 06900100ad6ddf81c7e5d48a17db079969dd80ce
Author: Gary Kotton <email address hidden>
Date: Tue Jul 3 13:11:31 2012 -0400

    Delete IP allocation range for subnet when deleting subnet

    Fixes bug 1020563

    Change-Id: I034e490825603ab71662a0bbad9b325f419a9e43

Changed in quantum:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: folsom-2 → 2012.2
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.