[openstack-dev] [Neutron][LBaaS] - Best release to upgrade from LBaaS v1 to v2

Saverio Proto saverio.proto at switch.ch
Thu Mar 9 12:38:04 UTC 2017


> I would recommend experimenting with the database-migration-from-v1-to-v2.py
> script and working with your vendor (if you are using a vendor load
> balancing engine) on a migration path.


Hello,
there is no vendor here to help us :)

I made a backup of the current DB.

I identified this folder on our Neutron server:

/usr/lib/python2.7/dist-packages/neutron_lbaas/db/migration ; tree
.
|-- alembic_migrations
|   |-- env.py
|   |-- env.pyc
|   |-- __init__.py
|   |-- __init__.pyc
|   |-- README
|   |-- script.py.mako
|   `-- versions
|       |-- 364f9b6064f0_agentv2.py
|       |-- 364f9b6064f0_agentv2.pyc
|       |-- 4b6d8d5310b8_add_index_tenant_id.py
|       |-- 4b6d8d5310b8_add_index_tenant_id.pyc
|       |-- 4ba00375f715_edge_driver.py
|       |-- 4ba00375f715_edge_driver.pyc
|       |-- 4deef6d81931_add_provisioning_and_operating_statuses.py
|       |-- 4deef6d81931_add_provisioning_and_operating_statuses.pyc
|       |-- CONTRACT_HEAD
|       |-- EXPAND_HEAD
|       |-- kilo_release.py
|       |-- kilo_release.pyc
|       |-- lbaasv2.py
|       |-- lbaasv2.pyc
|       |-- lbaasv2_tls.py
|       |-- lbaasv2_tls.pyc
|       |-- liberty
|       |   |-- contract
|       |   |   |-- 130ebfdef43_initial.py
|       |   |   `-- 130ebfdef43_initial.pyc
|       |   `-- expand
|       |       |-- 3345facd0452_initial.py
|       |       `-- 3345facd0452_initial.pyc
|       |-- mitaka
|       |   `-- expand
|       |       |-- 3426acbc12de_add_flavor_id.py
|       |       |-- 3426acbc12de_add_flavor_id.pyc
|       |       |-- 3543deab1547_add_l7_tables.py
|       |       |-- 3543deab1547_add_l7_tables.pyc
|       |       |-- 4a408dd491c2_UpdateName.py
|       |       |-- 4a408dd491c2_UpdateName.pyc
|       |       |-- 62deca5010cd_add_tenant_id_index_for_l7_tables.py
|       |       |-- 62deca5010cd_add_tenant_id_index_for_l7_tables.pyc
|       |       |-- 6aee0434f911_independent_pools.py
|       |       `-- 6aee0434f911_independent_pools.pyc
|       |-- start_neutron_lbaas.py
|       `-- start_neutron_lbaas.pyc
|-- __init__.py
`-- __init__.pyc

7 directories, 40 files

Now here it says: "Create a revision file"

https://github.com/openstack/neutron-lbaas/blob/master/tools/database-migration-from-v1-to-v2.py#L30

There is some specific openstack-dev documentation to "Create a revision
file" or I should just learn the Alembic tool ? I never used it before.

So far I did copy the alembic.ini from here:
https://github.com/openstack/neutron/blob/master/neutron/db/migration/alembic.ini

into /usr/lib/python2.7/dist-packages/neutron_lbaas/db/migration

then I did run the command:

alembic revision -m "migrate to LBaaSv2"

as a result it created the file:
/usr/lib/python2.7/dist-packages/neutron_lbaas/db/migration/alembic_migrations/versions/24274573545b_migrate_to_lbaasv2.py

Then I added the script to that file:
wget -O -
https://raw.githubusercontent.com/openstack/neutron-lbaas/master/tools/database-migration-from-v1-to-v2.py
>> alembic_migrations/versions/24274573545b_migrate_to_lbaasv2.py

I tried now:
neutron-db-manage upgrade heads

but it fails with a easy stacktrace. I get stuck here:
https://github.com/openstack/neutron-lbaas/blob/master/tools/database-migration-from-v1-to-v2.py#L346

of course the query:
select tenant_id from pools;

returns more than 1 tenant_id

it means I cannot migrate if I have more than 1 tenant using LBaaS v1 ?

am I doing something completely wrong here ? am I on the right direction ?

thank you

Saverio
















More information about the OpenStack-dev mailing list