FK errors in neutron-db-migrate revision --autogenerate

Bug #1648545 reported by YAMAMOTO Takashi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-midonet
In Progress
Low
YAMAMOTO Takashi

Bug Description

ubu7% neutron-db-manage --subproject networking-midonet revision -m "foo" --autogenerate
  Running revision for networking-midonet ...
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
  File "/usr/local/bin/neutron-db-manage", line 10, in <module>
    sys.exit(main())
  File "/opt/stack/neutron/neutron/db/migration/cli.py", line 686, in main
    return_val |= bool(CONF.command.func(config, CONF.command.name))
  File "/opt/stack/neutron/neutron/db/migration/cli.py", line 258, in do_revision
    do_alembic_command(config, cmd, **kwargs)
  File "/opt/stack/neutron/neutron/db/migration/cli.py", line 108, in do_alembic_command
    getattr(alembic_command, cmd)(config, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 117, in revision
    script_directory.run_env()
  File "/usr/local/lib/python2.7/dist-packages/alembic/script/base.py", line 407, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/local/lib/python2.7/dist-packages/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python2.7/dist-packages/alembic/util/compat.py", line 79, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/opt/stack/networking-midonet/midonet/neutron/db/migration/alembic_migration/env.py", line 95, in <module>
    run_migrations_online()
  File "/opt/stack/networking-midonet/midonet/neutron/db/migration/alembic_migration/env.py", line 86, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/environment.py", line 797, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/migration.py", line 303, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 97, in retrieve_migrations
    revision_context.run_autogenerate(rev, context)
  File "/usr/local/lib/python2.7/dist-packages/alembic/autogenerate/api.py", line 369, in run_autogenerate
    self._run_environment(rev, migration_context, True)
  File "/usr/local/lib/python2.7/dist-packages/alembic/autogenerate/api.py", line 405, in _run_environment
    autogen_context, migration_script)
  File "/usr/local/lib/python2.7/dist-packages/alembic/autogenerate/compare.py", line 22, in _populate_migration_script
    _produce_net_changes(autogen_context, upgrade_ops)
  File "/usr/local/lib/python2.7/dist-packages/alembic/autogenerate/compare.py", line 48, in _produce_net_changes
    autogen_context, upgrade_ops, schemas
  File "/usr/local/lib/python2.7/dist-packages/alembic/util/langhelpers.py", line 314, in go
    fn(*arg, **kw)
  File "/usr/local/lib/python2.7/dist-packages/alembic/autogenerate/compare.py", line 73, in _autogen_for_tables
    [(table.schema, table.name) for table in metadata.sorted_tables]
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 3604, in sorted_tables
    return ddl.sort_tables(sorted(self.tables.values(), key=lambda t: t.key))
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 991, in sort_tables
    tables, filter_fn=_skip_fn, extra_dependencies=extra_dependencies)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 1058, in sort_tables_and_constraints
    dependent_on = fkc.referred_table
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 2872, in referred_table
    return self.elements[0].column.table
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 754, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py", line 1841, in column
    tablekey)
sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'bgp_speaker_router_associations.bgp_speaker_id' could not find table 'bgp_speakers' with which to generate a foreign key to target column 'id'
ubu7%

Changed in networking-midonet:
assignee: nobody → YAMAMOTO Takashi (yamamoto)
importance: Undecided → Low
milestone: none → 4.0.0
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-midonet (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on networking-midonet (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/408711
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Changed in networking-midonet:
milestone: 4.0.0 → 5.0.0
tags: added: ocata-backport-potential
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.