ironic-dbsync fails on SQLite due to bad support of migrations

Bug #1347604 reported by Viktor Serhieiev
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
High
David Shrewsbury

Bug Description

If you try to run ironic-dbsync using default backend (SQLIte) you'll get the following error

(venv)viktors@devstack:~/ironic$ ironic-dbsync --config-file etc/ironic/ironic.conf.local
INFO [alembic.migration] Context impl SQLiteImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade None -> 2581ebaf0cb2, initial migration
INFO [alembic.migration] Running upgrade 2581ebaf0cb2 -> 21b331f883ef, Add provision_updated_at
INFO [alembic.migration] Running upgrade 21b331f883ef -> 3cb628139ea4, Nodes add console enabled
/home/viktors/ironic/.tox/venv/local/lib/python2.7/site-packages/alembic/util.py:189: UserWarning: Skipping unsupported ALTER for creation of implicit constraint
  warnings.warn(msg)
INFO [alembic.migration] Running upgrade 3cb628139ea4 -> 31baaf680d2b, Add Node instance info
INFO [alembic.migration] Running upgrade 31baaf680d2b -> 3bea56f25597, add unique constraint to instance_uuid
CRITI [ironic] NotImplementedError: No support for ALTER of constraints in SQLite dialect

Tags: db
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

This happens because of SQLite ALTER limitations - see http://www.sqlite.org/omitted.html

Revision history for this message
Dmitry Tantsur (divius) wrote :

Importance - high, as it will badly affect new users, trying to follow quick start guide.

summary: - ironic-dbsync fails on SQLite
+ ironic-dbsync fails on SQLite due to bad support of migrations
Changed in ironic:
status: New → Triaged
importance: Undecided → High
Changed in ironic:
assignee: nobody → Victor Sergeyev (vsergeyev)
status: Triaged → In Progress
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

My proposal is - to fill DB schema from models in this case. We also can use this approach for testing and initial installation on any backend, instead of running migrations. See patch on review - https://review.openstack.org/#/c/107629/

Revision history for this message
Ruby Loo (rloo) wrote :

Victor's change adds a new subcommand for ironic-dbsync. (name is being discussed, something like 'create').

It means possibly updating the documentation at:
- http://docs.openstack.org/developer/ironic/dev/dev-quickstart.html#exercising-the-services-locally
- step 6 of http://docs.openstack.org/developer/ironic/deploy/install-guide.html#configure-the-bare-metal-service

The default for ironic-dbsync is 'upgrade'. Do we want to leave it as that, or change it to this new subcommand?

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

Reviewed: https://review.openstack.org/107629
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=e76932a0730abfd98092b4b9cbadd3a90cb32fb6
Submitter: Jenkins
Branch: master

commit e76932a0730abfd98092b4b9cbadd3a90cb32fb6
Author: Victor Sergeyev <email address hidden>
Date: Thu Jul 17 13:13:20 2014 +0300

    Use metadata.create_all() to initialise DB schema

    There is no need to run database migration each time, when we want to
    get a new actual database schema. Running all migration scripts takes a
    long time on production databases and can be not suitable for SQLite
    because of Alembic limitation.

    Added create_schema() method, which supposes to be used for initial
    installation instead of upgrade('head').

    Partial-Bug: #1347604

    Change-Id: I039d955f051eda015bef2299122fd1f0fb5c46da

Dmitry Tantsur (divius)
Changed in ironic:
milestone: none → juno-rc1
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

Documentation should be fixed, befor close this bug. My English is far from perfect, so I'll be glad, if someone with good English will fix the installation docs :)

Changed in ironic:
assignee: Victor Sergeyev (vsergeyev) → nobody
Revision history for this message
David Shrewsbury (dshrews) wrote :

I'll take care of the documentation.

Changed in ironic:
assignee: nobody → David Shrewsbury (dshrews)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

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

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: juno-rc1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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