nicira: db integrity error on dhcp port operations

Bug #1265472 reported by Armando Migliaccio
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Armando Migliaccio

Bug Description

This stacktrace has been observed during dhcp port operations after change 648f787d80530d34bbbb159220d56591dfa46a86:

2014-01-01 10:25:03.086 29167 ERROR neutron.openstack.common.rpc.amqp [req-5efe812b-3f99-4712-b301-c93cb1f5e893 888bff1f89bd4cdab3ea4d1d9e4a1c34 0f1987d130294a938bf3d6c04ca843dc] Exception during message handling
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp Traceback (most recent call last):
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/openstack/common/rpc/amqp.py", line 438, in _process_data
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp **args)
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/common/rpc.py", line 45, in dispatch
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp neutron_ctxt, version, method, namespace, **kwargs)
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/db/dhcp_rpc_base.py", line 195, in get_dhcp_port
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp 'create_port')
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/db/dhcp_rpc_base.py", line 53, in _port_action
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp return plugin.create_port(context, port)
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/opt/stack/neutron/neutron/plugins/nicira/NeutronPlugin.py", line 1172, in create_port
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp with context.session.begin(subtransactions=True):
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 643, in begin
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp nested=nested)
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 236, in _begin
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp self._assert_is_active()
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 213, in _assert_is_active
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp % self._rollback_exception
2014-01-01 10:25:03.086 29167 TRACE neutron.openstack.common.rpc.amqp InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`neutron_nvp`.`neutron_nsx_port_mappings`, CONSTRAINT `neutron_nsx_port_mappings_ibfk_1` FOREIGN KEY (`neutron_id`) REFERENCES `ports` (`id`) ON DELETE CASCADE)') 'INSERT INTO neutron_nsx_port_mappings (neutron_id, nsx_switch_id, nsx_port_id) VALUES (%s, %s, %s)' ('b79d2734-29e6-4494-9325-c50c647d6a56', 'cb841161-bcee-49df-a881-d143667115c4', '5e660371-797a-449c-890d-b63c02364bea')

It looks like the plugin is attempting to add a mapping for a Neutron port that no longer exists. Even though this is likely not to lead to a potential failure in API operations, this should be dealt with in order to not upset the dhcp agent normal processing.

Tags: nicira
Changed in neutron:
assignee: nobody → Armando Migliaccio (armando-migliaccio)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/65073
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5bdbfc2e52ac8d97e8421d0f8c74993de08191f5
Submitter: Jenkins
Branch: master

commit 5bdbfc2e52ac8d97e8421d0f8c74993de08191f5
Author: armando-migliaccio <email address hidden>
Date: Mon Jan 6 04:42:30 2014 -0800

    VMware NSX: Fix db integrity error on dhcp port operations

    If the dhcp port and network disappear, ensure that
    the integrity constraint violation that results from
    inserting the neutron/nsx port mapping to the DB does
    not propagate the exception all the way through, but
    instead is caught and handled correctly.

    Closes-bug: #1265472

    Change-Id: I3ae072729d579def0bd9658241eda1011a3dcfa0

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/66693

Thierry Carrez (ttx)
Changed in neutron:
milestone: none → icehouse-2
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.openstack.org/66693
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3d044acf65682d5d8815185ac4baa83e3763f935
Submitter: Jenkins
Branch: master

commit 3d044acf65682d5d8815185ac4baa83e3763f935
Author: armando-migliaccio <email address hidden>
Date: Tue Jan 14 13:35:06 2014 -0800

    improve UT coverage for nicira_db operations

    Also, ensure that a rollback is issued in the
    event of any DB error.

    Change-Id: I706db09f11fb5f6b369a1bd0cb1016df7d0359b5
    Related-bug: #1265472

Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-2 → 2014.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.