Comment 5 for bug 779311

Revision history for this message
Rick Harris (rconradharris) wrote :

> I let glance recreate it on startup (which it seems to do). But I never called db_sync or anything else. I am certain that this is the cause of my issue.

Yeah that sounds like the root cause. The current code auto-creates the tables if they're not present. This leads to an inconsistent state since the `migrate_version` table isn't present.

I think the solution here is to prevent tables from being created outside of migrations; in other words, the only way to create the schema is via `glance-manage db_sync`. That change is in this branch: https://code.launchpad.net/~rconradharris/glance/lp779311

> Is there a way to fix it?

Probably the best way is to eyeball the schema in the DB and compare that to the migrations present in migrate_repo/versions. By looking at the differences, you should be able to 'guess' the proper version.

For example, if in your schema `image_properties` is using `name` instead of `key`, then your DB version is at 6 (the latest and greatest).

You can then create a migrate_version table and populate it like

Glance Migrations|/usr/lib/pymodules/python2.6/glance/registry/db/migrate_repo|6