zoukankan      html  css  js  c++  java
  • Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect

    错误信息

    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了

  • 相关阅读:
    装饰器
    内置函数
    文件操作
    函数
    数据结构[总结笔记]
    汉诺塔解题思路
    springboot事物
    mysql5.7.29 zip包安装教程
    mysql常用语句【转载】
    springboot+mysql+jpa+sharding-jdbc+druid读写分离
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/5267869.html
Copyright © 2011-2022 走看看