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

Saverio Proto saverio.proto at switch.ch
Thu Mar 9 15:19:19 UTC 2017


Hello,

I managed to do the database migration.

I had to skip this logic:
https://github.com/openstack/neutron-lbaas/blob/master/tools/database-migration-from-v1-to-v2.py#L342-L353

I had to force flag=True

That code obviously breaks if you have LBaaS used by more than 1 tenant.

What was the goal ? to make sure that a given healthmonitor is not
reused in multiple pools ?

Should the right approach be to check if these two values are the same ?:

select count(DISTINCT monitor_id) from poolmonitorassociations;
select count(monitor_id) from poolmonitorassociations;

Second question: should the old tables from LBaaSV1 be dropped ?

Please give me feedback so I can fix the code and submit a review.

thank you

Saverio


On 09/03/17 13:38, Saverio Proto wrote:
>> 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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 


-- 
SWITCH
Saverio Proto, Peta Solutions
Werdstrasse 2, P.O. Box, 8021 Zurich, Switzerland
phone +41 44 268 15 15, direct +41 44 268 1573
saverio.proto at switch.ch, http://www.switch.ch

http://www.switch.ch/stories



More information about the OpenStack-dev mailing list