[openstack-dev] database migrations with data - for projects beyond nova
Sean Dague
sdague at linux.vnet.ibm.com
Tue Feb 5 21:23:14 UTC 2013
In nova I recently added a framework to nova/tests/test_migrations.py
that lets you insert data at any migration, and also run a check after
the migration to look at the data. This is extremely important on
database migrations that manipulate the data from one format to another,
or move data between tables (i.e. don't just add columns). Also, because
of the way it's written, the tests will run on MySQL and (soon)
Postgresql in CI, so we can be sure that these work on real databases,
not just sqlite.
In adding this to nova, we discovered a data loosing bug with
availability zones in our migration 147, where if more than one AZ were
defined, you'd loose all but the first one. Good find and fix that was
hard to realize by inspection.
This seems pretty valuable to find possible data corrupting bugs moving
from Folsom -> Grizzly.
I'd like to get this into the other core projects that have database
migrations. I've started with cinder, because it forked the nova code at
Folsom, so is close. The framework is out for review, and tests will be
coming shortly.
Matt Treinish is going to take an attempt at Glance.
Keystone and Quantum could use volunteers!
Things should be relatively straight forward on Keystone, though Quantum
is going to need extra kinds of special because its alembec instead of
sqlalchemy migrate.
There are a few too many irregularities between projects testing
frameworks right now to take this to oslo first, and then back out in
the 2 weeks before dev cutoff. Though I'd like to do a design summit
session in Portland on exactly that, so in H we can have a single common
version of this that's easy to use.
-Sean
--
Sean Dague
IBM Linux Technology Center
email: sdague at linux.vnet.ibm.com
alt-email: sldague at us.ibm.com
More information about the OpenStack-dev
mailing list