db migration (agents constraint) fails when using ryu plugin

Bug #1260233 reported by Yoshihiro Kaneko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
New
Undecided
Unassigned

Bug Description

Ryu plugin does not support agent extension yet.
Therefore, 511471cc46b_agent_ext_model_supp.py does not contain ryu plugin, and agents table is not created.
However, 1fcfc149aca4_agents_unique_by_type_and_host.py does not consider this case.
I think that migration_for_plugins of 1fcfc149aca4 should be the same as 511471cc46b's.

2013-12-12 01:08:44 INFO [alembic.migration] Running upgrade e197124d4b9 -> 1fcfc149aca4, Add a unique constraint on (agent_type, host) columns to prevent a race
2013-12-12 01:08:44 condition when an agent entry is 'upserted'.
2013-12-12 01:08:44 Traceback (most recent call last):
2013-12-12 01:08:44 File "/usr/local/bin/neutron-db-manage", line 10, in <module>
2013-12-12 01:08:44 sys.exit(main())
2013-12-12 01:08:44 File "/opt/stack/neutron/neutron/db/migration/cli.py", line 143, in main
2013-12-12 01:08:44 CONF.command.func(config, CONF.command.name)
2013-12-12 01:08:44 File "/opt/stack/neutron/neutron/db/migration/cli.py", line 80, in do_upgrade_downgrade
2013-12-12 01:08:44 do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
2013-12-12 01:08:44 File "/opt/stack/neutron/neutron/db/migration/cli.py", line 59, in do_alembic_command
2013-12-12 01:08:44 getattr(alembic_command, cmd)(config, *args, **kwargs)
2013-12-12 01:08:44 File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 124, in upgrade
2013-12-12 01:08:44 script.run_env()
2013-12-12 01:08:44 File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 193, in run_env
2013-12-12 01:08:44 util.load_python_file(self.dir, 'env.py')
2013-12-12 01:08:44 File "/usr/local/lib/python2.7/dist-packages/alembic/util.py", line 177, in load_python_file
2013-12-12 01:08:44 module = load_module(module_id, path)
2013-12-12 01:08:44 File "/usr/local/lib/python2.7/dist-packages/alembic/compat.py", line 39, in load_module
2013-12-12 01:08:44 return imp.load_source(module_id, path, fp)
2013-12-12 01:08:44 File "/opt/stack/neutron/neutron/db/migration/alembic_migrations/env.py", line 105, in <module>
2013-12-12 01:08:44 run_migrations_online()
2013-12-12 01:08:44 File "/opt/stack/neutron/neutron/db/migration/alembic_migrations/env.py", line 89, in run_migrations_online
2013-12-12 01:08:44 options=build_options())
2013-12-12 01:08:44 File "<string>", line 7, in run_migrations
2013-12-12 01:08:44 File "/usr/local/lib/python2.7/dist-packages/alembic/environment.py", line 652, in run_migrations
2013-12-12 01:08:45 self.get_context().run_migrations(**kw)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/alembic/migration.py", line 224, in run_migrations
2013-12-12 01:08:45 change(**kw)
2013-12-12 01:08:45 File "/opt/stack/neutron/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py", line 50, in upgrade
2013-12-12 01:08:45 local_cols=['agent_type', 'host']
2013-12-12 01:08:45 File "<string>", line 7, in create_unique_constraint
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/alembic/operations.py", line 539, in create_unique_constraint
2013-12-12 01:08:45 schema=schema, **kw)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 135, in add_constraint
2013-12-12 01:08:45 self._exec(schema.AddConstraint(const))
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 76, in _exec
2013-12-12 01:08:45 conn.execute(construct, *multiparams, **params)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1449, in execute
2013-12-12 01:08:45 params)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1542, in _execute_ddl
2013-12-12 01:08:45 compiled
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1698, in _execute_context
2013-12-12 01:08:45 context)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1691, in _execute_context
2013-12-12 01:08:45 context)
2013-12-12 01:08:45 File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 331, in do_execute
2013-12-12 01:08:45 cursor.execute(statement, parameters)
2013-12-12 01:08:45 File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
2013-12-12 01:08:45 self.errorhandler(self, exc, value)
2013-12-12 01:08:45 File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
2013-12-12 01:08:45 raise errorclass, errorvalue
2013-12-12 01:08:45 sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1146, "Table 'ovs_neutron.agents' doesn't exist") 'ALTER TABLE agents ADD CONSTRAINT uniq_agents0agent_type0host UNIQUE (agent_type, host)' ()

Tags: db
Revision history for this message
Edgar Magana (emagana) wrote :

This is the same bug that the one above but for a different plugin:
https://bugs.launchpad.net/neutron/+bug/1260232

Let's fix this in only one commit. I can take it or you can, just let me know.

Revision history for this message
Yoshihiro Kaneko (ykaneko0929) wrote :

Change I7915ef8d seems to fix these problems.
  https://review.openstack.org/#/c/61663/

Revision history for this message
Akihiro Motoki (amotoki) wrote :

This is the same issue as bug 1254246.

tags: added: db
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.