Description of problem: When initialising RHOS Folsom preview glance using the RHOS Folsom Getting Started Guide instructions (chapter 9), it fails with: ERROR 1146 (42S02) at line 1: Table 'glance.migrate_version' doesn't exist Final sanity check failed. Version-Release number of selected component (if applicable): openstack-glance-2012.2.3-1.el6ost.noarch openstack-keystone-2012.2.3-1.el6ost.noarch openstack-utils-2012.2-6.1.el6ost.noarch python-sqlalchemy0.7-0.7.8-1.el6ost.x86_64 How reproducible: Every time. Even after dropping the glance db and trying again (more than once), same error occurs. Steps to Reproduce: 1. Install keystone and setup admin + username users, as per Chapter 8 of GSG. 2. Install openstack-glance using yum install 3. Attempt to initialise glance using "sudo openstack-db --init --service glance". Fails here. Actual results: $ sudo openstack-db --init --service glance Please enter the password for the 'root' MySQL user: Verified connectivity to MySQL. Creating 'glance' database. Asking openstack-glance to sync the database. Traceback (most recent call last): File "/usr/bin/glance-manage", line 133, in <module> main() File "/usr/bin/glance-manage", line 129, in main dispatch_cmd(args) File "/usr/bin/glance-manage", line 99, in dispatch_cmd cmd_func(args) File "/usr/bin/glance-manage", line 86, in do_db_sync glance.db.sqlalchemy.migration.db_sync(version, current_version) File "/usr/lib/python2.6/site-packages/glance/db/sqlalchemy/migration.py", line 120, in db_sync _version_control(current_version or 0) File "/usr/lib/python2.6/site-packages/glance/db/sqlalchemy/migration.py", line 109, in _version_control return versioning_api.version_control(sql_connection, repo_path, version) File "<string>", line 2, in version_control File "/usr/lib/python2.6/site-packages/migrate/versioning/util/__init__.py", line 160, in with_engine return f(*a, **kw) File "/usr/lib/python2.6/site-packages/migrate/versioning/api.py", line 248, in version_control ControlledSchema.create(engine, repository, version) File "/usr/lib/python2.6/site-packages/migrate/versioning/schema.py", line 137, in create table = cls._create_table_version(engine, repository, version) File "/usr/lib/python2.6/site-packages/migrate/versioning/schema.py", line 178, in _create_table_version if not table.exists(): File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/schema.py", line 579, in exists self.name, schema=self.schema) File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2424, in run_callable conn = self.contextual_connect() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2490, in contextual_connect self.pool.connect(), File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 224, in connect return _ConnectionFairy(self).checkout() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 387, in __init__ rec = self._connection_record = pool._do_get() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 802, in _do_get return self._create_connection() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 188, in _create_connection return _ConnectionRecord(self) File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 270, in __init__ self.connection = self.__connect() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py", line 330, in __connect connection = self.__pool._creator() File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/strategies.py", line 80, in connect return dialect.connect(*cargs, **cparams) File "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/engine/default.py", line 281, in connect return self.dbapi.connect(*cargs, **cparams) sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None ERROR 1146 (42S02) at line 1: Table 'glance.migrate_version' doesn't exist Final sanity check failed. Please file a bug report on bugzilla.redhat.com against the openstack-glance package. Expected results: Successful creation of glance db. Additional info: This is from using RHOS on RHEL 6.4 RC 1 (as per official recommendation).
As a thought, I'm wondering if BZ# 879387 is in some way related to this, even though MySQL was used here: https://bugzilla.redhat.com/show_bug.cgi?id=879387
It appears that the value for sql_connection in both of the files: /etc/glance/glance-api.conf /etc/glance/glance-registry.conf is never set. This leaves a default of sqlite:///glance.sqlite. This ends up with a file that is not readable by the glance user.
It seems that the problem here is that the RPM is manipulating the files: /usr/share/glance/glance-registry-dist.conf /usr/share/glance/glance-api-dist.conf And not /etc/glance/glance-registry.conf /etc/glance/glance-api.conf The search path is picking up the files in /etc and thus the default location for the database, which is incorrect. There is some discussion in this area here: https://bugzilla.redhat.com/show_bug.cgi?id=887811#c14. Hopefully @eglynn or @pbrady can apply those conclusions here.
The basic problem here is that the fix for https://bugzilla.redhat.com/887811 patches the glance-cache-* utilities to pick up the glance distribution config by default, but neglects to do the same for the glance-manage utility.
Created attachment 700130 [details] Proposed fix for review.
I do not have the familiarity with RPMs that others here do, so perhaps this comment is off base. However it seems strange to me to modify source code with sed in the installation. I would be more comfortable with a patch.
Comment on attachment 700130 [details] Proposed fix for review. Would it be better to use a patch instead of a sed command in the installation?
Pádraig - thanks for the feedback, I'm now tending to agree with you that the parameterization of /usr/share is not worth losing the generality of the alternate solution. A slightly different approach is required for glance, as the config files are named for the service (glance-api etc.) as opposed to the project (glance) as in the nova case. Patches to follow ...
Created attachment 701215 [details] Follow up dist-git patch to remove now obsolete editing of glance-cache-* utils to pick up dist config.
Comment on attachment 701215 [details] Follow up dist-git patch to remove now obsolete editing of glance-cache-* utils to pick up dist config. +1 assuming of course the patches are updated later to include the necessary support
What is the workaround for this issue? Setting sql_connection in: /etc/glance/glance-registry.conf /etc/glance/glance-api.conf
Only glance-registry.conf needs to be updated as far as I know. Also I'd set the rpc_backend setting as per the dist conf too.
I discussed with Russell Bryant on IRC and the outcome of our discussion and some testing on my part was: - The rpc_backend value does not apply to glance, the value notifier_strategy however does. - We do not set notifier_strategy at this time in our dist configs, nor do they appear to be set in the ones you get via "manual" installation. - The sql_connection is as per comment # 15 set in both files in our dist configs. As such I've added this note to the errata (based on the previous one for cinder and nova): The following known issue has been identified with these packages, impacting deployments performed without the use of the packstack utility: * Currently Glance and the associated utilities only retrieve configuration values from /etc/glance/glance-registry.conf and /etc/glance/glance-api.conf. As a result they ignore distribution specific configuration values defined in other files. To work around this issue you must ensure that the sql_connection configuration key in both /etc/glance/glance-registry.conf and /etc/glance/glance-api.conf is uncommented and contains the correct details for the MySQL server in your environment. This change must be made on all systems you wish to host Glance on and run the associated utilities from.
How to test ----------- Install openstack-glance: $ sudo yum install openstack-glance Ensure mysql is installed and running: $ sudo service mysqld status Initialize glance DB: $ sudo openstack-db --init --service glance Ensure the migration has succeeded: $ echo "select * from migrate_version;" | mysql -t -u glance -pglance glance +-------------------+--------------------------------------------------------------------+---------+ | repository_id | repository_path | version | +-------------------+--------------------------------------------------------------------+---------+ | Glance Migrations | /usr/lib/python2.6/site-packages/glance/db/sqlalchemy/migrate_repo | 15 | +-------------------+--------------------------------------------------------------------+---------+
One additional step for the "How to test" section, if there's preexisting glance DB on the current host. Before initializing the glance DB, drop any pre-existing remnants: $ sudo openstack-db --drop --service glance
*** Bug 916619 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0672.html