OpenStack Image Registry and Delivery Service (Glance)

Tables are generated outside of migration process

Reported by Rick Harris on 2011-08-11
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Low
Jay Pipes

Bug Description

Currently SQLALchemy is 'nice' enough to create tables for us if they are not present. In theory this would be great, except that it messes up our migrations.

The reason is, when SQLAlchemy autogenerates the tables, it doesn't include a schema_version...so, when someone subsequently run db_sync it attempts to create the tables that are already there.

The solution here is probably to disable the autocreation of tables.

Jay Pipes (jaypipes) wrote :

I think the solution here is not to disable the autocreation of tables but instead to put a try: except block around the code in db_sync in nova-manage that catches the predictable table already exists error, and simply sets the the schema_version record to the last DB version in the migrate_repo... I'll have a stab at this.

Changed in glance:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Jay Pipes (jaypipes)
milestone: none → essex-1
Jay Pipes (jaypipes) on 2011-09-23
Changed in glance:
status: Triaged → In Progress
Jay Pipes (jaypipes) on 2011-11-08
Changed in glance:
milestone: essex-1 → essex-2
Thierry Carrez (ttx) on 2011-12-15
Changed in glance:
milestone: essex-2 → essex-3
Jay Pipes (jaypipes) on 2012-01-23
Changed in glance:
milestone: essex-3 → essex-4
Jay Pipes (jaypipes) wrote :

I'd love to see migrations standardized and cleaned up across most core projects, actually ... I'm not getting anywhere with this branch and am going to push it off until Folsom I think...

Changed in glance:
milestone: essex-4 → none
status: In Progress → Confirmed

I tried to reproduce this issue, but it just worked here for sqlite, mysql and postgresql.
While starting glance before db_sync did create tables without version, a subsequent db_sync returned without error and did add the version to the DB.

Mark McLoughlin (markmc) wrote :

rc3 glance automatically version controls auto-created DBs. See bug #966241

Jay Pipes (jaypipes) wrote :

OK, I'm going to mark this bug Fix Released, then...

Changed in glance:
status: Confirmed → Fix Released
Thierry Carrez (ttx) on 2012-05-15
Changed in glance:
milestone: none → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers