Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect
Posted phlsheji
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect相关的知识,希望对你有一定的参考价值。
错误信息
[email protected]:~# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron
INFO [alembic.migration] Context impl SQLiteImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade havana -> e197124d4b9, add unique constraint to members
Traceback (most recent call last):
File "/usr/bin/neutron-db-manage", line 10, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/cli.py", line 173, in main
CONF.command.func(config, CONF.command.name)
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/cli.py", line 83, in do_upgrade_downgrade
do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/cli.py", line 61, in do_alembic_command
getattr(alembic_command, cmd)(config, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 165, in upgrade
script.run_env()
File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 390, in run_env
util.load_python_file(self.dir, ‘env.py‘)
File "/usr/local/lib/python2.7/dist-packages/alembic/util.py", line 243, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python2.7/dist-packages/alembic/compat.py", line 79, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 108, in <module>
run_migrations_online()
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/alembic_migrations/env.py", line 100, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/usr/local/lib/python2.7/dist-packages/alembic/environment.py", line 738, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python2.7/dist-packages/alembic/migration.py", line 309, in run_migrations
step.migration_fn(**kw)
File "/usr/lib/python2.7/dist-packages/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py", line 42, in upgrade
local_cols=[‘pool_id‘, ‘address‘, ‘protocol_port‘]
File "<string>", line 7, in create_unique_constraint
File "/usr/local/lib/python2.7/dist-packages/alembic/operations.py", line 805, in create_unique_constraint
schema=schema, **kw)
File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/sqlite.py", line 34, in add_constraint
"No support for ALTER of constraints in SQLite dialect")
NotImplementedError: No support for ALTER of constraints in SQLite dialect
错误原因
如今用的数据库是mysql,可是当软件安装完之后会自己主动生成一个SQLite 轻量级数据库。在这儿之所以会出错是由于此处用了SQLite。 而上面的同步命令不符合SQLite的语法,所以会出错
解决方法
禁用SQLite。凝视掉/etc/neutron/neutron.conf文件里[database]节中的SQLite连接,例如以下:
# vim /etc/neutron/neutron.conf
[database]
connection = mysql://neutron:[email protected]/neutron
#connection = sqlite:////var/lib/neutron/neutron.sqlite
再次运行同步语句
[email protected]:~# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
这样就ok了
以上是关于Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect的主要内容,如果未能解决你的问题,请参考以下文章
kolla制作过程中:neutron-sfc-agent 报错的问题
OpenStack安装Neutron组件最后进行验证后发现Metadata agent ct节点不显示
OpenStack安装Neutron组件最后进行验证后发现Metadata agent ct节点不显示