Steps to reproduce:
stack@ubuntu:~/devstack$ gbp l2policy-create test-l2p
Created a new l2_policy:
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| description | |
| id | 48befa7b-c4e5-474a-a070-8323a1259867 |
| l3_policy_id | ae382baa-a2d8-45fc-affd-b5b2131bded8 |
| name | test-l2p |
| network_id | 94a36d8b-b5a3-4a2a-90dd-e55edc521eab |
| policy_target_groups | |
| shared | False |
| tenant_id | 804cf28eaa634ceb8e9cbbe8d7f4b6d1 |
+----------------------+--------------------------------------+
stack@ubuntu:~/devstack$ neutron net-delete 94a36d8b-b5a3-4a2a-90dd-e55edc521eab
** hangs at this point **
In the Neutron log you will see an infinite loop of the following:
2015-07-01 14:11:50.311 DEBUG neutron.plugins.ml2.plugin [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Deleting network 94a36d8b-b5a3-4a2a-90dd-e55edc521eab delete_network /opt/stack/neutron/neutron/plugins/ml2/plugin.py:711
2015-07-01 14:11:50.313 DEBUG oslo_concurrency.lockutils [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Acquired semaphore "db-access" lock /usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py:391
2015-07-01 14:11:50.316 DEBUG neutron.plugins.ml2.plugin [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Ports to auto-delete: [] delete_network /opt/stack/neutron/neutron/plugins/ml2/plugin.py:734
2015-07-01 14:11:50.317 DEBUG neutron.plugins.ml2.plugin [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Subnets to auto-delete: [] delete_network /opt/stack/neutron/neutron/plugins/ml2/plugin.py:747
2015-07-01 14:11:50.330 DEBUG neutron.plugins.ml2.drivers.type_tunnel [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Releasing vxlan tunnel 1071 to pool release_segment /opt/stack/neutron/neutron/plugins/ml2/drivers/type_tunnel.py:174
2015-07-01 14:11:50.339 DEBUG neutron.plugins.ml2.plugin [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Deleting network record <neutron.db.models_v2.Network[object at 7ff88d8ae850] {tenant_id=u'804cf28eaa634ceb8e9cbbe8d7f4b6d1', id=u'94a36d8b-b5a3-4a2a-90dd-e55edc521eab', name=u'l2p_test-l2p', status=u'ACTIVE', admin_state_up=True, shared=False, mtu=0L, vlan_transparent=None}> delete_network /opt/stack/neutron/neutron/plugins/ml2/plugin.py:759
2015-07-01 14:11:50.339 DEBUG neutron.plugins.ml2.plugin [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Committing transaction delete_network /opt/stack/neutron/neutron/plugins/ml2/plugin.py:764
2015-07-01 14:11:50.354 ERROR oslo_db.sqlalchemy.exc_filters [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] DBAPIError exception wrapped from (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`neutron`.`gp_l2_policies`, CONSTRAINT `gp_l2_policies_ibfk_2` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`))') 'DELETE FROM networks WHERE networks.id = %s' ('94a36d8b-b5a3-4a2a-90dd-e55edc521eab',)
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1063, in _execute_context
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters context)
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 442, in do_execute
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters cursor.execute(statement, parameters)
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters self.errorhandler(self, exc, value)
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters raise errorclass, errorvalue
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`neutron`.`gp_l2_policies`, CONSTRAINT `gp_l2_policies_ibfk_2` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`))')
2015-07-01 14:11:50.354 63383 TRACE oslo_db.sqlalchemy.exc_filters
2015-07-01 14:11:50.372 DEBUG oslo_concurrency.lockutils [req-8fec1f1f-c848-4b03-977a-924e61ddd4cb admin admin] Releasing semaphore "db-access" lock /usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py:404
This happens because of this code block in the ML2 plugin:
https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/plugin.py#L721-L780
Workaround:
Restart the neutron server
Related fix proposed to branch: master /review. openstack. org/243334
Review: https:/