Comment 10 for bug 883988

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

I've put together a small patch that disables the auto creation of database schema and instead performs a simple query at service startup via the sqlalchemy models defined in glance.db.models. These queries will fail if the tables and their columns do not match the models, meaning the database is not up to date and migration needs to be run. Database connection/permission issues are also caught here, previously they were caught during auto creation.

Should note that packaging will run the manual migration (glance-manage db_sync) if glance-registry.conf points to a local database. Otherwise, it will just restart the service. In the case of a shared database that requires a migration run, the service will fail to start completely, which IMHO is better than a database that ends up in an inconsistent state