码迷,mamicode.com
首页 > 数据库 > 详细

Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect

时间:2015-06-03 21:38:36      阅读:720      评论:0      收藏:0      [点我收藏+]

标签:openstack   linux   mariadb   neutron   

错误信息

root@controller:~# 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:openstack@controller/neutron
#connection = sqlite:////var/lib/neutron/neutron.sqlite

再次执行同步语句

root@controller:~# 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

标签:openstack   linux   mariadb   neutron   

原文地址:http://blog.csdn.net/moolight_shadow/article/details/46350613

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!