← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1294434] [NEW] Add missing ondelete foreignkey constraint to Cisco N1kv tables

 

Public bug reported:

Current DB migration script to populate N1kv tables is missing the
ondelete="CASCADE" option in the ForeignKey constraint for network and
port binding tables. This causes the network and port delete calls to
fail with Integrity error. This occurs when the database is populated
with db migration scripts.

super(N1kvNeutronPluginV2, self).delete_network(context, id)
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/db_base_plugin_v2.py", line 1013, in delete_network
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     context.session.delete(network)
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 456, in __exit__
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self.commit()
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 368, in commit
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self._prepare_impl()
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 347, in _prepare_impl
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self.session.flush()
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/openstack/common/db/sqlalchemy/session.py", line 616, in _wrap
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     raise exception.DBError(e)
2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource DBError: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`cisco_neutron`.`cisco_n1kv_network_bindings`, CONSTRAINT `cisco_n1kv_network_bindings_ibfk_1` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`))') 'DELETE FROM networks WHERE networks.id = %s' ('12fb857a-cb23-44f0-81a4-9cc8fc669de0',)

** Affects: neutron
     Importance: Undecided
     Assignee: Abhishek Raut (abhraut)
         Status: New


** Tags: cisco

** Changed in: neutron
     Assignee: (unassigned) => Abhishek Raut (abhraut)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1294434

Title:
  Add missing ondelete foreignkey constraint to Cisco N1kv tables

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  Current DB migration script to populate N1kv tables is missing the
  ondelete="CASCADE" option in the ForeignKey constraint for network and
  port binding tables. This causes the network and port delete calls to
  fail with Integrity error. This occurs when the database is populated
  with db migration scripts.

  super(N1kvNeutronPluginV2, self).delete_network(context, id)
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/db_base_plugin_v2.py", line 1013, in delete_network
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     context.session.delete(network)
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 456, in __exit__
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self.commit()
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 368, in commit
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self._prepare_impl()
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 347, in _prepare_impl
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     self.session.flush()
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/openstack/common/db/sqlalchemy/session.py", line 616, in _wrap
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource     raise exception.DBError(e)
  2014-03-09 06:51:31.033 8487 TRACE neutron.api.v2.resource DBError: (IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`cisco_neutron`.`cisco_n1kv_network_bindings`, CONSTRAINT `cisco_n1kv_network_bindings_ibfk_1` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`))') 'DELETE FROM networks WHERE networks.id = %s' ('12fb857a-cb23-44f0-81a4-9cc8fc669de0',)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1294434/+subscriptions


Follow ups

References