IntegrityError: NOT NULL constraint failed: tags.resource_id during instance_tag_set

Bug #1486041 reported by Sergey Nikitin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Sergey Nikitin

Bug Description

Steps to reproduce:

 1. create instance
 2. set ['tag1', 'tag2'] to the instance
 3. set ['tag1'] to the instance

Expected result:
    tags were added.

Actual result:

    2015-08-18 16:26:36,601 ERROR [oslo_db.sqlalchemy.exc_filters] DBAPIError exception wrapped from (sqlite3.IntegrityError) NOT NULL constraint failed: tags.resource_id [SQL: u'INSERT INTO tags DEFAULT VALUES']
    Traceback (most recent call last):
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
        context)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
        cursor.execute(statement, parameters)
    IntegrityError: NOT NULL constraint failed: tags.resource_id

It happens because list 'to_add' in method 'instance_tag_set' is empty in second case. It's empty because on step 3 must delete one tag and create zero tags. So to fix bug we must check list to_add.

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

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

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

Reviewed: https://review.openstack.org/214189
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8ffe9e9a8c41aafb46de3eac467b027bf3f4cf2b
Submitter: Jenkins
Branch: master

commit 8ffe9e9a8c41aafb46de3eac467b027bf3f4cf2b
Author: Sergey Nikitin <email address hidden>
Date: Tue Aug 18 16:39:31 2015 +0300

    Don't query database with an empty list of tags for creation

    It raises IntegrityError: NOT NULL constraint failed: tags.resource_id

    Closes-Bug: #1486041

    Change-Id: I9fe43e50ef38bda7b81d0ff201a623742a39b824

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-3 → 12.0.0
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.