Display alembic branch in neutron-db-manage current

Bug #1488021 reported by Matt Thompson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Wishlist
Matt Thompson

Bug Description

In my AIO test instance, I have just upgraded neutron from 7.0.0.0b3.dev200 to 7.0.0.0b3.dev356. If I run 'neutron-db-manage current', I see:

root@aio_neutron_server_container-47ef3931:~# neutron-db-manage current 2>/dev/null
  Running current for neutron ...
2a16083502f3 (head)
1b4c6e320f79
  OK
root@aio_neutron_server_container-47ef3931:~#

Based on this, I can see that one branch is not on head, and that migrations will need to be applied to that specific branch.

In our deployment tooling, what we currently do after neutron has upgraded is run 'neutron-db-manage upgrade liberty_expand@head' while neutron-server is up and running. We then proceed to shut down all neutron-server instances and run 'neutron-db-manage upgrade liberty_contract@head'. Once that has completed, we start up neutron-server again.

What would be ideal is if the 'neutron-db-manage current' output also indicated which alembic branch the migration ID was referring to. That way, we could determine if we're on head for a given branch, and if not proceed with applying the migrations for that specific branch. For the liberty_expand@head branch, this is a non-issue since these migrations can run with neutron-server up and responding. However, if we can avoid having to shut down neutron-server unnecessarily when there are no pending liberty_contract@head migrations, this would give us a much smoother deployment experience.

Please give me a shout if I can provide any further information.

Thanks,
Matt

Tags: db
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

Thanks for the report!

The way it's done now is that neutron-db-manage merely calls to 'alembic current' that actually generates the output. If we want to see it with branch labels, we'll need to reimplement it to call to proper alembic API.

Also note for your tooling: liberty_contract is removed into contract, and liberty_expand into expand.

Henry Gessau (gessau)
tags: added: db
Revision history for this message
Ann Taraday (akamyshnikova) wrote :

I suppose that is more alembic issue than Neutron. So, I suggest to put description of your problem here https://bitbucket.org/zzzeek/alembic/issues. Reimplementing of Alembic API is not a preferred solution for this.

Changed in neutron:
importance: Undecided → Wishlist
Matt Thompson (mattt416)
Changed in neutron:
assignee: nobody → Matt Thompson (mattt416)
Revision history for this message
Mike Bayer (zzzeek) wrote :

what's wrong with neutron-db-manage current --verbose ? that shows everything. current branch labels is somewhat arbitrary.

Revision history for this message
Mike Bayer (zzzeek) wrote :

e.g.:

$ python -m alembic.config current --verbose
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
Current revision(s) for sqlite:///mydb.db:
Rev: 48174263787a (head)
Parent: 18f487845978
Path: /Users/classic/dev/alembic/foo/versions/48174263787a_rev3.py

    rev3

    Revision ID: 48174263787a
    Revises: 18f487845978
    Create Date: 2015-09-16 11:30:11.038838

Rev: 41d57d6ca6fb (head)
Parent: 3ba50d0694e
Branch names: 2a, 2b
Path: /Users/classic/dev/alembic/foo/versions/41d57d6ca6fb_rev2b.py

    rev2b

    Revision ID: 41d57d6ca6fb
    Revises: 3ba50d0694e
    Create Date: 2015-09-16 11:30:30.747208

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/224584

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/224584
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b08c3d57a94e0adb012c885031010ecf61688b31
Submitter: Jenkins
Branch: master

commit b08c3d57a94e0adb012c885031010ecf61688b31
Author: Matt Thompson <email address hidden>
Date: Thu Sep 17 12:27:44 2015 +0100

    Add --verbose to subset of cmds in neutron-db-manage

    This commit updates neutron/db/migration/cli.py such that --verbose can
    be passed to the following commands:

    - current
    - history
    - branches

    We also update tests in neutron/tests/unit/db/test_migration.py and add
    a new test for 'neutron-db-manage branches' as that appears to be
    untested.

    Lastly, we add a brief description of the newly added capability to
    doc/source/devref/alembic_migrations.rst.

    Change-Id: I9fc136055b422f12a22c1365f52f17df53219820
    Closes-Bug: #1488021

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 8.0.0.0b1

This issue was fixed in the openstack/neutron 8.0.0.0b1 development milestone.

Changed in neutron:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.