db migrate script to set charset=utf8 for all tables

Error:

root@controller:/etc/keystone/scripts# glance-manage db_sync
2014-10-20 10:18:39.149 19807 CRITICAL glance [-] ValueError: Tables "migrate_version" have non utf8 collation, please make sure all tables are CHARSET=utf8
2014-10-20 10:18:39.149 19807 TRACE glance Traceback (most recent call last):
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/bin/glance-manage", line 10, in
2014-10-20 10:18:39.149 19807 TRACE glance     sys.exit(main())
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 259, in main
2014-10-20 10:18:39.149 19807 TRACE glance     return CONF.command.action_fn()
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 160, in sync
2014-10-20 10:18:39.149 19807 TRACE glance     CONF.command.current_version)
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 137, in sync
2014-10-20 10:18:39.149 19807 TRACE glance     sanity_check=self._need_sanity_check())
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/lib/python2.7/dist-packages/glance/openstack/common/db/sqlalchemy/migration.py", line 195, in db_sync
2014-10-20 10:18:39.149 19807 TRACE glance     _db_schema_sanity_check(engine)
2014-10-20 10:18:39.149 19807 TRACE glance   File "/usr/lib/python2.7/dist-packages/glance/openstack/common/db/sqlalchemy/migration.py", line 221, in _db_schema_sanity_check
2014-10-20 10:18:39.149 19807 TRACE glance     ) % ','.join(table_names))
2014-10-20 10:18:39.149 19807 TRACE glance ValueError: Tables "migrate_version" have non utf8 collation, please make sure all tables are CHARSET=utf8
2014-10-20 10:18:39.149 19807 TRACE glance

Solutions:

edit /etc/mysql/my.conf, add 3 lines in [mysqlid]section:

collation-server = utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server = utf8


then login glance database in mysql, change table charset:

mysql> alter table migrate_version convert to character set 'utf8';


OK, that's ok!

Reference: https://bugs.launchpad.net/glance/+bug/1279000

你可能感兴趣的:(OpenStack)