Comment 3 for bug 1399768

Revision history for this message
Dave Chen (wei-d-chen) wrote : Re: migration ofr endpoint_filter failes due to foreign key constraint

Hit the same issue with follow error message, will look into the issue and check whether this is caused by the old .pyc as ayong methioned.

/usr/local/bin/keystone-manage db_sync --extension endpoint_filter

31365 TRACE keystone Traceback (most recent call last):
31365 TRACE keystone File "/usr/local/bin/keystone-manage", line 6, in <module>
31365 TRACE keystone exec(compile(open(__file__).read(), __file__, 'exec'))
31365 TRACE keystone File "/opt/stack/keystone/bin/keystone-manage", line 44, in <module>
31365 TRACE keystone cli.main(argv=sys.argv, config_files=config_files)
31365 TRACE keystone File "/opt/stack/keystone/keystone/cli.py", line 311, in main
31365 TRACE keystone CONF.command.cmd_class.main()
31365 TRACE keystone File "/opt/stack/keystone/keystone/cli.py", line 74, in main
31365 TRACE keystone migration_helpers.sync_database_to_version(extension, version)
31365 TRACE keystone File "/opt/stack/keystone/keystone/common/sql/migration_helpers.py", line 211, in sync_database_to_version
31365 TRACE keystone _sync_extension_repo(extension, version)
31365 TRACE keystone File "/opt/stack/keystone/keystone/common/sql/migration_helpers.py", line 199, in _sync_extension_repo
31365 TRACE keystone init_version=init_version)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/migration.py", line 79, in db_sync
31365 TRACE keystone return versioning_api.upgrade(engine, repository, version)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
31365 TRACE keystone return _migrate(url, repository, version, upgrade=True, err=err, **opts)
31365 TRACE keystone File "<string>", line 2, in _migrate
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 160, in with_engine
31365 TRACE keystone return f(*a, **kw)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate
31365 TRACE keystone schema.runchange(ver, change, changeset.step)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 93, in runchange
31365 TRACE keystone change.run(self.engine, step)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 148, in run
31365 TRACE keystone script_func(engine)
31365 TRACE keystone File "/opt/stack/keystone/keystone/contrib/endpoint_filter/migrate_repo/versions/002_add_endpoint_groups.py", line 41, in upgrade
31365 TRACE keystone project_endpoint_group_table.create(migrate_engine, checkfirst=True)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 707, in create
31365 TRACE keystone checkfirst=checkfirst)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1616, in _run_visitor
31365 TRACE keystone conn._run_visitor(visitorcallable, element, **kwargs)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1245, in _run_visitor
31365 TRACE keystone **kwargs).traverse_single(element)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/visitors.py", line 120, in traverse_single
31365 TRACE keystone return meth(obj, **kw)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 732, in visit_table
31365 TRACE keystone self.connection.execute(CreateTable(table))
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 729, in execute
31365 TRACE keystone return meth(self, multiparams, params)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
31365 TRACE keystone return connection._execute_ddl(self, multiparams, params)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
31365 TRACE keystone compiled
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
31365 TRACE keystone context)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1155, in _handle_dbapi_exception
31365 TRACE keystone util.raise_from_cause(newraise, exc_info)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
31365 TRACE keystone reraise(type(exception), exception, tb=exc_tb)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
31365 TRACE keystone context)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 436, in do_execute
31365 TRACE keystone cursor.execute(statement, parameters)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute
31365 TRACE keystone self.errorhandler(self, exc, value)
31365 TRACE keystone File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
31365 TRACE keystone raise errorclass, errorvalue
31365 TRACE keystone OperationalError: (OperationalError) (1005, "Can't create table 'keystone.project_endpoint_group' (errno: 150)") '\nCREATE TABLE project_endpoint_group (\n\tendpoint_group_id VARCHAR(64) NOT NULL, \n\tproject_id VARCHAR(64) NOT NULL, \n\tPRIMARY KEY (endpoint_group_id, project_id), \n\tFOREIGN KEY(endpoint_group_id) REFERENCES endpoint_group (id)\n)\n\n' ()
31365 TRACE keystone