alembic migration error on increase-node-name-length

Bug #1444270 reported by Haomeng,Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Haomeng,Wang

Bug Description

Run ironic-dbsync with DB2 as database background, found new issue as below:

07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Context impl IBMDBImpl.
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Will assume transactional DDL.
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade -> 2581ebaf0cb2, initial migration
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 2581ebaf0cb2 -> 21b331f883ef, Add provision_updated_at
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 21b331f883ef -> 3cb628139ea4, Nodes add console enabled
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 3cb628139ea4 -> 31baaf680d2b, Add Node instance info
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 31baaf680d2b -> 3bea56f25597, add unique constraint to instance_uuid
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 3bea56f25597 -> 487deb87cc9d, add conductor_affinity and online
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 487deb87cc9d -> 242cc6a923b3, Add Node.maintenance_reason
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 242cc6a923b3 -> 5674c57409b9, replace NOSTATE with AVAILABLE
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 5674c57409b9 -> bb59b63f55a, add_node_driver_internal_info
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade bb59b63f55a -> 3ae36a5f5131, add_logical_name
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 3ae36a5f5131 -> 1e1d5ace7dc6, add inspection_started_at and inspection_finished_at
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 1e1d5ace7dc6 -> 4f399b21ae71, Add node.clean_step
07:59:42 vs335.rch.kstart.com INFO [alembic.migration] Running upgrade 4f399b21ae71 -> 2fb93ffd2af1, increase-node-name-length
07:59:42 vs335.rch.kstart.com CRITI [ironic] DBError: (ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "ALTER TABLE NODES ALTER COLUMN na" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<create_variable>". SQLSTATE=42601 SQLCODE=-104 'ALTER TABLE nodes ALTER COLUMN name TYPE VARCHAR(255)' ()
07:59:42 vs335.rch.kstart.com Traceback (most recent call last):
07:59:42 vs335.rch.kstart.com File "/usr/bin/ironic-dbsync", line 10, in <module>
07:59:42 vs335.rch.kstart.com sys.exit(main())
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 110, in main
07:59:42 vs335.rch.kstart.com CONF.command.func()
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 36, in upgrade
07:59:42 vs335.rch.kstart.com migration.upgrade(CONF.command.revision)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/db/migration.py", line 36, in upgrade
07:59:42 vs335.rch.kstart.com return get_backend().upgrade(version)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/migration.py", line 56, in upgrade
07:59:42 vs335.rch.kstart.com alembic.command.upgrade(config, revision or 'head')
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/command.py", line 165, in upgrade
07:59:42 vs335.rch.kstart.com script.run_env()
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/script.py", line 382, in run_env
07:59:42 vs335.rch.kstart.com util.load_python_file(self.dir, 'env.py')
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/util.py", line 241, in load_python_file
07:59:42 vs335.rch.kstart.com module = load_module_py(module_id, path)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/compat.py", line 79, in load_module_py
07:59:42 vs335.rch.kstart.com mod = imp.load_source(module_id, path, fp)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/alembic/env.py", line 54, in <module>
07:59:42 vs335.rch.kstart.com run_migrations_online()
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/alembic/env.py", line 51, in run_migrations_online
07:59:42 vs335.rch.kstart.com context.run_migrations()
07:59:42 vs335.rch.kstart.com File "<string>", line 7, in run_migrations
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/environment.py", line 742, in run_migrations
07:59:42 vs335.rch.kstart.com self.get_context().run_migrations(**kw)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/migration.py", line 305, in run_migrations
07:59:42 vs335.rch.kstart.com step.migration_fn(**kw)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/alembic/versions/2fb93ffd2af1_increase_node_name_length.py", line 35, in upgrade
07:59:42 vs335.rch.kstart.com existing_nullable=True)
07:59:42 vs335.rch.kstart.com File "<string>", line 7, in alter_column
07:59:42 vs335.rch.kstart.com File "<string>", line 1, in <lambda>
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/util.py", line 386, in go
07:59:42 vs335.rch.kstart.com return fn(*arg, **kw)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/operations.py", line 470, in alter_column
07:59:42 vs335.rch.kstart.com existing_autoincrement=existing_autoincrement
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/ddl/impl.py", line 148, in alter_column
07:59:42 vs335.rch.kstart.com existing_nullable=existing_nullable,
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/alembic/ddl/impl.py", line 106, in _exec
07:59:42 vs335.rch.kstart.com return conn.execute(construct, *multiparams, **params)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
07:59:42 vs335.rch.kstart.com return meth(self, multiparams, params)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
07:59:42 vs335.rch.kstart.com return connection._execute_ddl(self, multiparams, params)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
07:59:42 vs335.rch.kstart.com compiled
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
07:59:42 vs335.rch.kstart.com context)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/compat/handle_error.py", line 261, in _handle_dbapi_exception
07:59:42 vs335.rch.kstart.com e, statement, parameters, cursor, context)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1155, in _handle_dbapi_exception
07:59:42 vs335.rch.kstart.com util.raise_from_cause(newraise, exc_info)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
07:59:42 vs335.rch.kstart.com reraise(type(exception), exception, tb=exc_tb)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
07:59:42 vs335.rch.kstart.com context)
07:59:42 vs335.rch.kstart.com File "/usr/lib/python2.7/site-packages/ibm_db_sa/ibm_db.py", line 106, in do_execute
07:59:42 vs335.rch.kstart.com cursor.execute(statement, parameters)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/ibm_db_dbi.py", line 1335, in execute
07:59:42 vs335.rch.kstart.com self._execute_helper(parameters)
07:59:42 vs335.rch.kstart.com File "/usr/lib64/python2.7/site-packages/ibm_db_dbi.py", line 1247, in _execute_helper
07:59:42 vs335.rch.kstart.com raise self.messages[len(self.messages) - 1]
07:59:42 vs335.rch.kstart.com DBError: (ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "ALTER TABLE NODES ALTER COLUMN na" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<create_variable>". SQLSTATE=42601 SQLCODE=-104 'ALTER TABLE nodes ALTER COLUMN name TYPE VARCHAR(255)' ()

Haomeng,Wang (whaom)
description: updated
Changed in ironic:
assignee: nobody → Haomeng,Wang (whaom)
importance: Undecided → Medium
status: New → In Progress
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/173721

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

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

commit a4ade0beaa196db26595301b9692d6236af61709
Author: Haomeng, Wang <email address hidden>
Date: Wed Apr 15 08:38:32 2015 +0000

    supports alembic migration for db2

    This patch adds the optional runtime dependency to support db2
    for alembic migration, will not break the default mysql path.

    And I did the testing in db2 env, works fine.

    Change-Id: I59deff0d82bc9e2e7ceaa157c626cd2bb7a36f0d
    Closes-Bug: 1444270

Changed in ironic:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/178505

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

The fix assumes that ibm_db_alembic package is installed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ironic (stable/kilo)

Change abandoned by Haomeng,Wang (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/178505

Changed in ironic:
milestone: none → 4.0.0
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.