I've written a migration to handle moving the data in the current instances table mac_address column into the new mac_address table before the column is removed.<div><br></div><div>I agree with Jay, data should never be discarded when migrating forward. I don't think there has been a case yet where data is migrated in nova. This could be the first.<br>
<div><br></div><div>-trey<br><br><div class="gmail_quote">On Mon, Mar 28, 2011 at 8:17 AM, Jay Pipes <span dir="ltr"><<a href="mailto:jaypipes@gmail.com">jaypipes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Mar 28, 2011 at 2:31 AM, Ishimoto, Ryu <<a href="mailto:ryu@midokura.jp">ryu@midokura.jp</a>> wrote:<br>
> Hi All,<br>
> I was looking at the multi-nic<br>
> blueprint(<a href="https://blueprints.launchpad.net/nova/+spec/nova-multi-nic" target="_blank">https://blueprints.launchpad.net/nova/+spec/nova-multi-nic</a>), and<br>
> in particular:<br>
> 1) removing mac_address column from the instances table and creating a<br>
> mac_addresses table. This is for storing which instances own which mac<br>
> addresses as well as which network each mac is for.<br>
> What happens(or should happen) to the MAC addresses that are already<br>
> associated with instances?  Will they be migrated to the new mac_addresses<br>
> table?  Or will they be discarded completely?<br>
<br>
</div>Data should never be discarded in situations like this where a column<br>
is moved to another table's schema (or to be records in another<br>
table).<br>
<div class="im"><br>
> I was curious to know how Nova usually handles data migration issues like<br>
> this.<br>
<br>
</div>No idea whether/if Nova's data migrations have previously needed to<br>
preserve data in this way. Glance does, however, and you can use the<br>
following Python changescript to get an idea how to perform this exact<br>
type of change:<br>
<br>
<a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_add_disk_format.py" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_add_disk_format.py</a><br>

<br>
Note that SQLite has issues if you try to add and drop columns in the<br>
same changescript and you also have an unrelated column that is<br>
indexed (see: <a href="http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117" target="_blank">http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117</a>).<br>
If this is the case, you will need to write SQL-based changescripts<br>
specfically for SQLite. You can see examples of how this is<br>
accomplished in Glance for the same DB version here:<br>
<br>
<a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_upgrade.sql" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_upgrade.sql</a><br>

<a href="http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_downgrade.sql" target="_blank">http://bazaar.launchpad.net/~glance-core/glance/cactus-trunk/view/head:/glance/registry/db/migrate_repo/versions/003_sqlite_downgrade.sql</a><br>

<br>
Cheers,<br>
jay<br>
<br>
_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</blockquote></div><br></div></div><PRE>
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.
</PRE>