~markmc/nova/sqlalchemy-0.7-migration-fixes

Viewing all changes in revision 1485.

  • Committer: Mark McLoughlin
  • Date: 2011-08-24 14:50:46 UTC
  • Revision ID: markmc@redhat.com-20110824145046-kio8wg552hv5vl87
Fix quotas migration failure

With sqlalchemy 0.7.2 and migrate 0.7.1, I was seeing:

   Traceback (most recent call last):
     File "/usr/lib/python2.7/site-packages/nova/db/migration.py", line 37, in db_sync
       ret = IMPL.db_sync(version=version)
     [..]
     File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/migrate_repo/versions/016_make_quotas_key_and_value.py", line 189, in upgrade
       new_quotas.rename('quotas')
     [..]
     File "/usr/lib/python2.7/site-packages/migrate/changeset/schema.py", line 479, in deregister
       del meta.tables[key]
     File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/_collections.py", line 38, in _immutable
       raise TypeError("%s object is immutable" % self.__class__.__name__)
   TypeError: immutabledict object is immutable

This is actually a bug in sqlalchemy-migrate:

  http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=128

But it can be worked around by ensuring there isn't a 'quotas' table in
the metadata's table hash before renaming.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: