root@ubuntu:/# su -s /bin/sh -c "nova-manage api_db sync" nova
An error has occurred:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 1606, in main
ret = fn(*fn_args, **fn_kwargs)
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 810, in sync
return migration.db_sync(version, database='api')
File "/usr/lib/python2.7/dist-packages/nova/db/migration.py", line 26, in db_sync
return IMPL.db_sync(version=version, database=database, context=context)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 53, in db_sync
current_version = db_version(database, context=context)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 84, in db_version
_("Upgrade DB using Essex release first."))
NovaException: Upgrade DB using Essex release first.
错误原因:
nova.conf文件中[api_database]节选下已经存在一个sqlite的默认db connection覆盖了前面的设置,注释掉就可以了。
[api_database]
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
#
# The *Nova API Database* is a separate database which is used for information
# which is used across *cells*. This database is mandatory since the Mitaka
# release (13.0.0).
#
# From nova.conf
#
# The SQLAlchemy connection string to use to connect to the database. (string
# value)
#connection=sqlite:var/lib/nova/nova.sqlite