"neutron-db-manage upgrade heads" fails with networksegments_ibfk_2

Bug #1619696 reported by Emilien Macchi
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Critical
Jakub Libosvar

Bug Description

Since this commit: https://review.openstack.org/#/c/293305/

Puppet OpenStack CI is failing to run db upgrades:

2016-09-02 13:41:05.973470 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: INFO [alembic.runtime.migration] Running upgrade 3b935b28e7a0, 67daae611b6e -> b12a3ef66e62, add standardattr to qos policies
2016-09-02 13:41:05.973831 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: INFO [alembic.runtime.migration] Running upgrade b12a3ef66e62, 89ab9a816d70 -> 97c25b0d2353, Add Name and Description to the networksegments table
2016-09-02 13:41:05.974141 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: Running upgrade for neutron ...
2016-09-02 13:41:05.974450 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: Traceback (most recent call last):
2016-09-02 13:41:05.974762 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/bin/neutron-db-manage", line 10, in <module>
2016-09-02 13:41:05.975062 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: sys.exit(main())
2016-09-02 13:41:05.975360 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 686, in main
2016-09-02 13:41:05.975647 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return_val |= bool(CONF.command.func(config, CONF.command.name))
2016-09-02 13:41:05.975959 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 207, in do_upgrade
2016-09-02 13:41:05.976238 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: desc=branch, sql=CONF.command.sql)
2016-09-02 13:41:05.976541 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 108, in do_alembic_command
2016-09-02 13:41:05.976854 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: getattr(alembic_command, cmd)(config, *args, **kwargs)
2016-09-02 13:41:05.977153 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade
2016-09-02 13:41:05.977420 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: script.run_env()
2016-09-02 13:41:05.977711 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env
2016-09-02 13:41:05.978016 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: util.load_python_file(self.dir, 'env.py')
2016-09-02 13:41:05.978335 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
2016-09-02 13:41:05.978614 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: module = load_module_py(module_id, path)
2016-09-02 13:41:05.978932 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py
2016-09-02 13:41:05.979212 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: mod = imp.load_source(module_id, path, fp)
2016-09-02 13:41:05.979568 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/alembic_migrations/env.py", line 120, in <module>
2016-09-02 13:41:05.979862 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: run_migrations_online()
2016-09-02 13:41:05.980238 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/alembic_migrations/env.py", line 114, in run_migrations_online
2016-09-02 13:41:05.980519 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: context.run_migrations()
2016-09-02 13:41:05.980858 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "<string>", line 8, in run_migrations
2016-09-02 13:41:05.981163 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations
2016-09-02 13:41:05.981445 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: self.get_context().run_migrations(**kw)
2016-09-02 13:41:05.981744 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 312, in run_migrations
2016-09-02 13:41:05.982034 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: step.migration_fn(**kw)
2016-09-02 13:41:05.982606 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/neutron/db/migration/alembic_migrations/versions/newton/contract/97c25b0d2353_add_name_desc.py", line 83, in upgrade
2016-09-02 13:41:05.982900 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: existing_server_default=False)
2016-09-02 13:41:05.983209 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "<string>", line 8, in alter_column
2016-09-02 13:41:05.983563 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "<string>", line 3, in alter_column
2016-09-02 13:41:05.983880 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/operations/ops.py", line 1414, in alter_column
2016-09-02 13:41:05.984162 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return operations.invoke(alt)
2016-09-02 13:41:05.984459 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/operations/base.py", line 318, in invoke
2016-09-02 13:41:05.984828 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return fn(self, operation)
2016-09-02 13:41:05.985144 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/operations/toimpl.py", line 53, in alter_column
2016-09-02 13:41:05.985413 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: **operation.kw
2016-09-02 13:41:05.985702 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 66, in alter_column
2016-09-02 13:41:05.986043 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: else existing_autoincrement
2016-09-02 13:41:05.986345 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/alembic/ddl/impl.py", line 118, in _exec
2016-09-02 13:41:05.986620 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return conn.execute(construct, *multiparams, **params)
2016-09-02 13:41:05.986925 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
2016-09-02 13:41:05.987200 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return meth(self, multiparams, params)
2016-09-02 13:41:05.987491 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
2016-09-02 13:41:05.987769 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: return connection._execute_ddl(self, multiparams, params)
2016-09-02 13:41:05.988072 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl
2016-09-02 13:41:05.988334 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: compiled
2016-09-02 13:41:05.988647 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2016-09-02 13:41:05.988925 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: context)
2016-09-02 13:41:05.989219 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2016-09-02 13:41:05.989498 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: util.raise_from_cause(newraise, exc_info)
2016-09-02 13:41:05.989897 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
2016-09-02 13:41:05.990180 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: reraise(type(exception), exception, tb=exc_tb)
2016-09-02 13:41:05.990545 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-09-02 13:41:05.990932 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: context)
2016-09-02 13:41:05.991253 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-09-02 13:41:05.991542 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: cursor.execute(statement, parameters)
2016-09-02 13:41:05.991850 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 146, in execute
2016-09-02 13:41:05.992136 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: result = self._query(query)
2016-09-02 13:41:05.992427 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/cursors.py", line 296, in _query
2016-09-02 13:41:05.992699 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: conn.query(q)
2016-09-02 13:41:05.993011 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 781, in query
2016-09-02 13:41:05.993302 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2016-09-02 13:41:05.993605 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 942, in _read_query_result
2016-09-02 13:41:05.993906 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: result.read()
2016-09-02 13:41:05.994201 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1138, in read
2016-09-02 13:41:05.994481 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: first_packet = self.connection._read_packet()
2016-09-02 13:41:05.994783 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 906, in _read_packet
2016-09-02 13:41:05.995070 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: packet.check_error()
2016-09-02 13:41:05.995364 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 367, in check_error
2016-09-02 13:41:05.995644 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: err.raise_mysql_exception(self._data)
2016-09-02 13:41:05.995959 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 120, in raise_mysql_exception
2016-09-02 13:41:05.996236 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: _check_mysql_exception(errinfo)
2016-09-02 13:41:05.996530 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 115, in _check_mysql_exception
2016-09-02 13:41:05.996824 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: raise InternalError(errno, errorvalue)
2016-09-02 13:41:05.997166 | Notice: /Stage[main]/Neutron::Db::Sync/Exec[neutron-db-sync]/returns: oslo_db.exception.DBError: (pymysql.err.InternalError) (1832, u"Cannot change column 'standard_attr_id': used in a foreign key constraint 'networksegments_ibfk_2'") [SQL: u'ALTER TABLE networksegments MODIFY standard_attr_id BIGINT NOT NULL']

Tags: db
Changed in neutron:
status: New → Confirmed
tags: added: db
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/365014

Changed in neutron:
assignee: nobody → Jakub Libosvar (libosvar)
status: Confirmed → In Progress
Changed in neutron:
importance: Undecided → Critical
milestone: none → newton-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/365014
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9127f074f5a5f99eae09aba45a713041a55d91ae
Submitter: Jenkins
Branch: master

commit 9127f074f5a5f99eae09aba45a713041a55d91ae
Author: Jakub Libosvar <email address hidden>
Date: Fri Sep 2 16:39:17 2016 +0200

    db migration: Alter column before setting a FK on column

    MySQL doesn't like foreign key columns to be modified,
    this adjusts the script to add all constraints and make
    modifications before setting up the foreign key relationship.

    Change-Id: I494758120c8a87fe584c781b928f8b9d3bac5291
    Closes-bug: 1619696

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.0.0.0rc1

This issue was fixed in the openstack/neutron 9.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.