Database downgrades do not work, no tests

Bug #854905 reported by Brian Lamar
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Hengqing Hu

Bug Description

When attempting to downgrade the Nova database using migrate's manage.py I get the following error:

http://paste.openstack.org/show/2486/

1) This error should be fixed
2) Tests should be run to ensure the database can be migrated from 1 -> X and X -> 1 (see Glance' test_migrations for a good example).

Revision history for this message
Dan Prince (dan-prince) wrote :

Fixing migration 031 is easy enough:

+ # grab tables
+ fixed_ips = Table('fixed_ips', meta, autoload=True)
+ virtual_interfaces = Table('virtual_interfaces', meta, autoload=True)

See the attached patch too....

However there are many other nova migrations which don't even attempt. Have a look at 030 (multi nic) which just throws an a data loss exception. I'm not sure there is always a good solution when performing the downgrades however I do agree that we should always attempt to do them.

Revision history for this message
Gavin B (gavin-brebner-orange) wrote :

Updating status and importance. We need upgrade/rewind to work for production clusters.

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Hengqing Hu (hudayou)
Changed in nova:
assignee: nobody → Hengqing Hu (hudayou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3891

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/3891
Committed: http://github.com/openstack/nova/commit/8e825c4024f9feb18ca5e2416484ef4096c3bb06
Submitter: Jenkins
Branch: master

commit 8e825c4024f9feb18ca5e2416484ef4096c3bb06
Author: Hengqing Hu <email address hidden>
Date: Wed Feb 8 00:02:54 2012 +0800

    Make database downgrade works

    Fixes bug #854905

    Use sqlalchemy reflection whenever possible:
        http://sqlalchemy-migrate.readthedocs.org/en/latest/versioning.html

    Work around sqlalchemy-migrate sqlite 'bool column not deletable' issue:
        http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=143
        Add following sql scripts for sqlite:
            002_sqlite_downgrade.sql
            015_sqlite_downgrade.sql
            033_sqlite_downgrade.sql
            050_sqlite_downgrade.sql
            068_sqlite_downgrade.sql

    Work around sqlalchemy-migrate sqlite 'table with foreign key column not
    deletable' issue:
        http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=94
        Add following sql scripts for sqlite:
            003_sqlite_downgrade.sql
            006_sqlite_downgrade.sql
            007_sqlite_downgrade.sql
            012_sqlite_upgrade.sql
            013_sqlite_downgrade.sql
            020_sqlite_downgrade.sql
            030_sqlite_downgrade.sql
            038_sqlite_downgrade.sql
            042_sqlite_downgrade.sql
            053_sqlite_downgrade.sql
            067_sqlite_downgrade.sql

    Work around sqlalchemy-migrate 'migrate drops engine reference' issue:
        http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=72

    Add following sql scripts for long primary key to work with utf-8
    mysql table:
        072_mysql_upgrade.sql

    Add following sql scripts for postgresql:
        002_postgresql_downgrade.sql

    Add snake walk test cases for database migration based on glance migration
    test.

    Change-Id: Ib454ecb4662bbf47736c1b12d9a4f969f180ceb6

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → essex-4
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.