[openstack-dev] [neutron] Plethora of dbase migration questions...

Paul Michali pc at michali.net
Mon Jul 6 18:00:56 UTC 2015


Hi,

I have some urgent requests about migration that I'm hoping to get some
info on. I'm working on a bug where I need to add two (related) fields to a
table for VPNaaS. Here's the objectives related to migration...

1) create local_v4_ip and lcoal_v6_ip fields in the vpnservice table
2) for each entry in the vpnservice table:
    2.1) Get the router.gw_port.fixed_ips list
    2.2) Determine the version of each fixed IP and store the first of each
version (if any) into the appropriate new field.

I have created a migration file, and I changed the down_revision to be the
number of the revision that is the first in the migration chain in the VPN
repo.

Here are the many questions I have...

When I look in the VPN repo, the HEAD file has the version 'kilo', which is
not the current head.

Shouldn't it the version number of the first file in the migration chain?
For my commit, I'm assuming I change the HEAD file to use my migration
file's version?

I set HEAD to my migration file, and my file has a down revision of the
previous head's revision. If I run 'neutron-db-manage --config-file
../neutron/etc/neutron.conf --config-file
../neutron/etc/neutron/plugins/ml2/ml2_conf.ini check_migration' there is
no output so I guess that is OK.

As I develop my new migration file, is there a way that I can test it
(running neutron-db-migration, maybe)?
Is there a way to run the migration file under the debugger, as well
(importing pdb, for example)?

In the migration, I can add the columns needed. What's the best way to fill
out those fields - using raw SQL queries or create a Session object and
access the VpnService object's router object?

I see there is some op.bind() call and then engine.execute(), but could use
some help on the best way to extract the needed queries (I need to access
the vpnservice's router, and then access the (Port) gw_port relationship,
and from that access the (IPAllocation) fixed_ips list).

Appreciate any advise here on how to debug the migration stuff...

Paul Michali (pc_m)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150706/24d3b9b8/attachment.html>


More information about the OpenStack-dev mailing list