← Back to team overview

openstack team mailing list archive

Re: multi-nic blueprint - data migration

 

On Mon, Mar 28, 2011 at 2:31 AM, Ishimoto, Ryu <ryu@xxxxxxxxxxx> wrote:
> Hi All,
> I was looking at the multi-nic
> blueprint(https://blueprints.launchpad.net/nova/+spec/nova-multi-nic), and
> in particular:
> 1) removing mac_address column from the instances table and creating a
> mac_addresses table. This is for storing which instances own which mac
> addresses as well as which network each mac is for.
> What happens(or should happen) to the MAC addresses that are already
> associated with instances?  Will they be migrated to the new mac_addresses
> table?  Or will they be discarded completely?

Data should never be discarded in situations like this where a column
is moved to another table's schema (or to be records in another
table).

> I was curious to know how Nova usually handles data migration issues like
> this.

No idea whether/if Nova's data migrations have previously needed to
preserve data in this way. Glance does, however, and you can use the
following Python changescript to get an idea how to perform this exact
type of change:

http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_add_disk_format.py

Note that SQLite has issues if you try to add and drop columns in the
same changescript and you also have an unrelated column that is
indexed (see: http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117).
If this is the case, you will need to write SQL-based changescripts
specfically for SQLite. You can see examples of how this is
accomplished in Glance for the same DB version here:

http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_upgrade.sql
http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_downgrade.sql

Cheers,
jay



Follow ups

References